ESPHome 2026.1.4
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_ which dispatches to 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, ResponseType::MESSAGE_TYPE, ResponseType::ESTIMATED_SIZE); \
16 }
17
19 public:
21#ifdef USE_BINARY_SENSOR
23#endif
24#ifdef USE_COVER
25 bool on_cover(cover::Cover *entity) override;
26#endif
27#ifdef USE_FAN
28 bool on_fan(fan::Fan *entity) override;
29#endif
30#ifdef USE_LIGHT
31 bool on_light(light::LightState *entity) override;
32#endif
33#ifdef USE_SENSOR
34 bool on_sensor(sensor::Sensor *entity) override;
35#endif
36#ifdef USE_SWITCH
37 bool on_switch(switch_::Switch *entity) override;
38#endif
39#ifdef USE_BUTTON
40 bool on_button(button::Button *entity) override;
41#endif
42#ifdef USE_TEXT_SENSOR
44#endif
45#ifdef USE_API_USER_DEFINED_ACTIONS
46 bool on_service(UserServiceDescriptor *service) override;
47#endif
48#ifdef USE_CAMERA
49 bool on_camera(camera::Camera *entity) override;
50#endif
51#ifdef USE_CLIMATE
52 bool on_climate(climate::Climate *entity) override;
53#endif
54#ifdef USE_NUMBER
55 bool on_number(number::Number *entity) override;
56#endif
57#ifdef USE_DATETIME_DATE
58 bool on_date(datetime::DateEntity *entity) override;
59#endif
60#ifdef USE_DATETIME_TIME
61 bool on_time(datetime::TimeEntity *entity) override;
62#endif
63#ifdef USE_DATETIME_DATETIME
64 bool on_datetime(datetime::DateTimeEntity *entity) override;
65#endif
66#ifdef USE_TEXT
67 bool on_text(text::Text *entity) override;
68#endif
69#ifdef USE_SELECT
70 bool on_select(select::Select *entity) override;
71#endif
72#ifdef USE_LOCK
73 bool on_lock(lock::Lock *entity) override;
74#endif
75#ifdef USE_VALVE
76 bool on_valve(valve::Valve *entity) override;
77#endif
78#ifdef USE_MEDIA_PLAYER
80#endif
81#ifdef USE_ALARM_CONTROL_PANEL
83#endif
84#ifdef USE_WATER_HEATER
86#endif
87#ifdef USE_INFRARED
88 bool on_infrared(infrared::Infrared *entity) override;
89#endif
90#ifdef USE_EVENT
91 bool on_event(event::Event *entity) override;
92#endif
93#ifdef USE_UPDATE
94 bool on_update(update::UpdateEntity *entity) override;
95#endif
96 bool on_end() override;
97 bool completed() { return this->state_ == IteratorState::NONE; }
98
99 protected:
101};
102
103} // namespace esphome::api
104#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_water_heater(water_heater::WaterHeater *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
bool on_infrared(infrared::Infrared *entity) override
Base class for all binary_sensor-type classes.
Base class for all buttons.
Definition button.h:25
Abstract camera base class.
Definition camera.h:115
ClimateDevice - This is the base class for all climate integrations.
Definition climate.h:182
Base class for all cover devices.
Definition cover.h:112
Infrared - Base class for infrared remote control implementations.
Definition infrared.h:85
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition light_state.h:91
Base class for all locks.
Definition lock.h:111
Base-class for all numbers.
Definition number.h:29
Base-class for all selects.
Definition select.h:31
Base-class for all sensors.
Definition sensor.h:42
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:106