ESPHome
2025.7.1
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
{
10
namespace
api {
11
12
// Generate entity handler implementations using macros
13
#ifdef USE_BINARY_SENSOR
14
LIST_ENTITIES_HANDLER
(binary_sensor,
binary_sensor::BinarySensor
,
ListEntitiesBinarySensorResponse
)
15
#endif
16
#ifdef USE_COVER
17
LIST_ENTITIES_HANDLER
(cover,
cover::Cover
,
ListEntitiesCoverResponse
)
18
#endif
19
#ifdef USE_FAN
20
LIST_ENTITIES_HANDLER
(fan,
fan::Fan
,
ListEntitiesFanResponse
)
21
#endif
22
#ifdef USE_LIGHT
23
LIST_ENTITIES_HANDLER
(light,
light::LightState
,
ListEntitiesLightResponse
)
24
#endif
25
#ifdef USE_SENSOR
26
LIST_ENTITIES_HANDLER
(sensor,
sensor::Sensor
,
ListEntitiesSensorResponse
)
27
#endif
28
#ifdef USE_SWITCH
29
LIST_ENTITIES_HANDLER
(
switch
,
switch_::Switch
,
ListEntitiesSwitchResponse
)
30
#endif
31
#ifdef USE_BUTTON
32
LIST_ENTITIES_HANDLER
(button,
button::Button
,
ListEntitiesButtonResponse
)
33
#endif
34
#ifdef USE_TEXT_SENSOR
35
LIST_ENTITIES_HANDLER
(text_sensor,
text_sensor::TextSensor
,
ListEntitiesTextSensorResponse
)
36
#endif
37
#ifdef USE_LOCK
38
LIST_ENTITIES_HANDLER
(lock,
lock::Lock
,
ListEntitiesLockResponse
)
39
#endif
40
#ifdef USE_VALVE
41
LIST_ENTITIES_HANDLER
(valve,
valve::Valve
,
ListEntitiesValveResponse
)
42
#endif
43
#ifdef USE_CAMERA
44
LIST_ENTITIES_HANDLER
(camera,
camera::Camera
,
ListEntitiesCameraResponse
)
45
#endif
46
#ifdef USE_CLIMATE
47
LIST_ENTITIES_HANDLER
(climate,
climate::Climate
,
ListEntitiesClimateResponse
)
48
#endif
49
#ifdef USE_NUMBER
50
LIST_ENTITIES_HANDLER
(number,
number::Number
,
ListEntitiesNumberResponse
)
51
#endif
52
#ifdef USE_DATETIME_DATE
53
LIST_ENTITIES_HANDLER
(date,
datetime::DateEntity
,
ListEntitiesDateResponse
)
54
#endif
55
#ifdef USE_DATETIME_TIME
56
LIST_ENTITIES_HANDLER
(time,
datetime::TimeEntity
,
ListEntitiesTimeResponse
)
57
#endif
58
#ifdef USE_DATETIME_DATETIME
59
LIST_ENTITIES_HANDLER
(datetime,
datetime::DateTimeEntity
,
ListEntitiesDateTimeResponse
)
60
#endif
61
#ifdef USE_TEXT
62
LIST_ENTITIES_HANDLER
(text,
text::Text
,
ListEntitiesTextResponse
)
63
#endif
64
#ifdef USE_SELECT
65
LIST_ENTITIES_HANDLER
(select,
select::Select
,
ListEntitiesSelectResponse
)
66
#endif
67
#ifdef USE_MEDIA_PLAYER
68
LIST_ENTITIES_HANDLER
(media_player,
media_player::MediaPlayer
,
ListEntitiesMediaPlayerResponse
)
69
#endif
70
#ifdef USE_ALARM_CONTROL_PANEL
71
LIST_ENTITIES_HANDLER
(alarm_control_panel,
alarm_control_panel::AlarmControlPanel
,
72
ListEntitiesAlarmControlPanelResponse
)
73
#endif
74
#ifdef USE_EVENT
75
LIST_ENTITIES_HANDLER
(event,
event::Event
,
ListEntitiesEventResponse
)
76
#endif
77
#ifdef USE_UPDATE
78
LIST_ENTITIES_HANDLER
(update,
update::UpdateEntity
,
ListEntitiesUpdateResponse
)
79
#endif
80
81
// Special cases that don't follow the pattern
82
bool
ListEntitiesIterator::on_end
() {
return
this->
client_
->
send_list_info_done
(); }
83
84
ListEntitiesIterator::ListEntitiesIterator
(
APIConnection
*client) : client_(client) {}
85
86
#ifdef USE_API_SERVICES
87
bool
ListEntitiesIterator::on_service
(
UserServiceDescriptor
*service) {
88
auto
resp = service->
encode_list_service_response
();
89
return
this->
client_
->
send_message
(resp);
90
}
91
#endif
92
93
}
// namespace api
94
}
// namespace esphome
95
#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:24
esphome::api::APIConnection::send_list_info_done
bool send_list_info_done()
Definition
api_connection.h:34
esphome::api::APIServerConnectionBase::send_message
bool send_message(const T &msg)
Definition
api_pb2_service.h:21
esphome::api::ListEntitiesAlarmControlPanelResponse
Definition
api_pb2.h:2453
esphome::api::ListEntitiesBinarySensorResponse
Definition
api_pb2.h:559
esphome::api::ListEntitiesButtonResponse
Definition
api_pb2.h:1589
esphome::api::ListEntitiesCameraResponse
Definition
api_pb2.h:1213
esphome::api::ListEntitiesClimateResponse
Definition
api_pb2.h:1263
esphome::api::ListEntitiesCoverResponse
Definition
api_pb2.h:595
esphome::api::ListEntitiesDateResponse
Definition
api_pb2.h:2562
esphome::api::ListEntitiesDateTimeResponse
Definition
api_pb2.h:2761
esphome::api::ListEntitiesEventResponse
Definition
api_pb2.h:2670
esphome::api::ListEntitiesFanResponse
Definition
api_pb2.h:658
esphome::api::ListEntitiesIterator::ListEntitiesIterator
ListEntitiesIterator(APIConnection *client)
Definition
list_entities.cpp:84
esphome::api::ListEntitiesIterator::on_end
bool on_end() override
Definition
list_entities.cpp:82
esphome::api::ListEntitiesIterator::on_service
bool on_service(UserServiceDescriptor *service) override
Definition
list_entities.cpp:87
esphome::api::ListEntitiesIterator::client_
APIConnection * client_
Definition
list_entities.h:96
esphome::api::ListEntitiesLightResponse
Definition
api_pb2.h:729
esphome::api::ListEntitiesLockResponse
Definition
api_pb2.h:1533
esphome::api::ListEntitiesMediaPlayerResponse
Definition
api_pb2.h:1639
esphome::api::ListEntitiesNumberResponse
Definition
api_pb2.h:1365
esphome::api::ListEntitiesSelectResponse
Definition
api_pb2.h:1421
esphome::api::ListEntitiesSensorResponse
Definition
api_pb2.h:823
esphome::api::ListEntitiesSwitchResponse
Definition
api_pb2.h:863
esphome::api::ListEntitiesTextResponse
Definition
api_pb2.h:2507
esphome::api::ListEntitiesTextSensorResponse
Definition
api_pb2.h:914
esphome::api::ListEntitiesTimeResponse
Definition
api_pb2.h:2616
esphome::api::ListEntitiesUpdateResponse
Definition
api_pb2.h:2811
esphome::api::ListEntitiesValveResponse
Definition
api_pb2.h:2705
esphome::api::UserServiceDescriptor
Definition
user_services.h:14
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:93
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:62
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:35
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::LIST_ENTITIES_HANDLER
LIST_ENTITIES_HANDLER(binary_sensor, binary_sensor::BinarySensor, ListEntitiesBinarySensorResponse) LIST_ENTITIES_HANDLER(cover
esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
Generated by
1.12.0