2019-04-17 12:06:00 +02:00
|
|
|
#include "list_entities.h"
|
2019-06-18 19:31:22 +02:00
|
|
|
#include "api_connection.h"
|
2024-03-10 19:52:22 +01:00
|
|
|
#include "esphome/core/application.h"
|
|
|
|
#include "esphome/core/log.h"
|
|
|
|
#include "esphome/core/util.h"
|
2019-04-17 12:06:00 +02:00
|
|
|
|
|
|
|
namespace esphome {
|
|
|
|
namespace api {
|
|
|
|
|
|
|
|
#ifdef USE_BINARY_SENSOR
|
|
|
|
bool ListEntitiesIterator::on_binary_sensor(binary_sensor::BinarySensor *binary_sensor) {
|
2019-06-18 19:31:22 +02:00
|
|
|
return this->client_->send_binary_sensor_info(binary_sensor);
|
2019-04-17 12:06:00 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef USE_COVER
|
2019-06-18 19:31:22 +02:00
|
|
|
bool ListEntitiesIterator::on_cover(cover::Cover *cover) { return this->client_->send_cover_info(cover); }
|
2019-04-17 12:06:00 +02:00
|
|
|
#endif
|
|
|
|
#ifdef USE_FAN
|
2022-01-23 10:21:54 +01:00
|
|
|
bool ListEntitiesIterator::on_fan(fan::Fan *fan) { return this->client_->send_fan_info(fan); }
|
2019-04-17 12:06:00 +02:00
|
|
|
#endif
|
|
|
|
#ifdef USE_LIGHT
|
2019-06-18 19:31:22 +02:00
|
|
|
bool ListEntitiesIterator::on_light(light::LightState *light) { return this->client_->send_light_info(light); }
|
2019-04-17 12:06:00 +02:00
|
|
|
#endif
|
|
|
|
#ifdef USE_SENSOR
|
2019-06-18 19:31:22 +02:00
|
|
|
bool ListEntitiesIterator::on_sensor(sensor::Sensor *sensor) { return this->client_->send_sensor_info(sensor); }
|
2019-04-17 12:06:00 +02:00
|
|
|
#endif
|
|
|
|
#ifdef USE_SWITCH
|
2019-06-18 19:31:22 +02:00
|
|
|
bool ListEntitiesIterator::on_switch(switch_::Switch *a_switch) { return this->client_->send_switch_info(a_switch); }
|
2019-04-17 12:06:00 +02:00
|
|
|
#endif
|
2021-11-29 20:00:51 +01:00
|
|
|
#ifdef USE_BUTTON
|
|
|
|
bool ListEntitiesIterator::on_button(button::Button *button) { return this->client_->send_button_info(button); }
|
|
|
|
#endif
|
2019-04-17 12:06:00 +02:00
|
|
|
#ifdef USE_TEXT_SENSOR
|
|
|
|
bool ListEntitiesIterator::on_text_sensor(text_sensor::TextSensor *text_sensor) {
|
2019-06-18 19:31:22 +02:00
|
|
|
return this->client_->send_text_sensor_info(text_sensor);
|
2019-04-17 12:06:00 +02:00
|
|
|
}
|
|
|
|
#endif
|
2022-02-03 19:24:31 +01:00
|
|
|
#ifdef USE_LOCK
|
|
|
|
bool ListEntitiesIterator::on_lock(lock::Lock *a_lock) { return this->client_->send_lock_info(a_lock); }
|
|
|
|
#endif
|
2019-04-17 12:06:00 +02:00
|
|
|
|
2019-06-18 19:31:22 +02:00
|
|
|
bool ListEntitiesIterator::on_end() { return this->client_->send_list_info_done(); }
|
2022-03-22 21:45:05 +01:00
|
|
|
ListEntitiesIterator::ListEntitiesIterator(APIConnection *client) : client_(client) {}
|
2019-04-17 12:06:00 +02:00
|
|
|
bool ListEntitiesIterator::on_service(UserServiceDescriptor *service) {
|
2019-06-18 19:31:22 +02:00
|
|
|
auto resp = service->encode_list_service_response();
|
|
|
|
return this->client_->send_list_entities_services_response(resp);
|
2019-04-17 12:06:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef USE_ESP32_CAMERA
|
|
|
|
bool ListEntitiesIterator::on_camera(esp32_camera::ESP32Camera *camera) {
|
2019-06-18 19:31:22 +02:00
|
|
|
return this->client_->send_camera_info(camera);
|
2019-04-17 12:06:00 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_CLIMATE
|
2019-06-18 19:31:22 +02:00
|
|
|
bool ListEntitiesIterator::on_climate(climate::Climate *climate) { return this->client_->send_climate_info(climate); }
|
2019-04-17 12:06:00 +02:00
|
|
|
#endif
|
|
|
|
|
2021-07-12 21:20:12 +02:00
|
|
|
#ifdef USE_NUMBER
|
|
|
|
bool ListEntitiesIterator::on_number(number::Number *number) { return this->client_->send_number_info(number); }
|
|
|
|
#endif
|
|
|
|
|
2024-03-10 19:52:22 +01:00
|
|
|
#ifdef USE_DATETIME_DATE
|
|
|
|
bool ListEntitiesIterator::on_date(datetime::DateEntity *date) { return this->client_->send_date_info(date); }
|
|
|
|
#endif
|
|
|
|
|
2024-04-09 03:46:35 +02:00
|
|
|
#ifdef USE_DATETIME_TIME
|
|
|
|
bool ListEntitiesIterator::on_time(datetime::TimeEntity *time) { return this->client_->send_time_info(time); }
|
|
|
|
#endif
|
|
|
|
|
2023-10-25 11:00:32 +02:00
|
|
|
#ifdef USE_TEXT
|
|
|
|
bool ListEntitiesIterator::on_text(text::Text *text) { return this->client_->send_text_info(text); }
|
|
|
|
#endif
|
|
|
|
|
2021-08-02 10:00:51 +02:00
|
|
|
#ifdef USE_SELECT
|
|
|
|
bool ListEntitiesIterator::on_select(select::Select *select) { return this->client_->send_select_info(select); }
|
|
|
|
#endif
|
|
|
|
|
2022-06-02 07:00:17 +02:00
|
|
|
#ifdef USE_MEDIA_PLAYER
|
|
|
|
bool ListEntitiesIterator::on_media_player(media_player::MediaPlayer *media_player) {
|
|
|
|
return this->client_->send_media_player_info(media_player);
|
|
|
|
}
|
|
|
|
#endif
|
2023-06-15 02:34:39 +02:00
|
|
|
#ifdef USE_ALARM_CONTROL_PANEL
|
|
|
|
bool ListEntitiesIterator::on_alarm_control_panel(alarm_control_panel::AlarmControlPanel *a_alarm_control_panel) {
|
|
|
|
return this->client_->send_alarm_control_panel_info(a_alarm_control_panel);
|
|
|
|
}
|
|
|
|
#endif
|
2022-06-02 07:00:17 +02:00
|
|
|
|
2019-04-17 12:06:00 +02:00
|
|
|
} // namespace api
|
|
|
|
} // namespace esphome
|