ESPHome
2025.9.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
9
namespace
esphome::api
{
10
11
// Generate entity handler implementations using macros
12
#ifdef USE_BINARY_SENSOR
13
LIST_ENTITIES_HANDLER
(binary_sensor,
binary_sensor::BinarySensor
,
ListEntitiesBinarySensorResponse
)
14
#endif
15
#ifdef USE_COVER
16
LIST_ENTITIES_HANDLER
(cover,
cover::Cover
,
ListEntitiesCoverResponse
)
17
#endif
18
#ifdef USE_FAN
19
LIST_ENTITIES_HANDLER
(fan,
fan::Fan
,
ListEntitiesFanResponse
)
20
#endif
21
#ifdef USE_LIGHT
22
LIST_ENTITIES_HANDLER
(light,
light::LightState
,
ListEntitiesLightResponse
)
23
#endif
24
#ifdef USE_SENSOR
25
LIST_ENTITIES_HANDLER
(sensor,
sensor::Sensor
,
ListEntitiesSensorResponse
)
26
#endif
27
#ifdef USE_SWITCH
28
LIST_ENTITIES_HANDLER
(
switch
,
switch_::Switch
,
ListEntitiesSwitchResponse
)
29
#endif
30
#ifdef USE_BUTTON
31
LIST_ENTITIES_HANDLER
(button,
button::Button
,
ListEntitiesButtonResponse
)
32
#endif
33
#ifdef USE_TEXT_SENSOR
34
LIST_ENTITIES_HANDLER
(text_sensor,
text_sensor::TextSensor
,
ListEntitiesTextSensorResponse
)
35
#endif
36
#ifdef USE_LOCK
37
LIST_ENTITIES_HANDLER
(lock,
lock::Lock
,
ListEntitiesLockResponse
)
38
#endif
39
#ifdef USE_VALVE
40
LIST_ENTITIES_HANDLER
(valve,
valve::Valve
,
ListEntitiesValveResponse
)
41
#endif
42
#ifdef USE_CAMERA
43
LIST_ENTITIES_HANDLER
(camera,
camera::Camera
,
ListEntitiesCameraResponse
)
44
#endif
45
#ifdef USE_CLIMATE
46
LIST_ENTITIES_HANDLER
(climate,
climate::Climate
,
ListEntitiesClimateResponse
)
47
#endif
48
#ifdef USE_NUMBER
49
LIST_ENTITIES_HANDLER
(number,
number::Number
,
ListEntitiesNumberResponse
)
50
#endif
51
#ifdef USE_DATETIME_DATE
52
LIST_ENTITIES_HANDLER
(date,
datetime::DateEntity
,
ListEntitiesDateResponse
)
53
#endif
54
#ifdef USE_DATETIME_TIME
55
LIST_ENTITIES_HANDLER
(time,
datetime::TimeEntity
,
ListEntitiesTimeResponse
)
56
#endif
57
#ifdef USE_DATETIME_DATETIME
58
LIST_ENTITIES_HANDLER
(datetime,
datetime::DateTimeEntity
,
ListEntitiesDateTimeResponse
)
59
#endif
60
#ifdef USE_TEXT
61
LIST_ENTITIES_HANDLER
(text,
text::Text
,
ListEntitiesTextResponse
)
62
#endif
63
#ifdef USE_SELECT
64
LIST_ENTITIES_HANDLER
(select,
select::Select
,
ListEntitiesSelectResponse
)
65
#endif
66
#ifdef USE_MEDIA_PLAYER
67
LIST_ENTITIES_HANDLER
(media_player,
media_player::MediaPlayer
,
ListEntitiesMediaPlayerResponse
)
68
#endif
69
#ifdef USE_ALARM_CONTROL_PANEL
70
LIST_ENTITIES_HANDLER
(alarm_control_panel,
alarm_control_panel::AlarmControlPanel
,
71
ListEntitiesAlarmControlPanelResponse
)
72
#endif
73
#ifdef USE_EVENT
74
LIST_ENTITIES_HANDLER
(event,
event::Event
,
ListEntitiesEventResponse
)
75
#endif
76
#ifdef USE_UPDATE
77
LIST_ENTITIES_HANDLER
(update,
update::UpdateEntity
,
ListEntitiesUpdateResponse
)
78
#endif
79
80
// Special cases that don't follow the pattern
81
bool
ListEntitiesIterator::on_end
() {
return
this->
client_
->
send_list_info_done
(); }
82
83
ListEntitiesIterator::ListEntitiesIterator
(
APIConnection
*client) : client_(client) {}
84
85
#ifdef USE_API_SERVICES
86
bool
ListEntitiesIterator::on_service
(
UserServiceDescriptor
*service) {
87
auto
resp = service->
encode_list_service_response
();
88
return
this->
client_
->
send_message
(resp,
ListEntitiesServicesResponse::MESSAGE_TYPE
);
89
}
90
#endif
91
92
}
// namespace esphome::api
93
#endif
list_entities.h
api_connection.h
api_pb2.h
application.h
esphome::alarm_control_panel::AlarmControlPanel
Definition
alarm_control_panel.h:25
esphome::api::APIConnection
Definition
api_connection.h:47
esphome::api::APIConnection::send_list_info_done
bool send_list_info_done()
Definition
api_connection.h:57
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:2487
esphome::api::ListEntitiesBinarySensorResponse
Definition
api_pb2.h:602
esphome::api::ListEntitiesButtonResponse
Definition
api_pb2.h:1646
esphome::api::ListEntitiesCameraResponse
Definition
api_pb2.h:1263
esphome::api::ListEntitiesClimateResponse
Definition
api_pb2.h:1318
esphome::api::ListEntitiesCoverResponse
Definition
api_pb2.h:639
esphome::api::ListEntitiesDateResponse
Definition
api_pb2.h:2598
esphome::api::ListEntitiesDateTimeResponse
Definition
api_pb2.h:2800
esphome::api::ListEntitiesEventResponse
Definition
api_pb2.h:2706
esphome::api::ListEntitiesFanResponse
Definition
api_pb2.h:700
esphome::api::ListEntitiesIterator::ListEntitiesIterator
ListEntitiesIterator(APIConnection *client)
Definition
list_entities.cpp:83
esphome::api::ListEntitiesIterator::on_end
bool on_end() override
Definition
list_entities.cpp:81
esphome::api::ListEntitiesIterator::on_service
bool on_service(UserServiceDescriptor *service) override
Definition
list_entities.cpp:86
esphome::api::ListEntitiesIterator::client_
APIConnection * client_
Definition
list_entities.h:95
esphome::api::ListEntitiesLightResponse
Definition
api_pb2.h:769
esphome::api::ListEntitiesLockResponse
Definition
api_pb2.h:1589
esphome::api::ListEntitiesMediaPlayerResponse
Definition
api_pb2.h:1696
esphome::api::ListEntitiesNumberResponse
Definition
api_pb2.h:1418
esphome::api::ListEntitiesSelectResponse
Definition
api_pb2.h:1476
esphome::api::ListEntitiesSensorResponse
Definition
api_pb2.h:860
esphome::api::ListEntitiesServicesResponse::MESSAGE_TYPE
static constexpr uint8_t MESSAGE_TYPE
Definition
api_pb2.h:1207
esphome::api::ListEntitiesSwitchResponse
Definition
api_pb2.h:901
esphome::api::ListEntitiesTextResponse
Definition
api_pb2.h:2541
esphome::api::ListEntitiesTextSensorResponse
Definition
api_pb2.h:953
esphome::api::ListEntitiesTimeResponse
Definition
api_pb2.h:2652
esphome::api::ListEntitiesUpdateResponse
Definition
api_pb2.h:2850
esphome::api::ListEntitiesValveResponse
Definition
api_pb2.h:2743
esphome::api::UserServiceDescriptor
Definition
user_services.h:13
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:36
esphome::button::Button
Base class for all buttons.
Definition
button.h:29
esphome::camera::Camera
Abstract camera base class.
Definition
camera.h:57
esphome::climate::Climate
ClimateDevice - This is the base class for all climate integrations.
Definition
climate.h:168
esphome::cover::Cover
Base class for all cover devices.
Definition
cover.h:111
esphome::datetime::DateEntity
Definition
date_entity.h:36
esphome::datetime::DateTimeEntity
Definition
datetime_entity.h:39
esphome::datetime::TimeEntity
Definition
time_entity.h:37
esphome::event::Event
Definition
event.h:24
esphome::fan::Fan
Definition
fan.h:107
esphome::light::LightState
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition
light_state.h:66
esphome::lock::Lock
Base class for all locks.
Definition
lock.h:103
esphome::media_player::MediaPlayer
Definition
media_player.h:140
esphome::number::Number
Base-class for all numbers.
Definition
number.h:39
esphome::select::Select
Base-class for all selects.
Definition
select.h:31
esphome::sensor::Sensor
Base-class for all sensors.
Definition
sensor.h:59
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:32
esphome::update::UpdateEntity
Definition
update_entity.h:30
esphome::valve::Valve
Base class for all valve devices.
Definition
valve.h:105
util.h
log.h
esphome::api
Definition
api_connection.cpp:34
esphome::api::LIST_ENTITIES_HANDLER
LIST_ENTITIES_HANDLER(binary_sensor, binary_sensor::BinarySensor, ListEntitiesBinarySensorResponse) LIST_ENTITIES_HANDLER(cover
Generated by
1.12.0