ESPHome
2026.1.0-dev
Loading...
Searching...
No Matches
esphome
components
api
list_entities.cpp
Go to the documentation of this file.
1
#include "
list_entities.h
"
2
#ifdef USE_API
3
#include "
api_connection.h
"
4
#include "
api_pb2.h
"
5
#include "
esphome/core/application.h
"
6
#include "
esphome/core/log.h
"
7
#include "
esphome/core/util.h
"
8
#ifdef USE_API_USER_DEFINED_ACTIONS
9
#include "
user_services.h
"
10
#endif
11
12
namespace
esphome::api
{
13
14
// Generate entity handler implementations using macros
15
#ifdef USE_BINARY_SENSOR
16
LIST_ENTITIES_HANDLER
(binary_sensor,
binary_sensor::BinarySensor
,
ListEntitiesBinarySensorResponse
)
17
#endif
18
#ifdef USE_COVER
19
LIST_ENTITIES_HANDLER
(cover,
cover::Cover
,
ListEntitiesCoverResponse
)
20
#endif
21
#ifdef USE_FAN
22
LIST_ENTITIES_HANDLER
(fan,
fan::Fan
,
ListEntitiesFanResponse
)
23
#endif
24
#ifdef USE_LIGHT
25
LIST_ENTITIES_HANDLER
(light,
light::LightState
,
ListEntitiesLightResponse
)
26
#endif
27
#ifdef USE_SENSOR
28
LIST_ENTITIES_HANDLER
(sensor,
sensor::Sensor
,
ListEntitiesSensorResponse
)
29
#endif
30
#ifdef USE_SWITCH
31
LIST_ENTITIES_HANDLER
(
switch
,
switch_::Switch
,
ListEntitiesSwitchResponse
)
32
#endif
33
#ifdef USE_BUTTON
34
LIST_ENTITIES_HANDLER
(button,
button::Button
,
ListEntitiesButtonResponse
)
35
#endif
36
#ifdef USE_TEXT_SENSOR
37
LIST_ENTITIES_HANDLER
(text_sensor,
text_sensor::TextSensor
,
ListEntitiesTextSensorResponse
)
38
#endif
39
#ifdef USE_LOCK
40
LIST_ENTITIES_HANDLER
(lock,
lock::Lock
,
ListEntitiesLockResponse
)
41
#endif
42
#ifdef USE_VALVE
43
LIST_ENTITIES_HANDLER
(valve,
valve::Valve
,
ListEntitiesValveResponse
)
44
#endif
45
#ifdef USE_CAMERA
46
LIST_ENTITIES_HANDLER
(camera,
camera::Camera
,
ListEntitiesCameraResponse
)
47
#endif
48
#ifdef USE_CLIMATE
49
LIST_ENTITIES_HANDLER
(climate,
climate::Climate
,
ListEntitiesClimateResponse
)
50
#endif
51
#ifdef USE_NUMBER
52
LIST_ENTITIES_HANDLER
(number,
number::Number
,
ListEntitiesNumberResponse
)
53
#endif
54
#ifdef USE_DATETIME_DATE
55
LIST_ENTITIES_HANDLER
(date,
datetime::DateEntity
,
ListEntitiesDateResponse
)
56
#endif
57
#ifdef USE_DATETIME_TIME
58
LIST_ENTITIES_HANDLER
(time,
datetime::TimeEntity
,
ListEntitiesTimeResponse
)
59
#endif
60
#ifdef USE_DATETIME_DATETIME
61
LIST_ENTITIES_HANDLER
(datetime,
datetime::DateTimeEntity
,
ListEntitiesDateTimeResponse
)
62
#endif
63
#ifdef USE_TEXT
64
LIST_ENTITIES_HANDLER
(text,
text::Text
,
ListEntitiesTextResponse
)
65
#endif
66
#ifdef USE_SELECT
67
LIST_ENTITIES_HANDLER
(select,
select::Select
,
ListEntitiesSelectResponse
)
68
#endif
69
#ifdef USE_MEDIA_PLAYER
70
LIST_ENTITIES_HANDLER
(media_player,
media_player::MediaPlayer
,
ListEntitiesMediaPlayerResponse
)
71
#endif
72
#ifdef USE_ALARM_CONTROL_PANEL
73
LIST_ENTITIES_HANDLER
(alarm_control_panel,
alarm_control_panel::AlarmControlPanel
,
74
ListEntitiesAlarmControlPanelResponse
)
75
#endif
76
#ifdef USE_WATER_HEATER
77
LIST_ENTITIES_HANDLER
(water_heater,
water_heater::WaterHeater
,
ListEntitiesWaterHeaterResponse
)
78
#endif
79
#ifdef USE_EVENT
80
LIST_ENTITIES_HANDLER
(event,
event::Event
,
ListEntitiesEventResponse
)
81
#endif
82
#ifdef USE_UPDATE
83
LIST_ENTITIES_HANDLER
(update,
update::UpdateEntity
,
ListEntitiesUpdateResponse
)
84
#endif
85
86
// Special cases that don't follow the pattern
87
bool
ListEntitiesIterator::on_end
() {
return
this->
client_
->
send_list_info_done
(); }
88
89
ListEntitiesIterator::ListEntitiesIterator
(
APIConnection
*client) : client_(client) {}
90
91
#ifdef USE_API_USER_DEFINED_ACTIONS
92
bool
ListEntitiesIterator::on_service
(
UserServiceDescriptor
*service) {
93
auto
resp = service->
encode_list_service_response
();
94
return
this->
client_
->
send_message
(resp,
ListEntitiesServicesResponse::MESSAGE_TYPE
);
95
}
96
#endif
97
98
}
// namespace esphome::api
99
#endif
list_entities.h
api_connection.h
api_pb2.h
application.h
esphome::alarm_control_panel::AlarmControlPanel
Definition
alarm_control_panel.h:22
esphome::api::APIConnection
Definition
api_connection.h:39
esphome::api::APIConnection::send_list_info_done
bool send_list_info_done()
Definition
api_connection.h:49
esphome::api::APIServerConnectionBase::send_message
bool send_message(const ProtoMessage &msg, uint8_t message_type)
Definition
api_pb2_service.h:20
esphome::api::ListEntitiesAlarmControlPanelResponse
Definition
api_pb2.h:2695
esphome::api::ListEntitiesBinarySensorResponse
Definition
api_pb2.h:645
esphome::api::ListEntitiesButtonResponse
Definition
api_pb2.h:1832
esphome::api::ListEntitiesCameraResponse
Definition
api_pb2.h:1381
esphome::api::ListEntitiesClimateResponse
Definition
api_pb2.h:1436
esphome::api::ListEntitiesCoverResponse
Definition
api_pb2.h:682
esphome::api::ListEntitiesDateResponse
Definition
api_pb2.h:2806
esphome::api::ListEntitiesDateTimeResponse
Definition
api_pb2.h:3008
esphome::api::ListEntitiesEventResponse
Definition
api_pb2.h:2914
esphome::api::ListEntitiesFanResponse
Definition
api_pb2.h:743
esphome::api::ListEntitiesIterator::ListEntitiesIterator
ListEntitiesIterator(APIConnection *client)
Definition
list_entities.cpp:89
esphome::api::ListEntitiesIterator::on_service
bool on_service(UserServiceDescriptor *service) override
Definition
list_entities.cpp:92
esphome::api::ListEntitiesIterator::client_
APIConnection * client_
Definition
list_entities.h:98
esphome::api::ListEntitiesIterator::on_end
bool on_end() override
esphome::api::ListEntitiesLightResponse
Definition
api_pb2.h:813
esphome::api::ListEntitiesLockResponse
Definition
api_pb2.h:1775
esphome::api::ListEntitiesMediaPlayerResponse
Definition
api_pb2.h:1882
esphome::api::ListEntitiesNumberResponse
Definition
api_pb2.h:1603
esphome::api::ListEntitiesSelectResponse
Definition
api_pb2.h:1661
esphome::api::ListEntitiesSensorResponse
Definition
api_pb2.h:905
esphome::api::ListEntitiesServicesResponse::MESSAGE_TYPE
static constexpr uint8_t MESSAGE_TYPE
Definition
api_pb2.h:1290
esphome::api::ListEntitiesSwitchResponse
Definition
api_pb2.h:946
esphome::api::ListEntitiesTextResponse
Definition
api_pb2.h:2749
esphome::api::ListEntitiesTextSensorResponse
Definition
api_pb2.h:998
esphome::api::ListEntitiesTimeResponse
Definition
api_pb2.h:2860
esphome::api::ListEntitiesUpdateResponse
Definition
api_pb2.h:3058
esphome::api::ListEntitiesValveResponse
Definition
api_pb2.h:2951
esphome::api::ListEntitiesWaterHeaterResponse
Definition
api_pb2.h:1539
esphome::api::UserServiceDescriptor
Definition
user_services.h:20
esphome::api::UserServiceDescriptor::encode_list_service_response
virtual ListEntitiesServicesResponse encode_list_service_response()=0
esphome::binary_sensor::BinarySensor
Base class for all binary_sensor-type classes.
Definition
binary_sensor.h:31
esphome::button::Button
Base class for all buttons.
Definition
button.h:25
esphome::camera::Camera
Abstract camera base class.
Definition
camera.h:115
esphome::climate::Climate
ClimateDevice - This is the base class for all climate integrations.
Definition
climate.h:181
esphome::cover::Cover
Base class for all cover devices.
Definition
cover.h:112
esphome::datetime::DateEntity
Definition
date_entity.h:35
esphome::datetime::DateTimeEntity
Definition
datetime_entity.h:38
esphome::datetime::TimeEntity
Definition
time_entity.h:36
esphome::event::Event
Definition
event.h:25
esphome::fan::Fan
Definition
fan.h:105
esphome::light::LightState
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition
light_state.h:91
esphome::lock::Lock
Base class for all locks.
Definition
lock.h:111
esphome::media_player::MediaPlayer
Definition
media_player.h:140
esphome::number::Number
Base-class for all numbers.
Definition
number.h:29
esphome::select::Select
Base-class for all selects.
Definition
select.h:30
esphome::sensor::Sensor
Base-class for all sensors.
Definition
sensor.h:43
esphome::switch_::Switch
Base class for all switches.
Definition
switch.h:39
esphome::text::Text
Base-class for all text inputs.
Definition
text.h:24
esphome::text_sensor::TextSensor
Definition
text_sensor.h:25
esphome::update::UpdateEntity
Definition
update_entity.h:30
esphome::valve::Valve
Base class for all valve devices.
Definition
valve.h:106
esphome::water_heater::WaterHeater
Definition
water_heater.h:180
util.h
log.h
esphome::api
Definition
api_connection.cpp:50
esphome::api::LIST_ENTITIES_HANDLER
LIST_ENTITIES_HANDLER(binary_sensor, binary_sensor::BinarySensor, ListEntitiesBinarySensorResponse) LIST_ENTITIES_HANDLER(cover
user_services.h
Generated by
1.12.0