ESPHome 2025.8.0b1
Loading...
Searching...
No Matches
list_entities.h
Go to the documentation of this file.
1#pragma once
2
4#ifdef USE_API
7namespace esphome::api {
8
9class APIConnection;
10
11// Macro for generating ListEntitiesIterator handlers
12// Calls schedule_message_ with try_send_*_info
13#define LIST_ENTITIES_HANDLER(entity_type, EntityClass, ResponseType) \
14 bool ListEntitiesIterator::on_##entity_type(EntityClass *entity) { /* NOLINT(bugprone-macro-parentheses) */ \
15 return this->client_->schedule_message_(entity, &APIConnection::try_send_##entity_type##_info, \
16 ResponseType::MESSAGE_TYPE, ResponseType::ESTIMATED_SIZE); \
17 }
18
20 public:
22#ifdef USE_BINARY_SENSOR
24#endif
25#ifdef USE_COVER
26 bool on_cover(cover::Cover *entity) override;
27#endif
28#ifdef USE_FAN
29 bool on_fan(fan::Fan *entity) override;
30#endif
31#ifdef USE_LIGHT
32 bool on_light(light::LightState *entity) override;
33#endif
34#ifdef USE_SENSOR
35 bool on_sensor(sensor::Sensor *entity) override;
36#endif
37#ifdef USE_SWITCH
38 bool on_switch(switch_::Switch *entity) override;
39#endif
40#ifdef USE_BUTTON
41 bool on_button(button::Button *entity) override;
42#endif
43#ifdef USE_TEXT_SENSOR
45#endif
46#ifdef USE_API_SERVICES
47 bool on_service(UserServiceDescriptor *service) override;
48#endif
49#ifdef USE_CAMERA
50 bool on_camera(camera::Camera *entity) override;
51#endif
52#ifdef USE_CLIMATE
53 bool on_climate(climate::Climate *entity) override;
54#endif
55#ifdef USE_NUMBER
56 bool on_number(number::Number *entity) override;
57#endif
58#ifdef USE_DATETIME_DATE
59 bool on_date(datetime::DateEntity *entity) override;
60#endif
61#ifdef USE_DATETIME_TIME
62 bool on_time(datetime::TimeEntity *entity) override;
63#endif
64#ifdef USE_DATETIME_DATETIME
65 bool on_datetime(datetime::DateTimeEntity *entity) override;
66#endif
67#ifdef USE_TEXT
68 bool on_text(text::Text *entity) override;
69#endif
70#ifdef USE_SELECT
71 bool on_select(select::Select *entity) override;
72#endif
73#ifdef USE_LOCK
74 bool on_lock(lock::Lock *entity) override;
75#endif
76#ifdef USE_VALVE
77 bool on_valve(valve::Valve *entity) override;
78#endif
79#ifdef USE_MEDIA_PLAYER
81#endif
82#ifdef USE_ALARM_CONTROL_PANEL
84#endif
85#ifdef USE_EVENT
86 bool on_event(event::Event *entity) override;
87#endif
88#ifdef USE_UPDATE
89 bool on_update(update::UpdateEntity *entity) override;
90#endif
91 bool on_end() override;
92 bool completed() { return this->state_ == IteratorState::NONE; }
93
94 protected:
96};
97
98} // namespace esphome::api
99#endif
bool on_time(datetime::TimeEntity *entity) override
bool on_select(select::Select *entity) override
ListEntitiesIterator(APIConnection *client)
bool on_fan(fan::Fan *entity) override
bool on_binary_sensor(binary_sensor::BinarySensor *entity) override
bool on_button(button::Button *entity) override
bool on_event(event::Event *entity) override
bool on_date(datetime::DateEntity *entity) override
bool on_alarm_control_panel(alarm_control_panel::AlarmControlPanel *entity) override
bool on_climate(climate::Climate *entity) override
bool on_camera(camera::Camera *entity) override
bool on_datetime(datetime::DateTimeEntity *entity) override
bool on_cover(cover::Cover *entity) override
bool on_text_sensor(text_sensor::TextSensor *entity) override
bool on_service(UserServiceDescriptor *service) override
bool on_update(update::UpdateEntity *entity) override
bool on_light(light::LightState *entity) override
bool on_sensor(sensor::Sensor *entity) override
bool on_media_player(media_player::MediaPlayer *entity) override
bool on_number(number::Number *entity) override
bool on_valve(valve::Valve *entity) override
bool on_text(text::Text *entity) override
bool on_switch(switch_::Switch *entity) override
bool on_lock(lock::Lock *entity) override
Base class for all binary_sensor-type classes.
Base class for all buttons.
Definition button.h:29
Abstract camera base class.
Definition camera.h:57
ClimateDevice - This is the base class for all climate integrations.
Definition climate.h:168
Base class for all cover devices.
Definition cover.h:111
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition light_state.h:66
Base class for all locks.
Definition lock.h:103
Base-class for all numbers.
Definition number.h:39
Base-class for all selects.
Definition select.h:31
Base-class for all sensors.
Definition sensor.h:59
Base class for all switches.
Definition switch.h:39
Base-class for all text inputs.
Definition text.h:24
Base class for all valve devices.
Definition valve.h:105