ESPHome  2025.3.3
list_entities.cpp
Go to the documentation of this file.
1 #include "list_entities.h"
2 #ifdef USE_API
3 #include "api_connection.h"
5 #include "esphome/core/log.h"
6 #include "esphome/core/util.h"
7 
8 namespace esphome {
9 namespace api {
10 
11 #ifdef USE_BINARY_SENSOR
13  this->client_->send_binary_sensor_info(binary_sensor);
14  return true;
15 }
16 #endif
17 #ifdef USE_COVER
19  this->client_->send_cover_info(cover);
20  return true;
21 }
22 #endif
23 #ifdef USE_FAN
25  this->client_->send_fan_info(fan);
26  return true;
27 }
28 #endif
29 #ifdef USE_LIGHT
31  this->client_->send_light_info(light);
32  return true;
33 }
34 #endif
35 #ifdef USE_SENSOR
37  this->client_->send_sensor_info(sensor);
38  return true;
39 }
40 #endif
41 #ifdef USE_SWITCH
43  this->client_->send_switch_info(a_switch);
44  return true;
45 }
46 #endif
47 #ifdef USE_BUTTON
49  this->client_->send_button_info(button);
50  return true;
51 }
52 #endif
53 #ifdef USE_TEXT_SENSOR
55  this->client_->send_text_sensor_info(text_sensor);
56  return true;
57 }
58 #endif
59 #ifdef USE_LOCK
61  this->client_->send_lock_info(a_lock);
62  return true;
63 }
64 #endif
65 #ifdef USE_VALVE
67  this->client_->send_valve_info(valve);
68  return true;
69 }
70 #endif
71 
75  auto resp = service->encode_list_service_response();
77 }
78 
79 #ifdef USE_ESP32_CAMERA
81  this->client_->send_camera_info(camera);
82  return true;
83 }
84 #endif
85 
86 #ifdef USE_CLIMATE
88  this->client_->send_climate_info(climate);
89  return true;
90 }
91 #endif
92 
93 #ifdef USE_NUMBER
95  this->client_->send_number_info(number);
96  return true;
97 }
98 #endif
99 
100 #ifdef USE_DATETIME_DATE
102  this->client_->send_date_info(date);
103  return true;
104 }
105 #endif
106 
107 #ifdef USE_DATETIME_TIME
109  this->client_->send_time_info(time);
110  return true;
111 }
112 #endif
113 
114 #ifdef USE_DATETIME_DATETIME
116  this->client_->send_datetime_info(datetime);
117  return true;
118 }
119 #endif
120 
121 #ifdef USE_TEXT
123  this->client_->send_text_info(text);
124  return true;
125 }
126 #endif
127 
128 #ifdef USE_SELECT
130  this->client_->send_select_info(select);
131  return true;
132 }
133 #endif
134 
135 #ifdef USE_MEDIA_PLAYER
137  this->client_->send_media_player_info(media_player);
138  return true;
139 }
140 #endif
141 #ifdef USE_ALARM_CONTROL_PANEL
143  this->client_->send_alarm_control_panel_info(a_alarm_control_panel);
144  return true;
145 }
146 #endif
147 #ifdef USE_EVENT
149  this->client_->send_event_info(event);
150  return true;
151 }
152 #endif
153 #ifdef USE_UPDATE
155  this->client_->send_update_info(update);
156  return true;
157 }
158 #endif
159 
160 } // namespace api
161 } // namespace esphome
162 #endif
bool on_date(datetime::DateEntity *date) override
Base class for all switches.
Definition: switch.h:39
bool on_cover(cover::Cover *cover) override
bool on_fan(fan::Fan *fan) override
void send_fan_info(fan::Fan *fan)
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition: light_state.h:63
Base class for all cover devices.
Definition: cover.h:111
void send_valve_info(valve::Valve *valve)
bool on_update(update::UpdateEntity *update) override
bool on_text_sensor(text_sensor::TextSensor *text_sensor) override
bool on_number(number::Number *number) override
Base class for all buttons.
Definition: button.h:29
bool on_alarm_control_panel(alarm_control_panel::AlarmControlPanel *a_alarm_control_panel) override
bool on_datetime(datetime::DateTimeEntity *datetime) override
void send_alarm_control_panel_info(alarm_control_panel::AlarmControlPanel *a_alarm_control_panel)
bool on_camera(esp32_camera::ESP32Camera *camera) override
void send_update_info(update::UpdateEntity *update)
bool on_binary_sensor(binary_sensor::BinarySensor *binary_sensor) override
bool on_valve(valve::Valve *valve) override
bool on_event(event::Event *event) override
void send_event_info(event::Event *event)
bool on_time(datetime::TimeEntity *time) override
void send_lock_info(lock::Lock *a_lock)
Base-class for all text inputs.
Definition: text.h:24
void send_switch_info(switch_::Switch *a_switch)
void send_text_info(text::Text *text)
void send_climate_info(climate::Climate *climate)
bool on_media_player(media_player::MediaPlayer *media_player) override
bool send_list_entities_services_response(const ListEntitiesServicesResponse &msg)
bool on_light(light::LightState *light) override
void send_button_info(button::Button *button)
void send_binary_sensor_info(binary_sensor::BinarySensor *binary_sensor)
void send_light_info(light::LightState *light)
void send_time_info(datetime::TimeEntity *time)
Base-class for all numbers.
Definition: number.h:39
bool on_switch(switch_::Switch *a_switch) override
void send_media_player_info(media_player::MediaPlayer *media_player)
bool on_button(button::Button *button) override
bool on_sensor(sensor::Sensor *sensor) override
ListEntitiesIterator(APIConnection *client)
void send_camera_info(esp32_camera::ESP32Camera *camera)
esphome::binary_sensor::BinarySensor * binary_sensor
Definition: statsd.h:41
virtual ListEntitiesServicesResponse encode_list_service_response()=0
bool on_text(text::Text *text) override
void send_text_sensor_info(text_sensor::TextSensor *text_sensor)
void send_date_info(datetime::DateEntity *date)
bool on_select(select::Select *select) override
void send_select_info(select::Select *select)
bool on_service(UserServiceDescriptor *service) override
void send_datetime_info(datetime::DateTimeEntity *datetime)
void send_number_info(number::Number *number)
Base-class for all selects.
Definition: select.h:31
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base class for all valve devices.
Definition: valve.h:105
bool on_lock(lock::Lock *a_lock) override
Base class for all binary_sensor-type classes.
Definition: binary_sensor.h:37
Base-class for all sensors.
Definition: sensor.h:57
esphome::sensor::Sensor * sensor
Definition: statsd.h:38
void send_cover_info(cover::Cover *cover)
bool on_climate(climate::Climate *climate) override
void send_sensor_info(sensor::Sensor *sensor)
Base class for all locks.
Definition: lock.h:103
ClimateDevice - This is the base class for all climate integrations.
Definition: climate.h:168