ESPHome 2025.5.0
Loading...
Searching...
No Matches
api_connection.h
Go to the documentation of this file.
1#pragma once
2
4#ifdef USE_API
5#include "api_frame_helper.h"
6#include "api_pb2.h"
12
13#include <vector>
14
15namespace esphome {
16namespace api {
17
18// Keepalive timeout in milliseconds
19static constexpr uint32_t KEEPALIVE_TIMEOUT_MS = 60000;
20
21using send_message_t = bool (APIConnection::*)(void *);
22
23/*
24 This class holds a pointer to the source component that wants to publish a message, and a pointer to a function that
25 will lazily publish that message. The two pointers allow dedup in the deferred queue if multiple publishes for the
26 same component are backed up, and take up only 8 bytes of memory. The entry in the deferred queue (a std::vector) is
27 the DeferredMessage instance itself (not a pointer to one elsewhere in heap) so still only 8 bytes per entry. Even
28 100 backed up messages (you'd have to have at least 100 sensors publishing because of dedup) would take up only 0.8
29 kB.
30*/
32 struct DeferredMessage {
33 friend class DeferredMessageQueue;
34
35 protected:
36 void *source_;
38
39 public:
40 DeferredMessage(void *source, send_message_t send_message) : source_(source), send_message_(send_message) {}
41 bool operator==(const DeferredMessage &test) const {
42 return (source_ == test.source_ && send_message_ == test.send_message_);
43 }
44 } __attribute__((packed));
45
46 protected:
47 // vector is used very specifically for its zero memory overhead even though items are popped from the front (memory
48 // footprint is more important than speed here)
49 std::vector<DeferredMessage> deferred_queue_;
51
52 // helper for allowing only unique entries in the queue
53 void dmq_push_back_with_dedup_(void *source, send_message_t send_message);
54
55 public:
56 DeferredMessageQueue(APIConnection *api_connection) : api_connection_(api_connection) {}
57 void process_queue();
58 void defer(void *source, send_message_t send_message);
59 bool empty() const { return deferred_queue_.empty(); }
60};
61
63 public:
64 APIConnection(std::unique_ptr<socket::Socket> socket, APIServer *parent);
65 virtual ~APIConnection();
66
67 void start();
68 void loop();
69
74#ifdef USE_BINARY_SENSOR
77
78 protected:
82
83 public:
84#endif
85#ifdef USE_COVER
86 bool send_cover_state(cover::Cover *cover);
87 void send_cover_info(cover::Cover *cover);
88 void cover_command(const CoverCommandRequest &msg) override;
89
90 protected:
93
94 public:
95#endif
96#ifdef USE_FAN
97 bool send_fan_state(fan::Fan *fan);
98 void send_fan_info(fan::Fan *fan);
99 void fan_command(const FanCommandRequest &msg) override;
100
101 protected:
102 bool try_send_fan_state_(fan::Fan *fan);
103 bool try_send_fan_info_(fan::Fan *fan);
104
105 public:
106#endif
107#ifdef USE_LIGHT
110 void light_command(const LightCommandRequest &msg) override;
111
112 protected:
115
116 public:
117#endif
118#ifdef USE_SENSOR
119 bool send_sensor_state(sensor::Sensor *sensor, float state);
120 void send_sensor_info(sensor::Sensor *sensor);
121
122 protected:
124 bool try_send_sensor_state_(sensor::Sensor *sensor, float state);
126
127 public:
128#endif
129#ifdef USE_SWITCH
130 bool send_switch_state(switch_::Switch *a_switch, bool state);
131 void send_switch_info(switch_::Switch *a_switch);
132 void switch_command(const SwitchCommandRequest &msg) override;
133
134 protected:
136 bool try_send_switch_state_(switch_::Switch *a_switch, bool state);
138
139 public:
140#endif
141#ifdef USE_TEXT_SENSOR
142 bool send_text_sensor_state(text_sensor::TextSensor *text_sensor, std::string state);
144
145 protected:
147 bool try_send_text_sensor_state_(text_sensor::TextSensor *text_sensor, std::string state);
149
150 public:
151#endif
152#ifdef USE_ESP32_CAMERA
153 void set_camera_state(std::shared_ptr<esp32_camera::CameraImage> image);
155 void camera_image(const CameraImageRequest &msg) override;
156
157 protected:
159
160 public:
161#endif
162#ifdef USE_CLIMATE
164 void send_climate_info(climate::Climate *climate);
165 void climate_command(const ClimateCommandRequest &msg) override;
166
167 protected:
170
171 public:
172#endif
173#ifdef USE_NUMBER
174 bool send_number_state(number::Number *number, float state);
175 void send_number_info(number::Number *number);
176 void number_command(const NumberCommandRequest &msg) override;
177
178 protected:
180 bool try_send_number_state_(number::Number *number, float state);
182
183 public:
184#endif
185#ifdef USE_DATETIME_DATE
188 void date_command(const DateCommandRequest &msg) override;
189
190 protected:
193
194 public:
195#endif
196#ifdef USE_DATETIME_TIME
199 void time_command(const TimeCommandRequest &msg) override;
200
201 protected:
204
205 public:
206#endif
207#ifdef USE_DATETIME_DATETIME
210 void datetime_command(const DateTimeCommandRequest &msg) override;
211
212 protected:
215
216 public:
217#endif
218#ifdef USE_TEXT
219 bool send_text_state(text::Text *text, std::string state);
220 void send_text_info(text::Text *text);
221 void text_command(const TextCommandRequest &msg) override;
222
223 protected:
225 bool try_send_text_state_(text::Text *text, std::string state);
227
228 public:
229#endif
230#ifdef USE_SELECT
231 bool send_select_state(select::Select *select, std::string state);
232 void send_select_info(select::Select *select);
233 void select_command(const SelectCommandRequest &msg) override;
234
235 protected:
237 bool try_send_select_state_(select::Select *select, std::string state);
239
240 public:
241#endif
242#ifdef USE_BUTTON
243 void send_button_info(button::Button *button);
244 void button_command(const ButtonCommandRequest &msg) override;
245
246 protected:
248
249 public:
250#endif
251#ifdef USE_LOCK
253 void send_lock_info(lock::Lock *a_lock);
254 void lock_command(const LockCommandRequest &msg) override;
255
256 protected:
257 bool try_send_lock_state_(lock::Lock *a_lock);
259 bool try_send_lock_info_(lock::Lock *a_lock);
260
261 public:
262#endif
263#ifdef USE_VALVE
264 bool send_valve_state(valve::Valve *valve);
265 void send_valve_info(valve::Valve *valve);
266 void valve_command(const ValveCommandRequest &msg) override;
267
268 protected:
271
272 public:
273#endif
274#ifdef USE_MEDIA_PLAYER
277 void media_player_command(const MediaPlayerCommandRequest &msg) override;
278
279 protected:
282
283 public:
284#endif
285 bool try_send_log_message(int level, const char *tag, const char *line);
291#ifdef USE_BLUETOOTH_PROXY
295
296 void bluetooth_device_request(const BluetoothDeviceRequest &msg) override;
297 void bluetooth_gatt_read(const BluetoothGATTReadRequest &msg) override;
298 void bluetooth_gatt_write(const BluetoothGATTWriteRequest &msg) override;
302 void bluetooth_gatt_notify(const BluetoothGATTNotifyRequest &msg) override;
304 const SubscribeBluetoothConnectionsFreeRequest &msg) override;
306
307#endif
308#ifdef USE_HOMEASSISTANT_TIME
310 GetTimeRequest req;
311 this->send_get_time_request(req);
312 }
313#endif
314
315#ifdef USE_VOICE_ASSISTANT
317 void on_voice_assistant_response(const VoiceAssistantResponse &msg) override;
319 void on_voice_assistant_audio(const VoiceAssistantAudio &msg) override;
323 const VoiceAssistantConfigurationRequest &msg) override;
325#endif
326
327#ifdef USE_ALARM_CONTROL_PANEL
331
332 protected:
335
336 public:
337#endif
338
339#ifdef USE_EVENT
340 void send_event(event::Event *event, std::string event_type);
341 void send_event_info(event::Event *event);
342
343 protected:
344 bool try_send_event_(event::Event *event);
345 bool try_send_event_(event::Event *event, std::string event_type);
347
348 public:
349#endif
350
351#ifdef USE_UPDATE
354 void update_command(const UpdateCommandRequest &msg) override;
355
356 protected:
359
360 public:
361#endif
362
363 void on_disconnect_response(const DisconnectResponse &value) override;
364 void on_ping_response(const PingResponse &value) override {
365 // we initiated ping
366 this->ping_retries_ = 0;
367 this->sent_ping_ = false;
368 }
370#ifdef USE_HOMEASSISTANT_TIME
371 void on_get_time_response(const GetTimeResponse &value) override;
372#endif
373 HelloResponse hello(const HelloRequest &msg) override;
374 ConnectResponse connect(const ConnectRequest &msg) override;
376 PingResponse ping(const PingRequest &msg) override { return {}; }
378 void list_entities(const ListEntitiesRequest &msg) override { this->list_entities_iterator_.begin(); }
379 void subscribe_states(const SubscribeStatesRequest &msg) override {
380 this->state_subscription_ = true;
382 }
383 void subscribe_logs(const SubscribeLogsRequest &msg) override {
384 this->log_subscription_ = msg.level;
385 if (msg.dump_config)
387 }
393 // TODO
394 return {};
395 }
396 void execute_service(const ExecuteServiceRequest &msg) override;
397#ifdef USE_API_NOISE
399#endif
400
401 bool is_authenticated() override { return this->connection_state_ == ConnectionState::AUTHENTICATED; }
402 bool is_connection_setup() override {
403 return this->connection_state_ == ConnectionState ::CONNECTED || this->is_authenticated();
404 }
405 void on_fatal_error() override;
406 void on_unauthenticated_access() override;
407 void on_no_setup_connection() override;
408 ProtoWriteBuffer create_buffer(uint32_t reserve_size) override {
409 // FIXME: ensure no recursive writes can happen
410 this->proto_write_buffer_.clear();
411 // Get header padding size - used for both reserve and insert
412 uint8_t header_padding = this->helper_->frame_header_padding();
413 // Reserve space for header padding + message + footer
414 // - Header padding: space for protocol headers (7 bytes for Noise, 6 for Plaintext)
415 // - Footer: space for MAC (16 bytes for Noise, 0 for Plaintext)
416 this->proto_write_buffer_.reserve(reserve_size + header_padding + this->helper_->frame_footer_size());
417 // Insert header padding bytes so message encoding starts at the correct position
418 this->proto_write_buffer_.insert(this->proto_write_buffer_.begin(), header_padding, 0);
419 return {&this->proto_write_buffer_};
420 }
421 bool try_to_clear_buffer(bool log_out_of_space);
422 bool send_buffer(ProtoWriteBuffer buffer, uint32_t message_type) override;
423
424 std::string get_client_combined_info() const { return this->client_combined_info_; }
425
426 protected:
427 friend APIServer;
428
439 bool send_state_(esphome::EntityBase *entity, send_message_t try_send_func) {
440 if (!this->state_subscription_)
441 return false;
442 if (this->try_to_clear_buffer(true) && (this->*try_send_func)(entity)) {
443 return true;
444 }
445 this->deferred_message_queue_.defer(entity, try_send_func);
446 return true;
447 }
448
467 template<typename EntityT, typename StateT, typename... Args>
468 bool send_state_with_value_(EntityT *entity, bool (APIConnection::*try_send_entity_func)(EntityT *),
469 bool (APIConnection::*try_send_state_func)(EntityT *, StateT, Args...), StateT state,
470 Args... args) {
471 if (!this->state_subscription_)
472 return false;
473 if (this->try_to_clear_buffer(true) && (this->*try_send_state_func)(entity, state, args...)) {
474 return true;
475 }
476 this->deferred_message_queue_.defer(entity, reinterpret_cast<send_message_t>(try_send_entity_func));
477 return true;
478 }
479
487 void send_info_(esphome::EntityBase *entity, send_message_t try_send_func) {
488 if (this->try_to_clear_buffer(true) && (this->*try_send_func)(entity)) {
489 return;
490 }
491 this->deferred_message_queue_.defer(entity, try_send_func);
492 }
493
503 template<typename ResponseT>
504 bool try_send_entity_info_(esphome::EntityBase *entity, ResponseT &response,
505 bool (APIServerConnectionBase::*send_response_func)(const ResponseT &)) {
506 // Set common fields that are shared by all entity types
507 response.key = entity->get_object_id_hash();
508 response.object_id = entity->get_object_id();
509
510 if (entity->has_own_name())
511 response.name = entity->get_name();
512
513 // Set common EntityBase properties
514 response.icon = entity->get_icon();
515 response.disabled_by_default = entity->is_disabled_by_default();
516 response.entity_category = static_cast<enums::EntityCategory>(entity->get_entity_category());
517
518 // Send the response using the provided send method
519 return (this->*send_response_func)(response);
520 }
521
522 bool send_(const void *buf, size_t len, bool force);
523
529
530 bool remove_{false};
531
532 // Buffer used to encode proto messages
533 // Re-use to prevent allocations
534 std::vector<uint8_t> proto_write_buffer_;
535 std::unique_ptr<APIFrameHelper> helper_;
536
537 std::string client_info_;
538 std::string client_peername_;
542#ifdef USE_ESP32_CAMERA
544#endif
545
547 int log_subscription_{ESPHOME_LOG_LEVEL_NONE};
549 uint32_t next_ping_retry_{0};
550 uint8_t ping_retries_{0};
551 bool sent_ping_{false};
553 bool next_close_ = false;
559};
560
561} // namespace api
562} // namespace esphome
563#endif
bool operator==(const DeferredMessage &test) const
DeferredMessage(void *source, send_message_t send_message)
send_message_t send_message_
void * source_
void begin(bool include_internal=false)
bool has_own_name() const
Definition entity_base.h:23
uint32_t get_object_id_hash()
const StringRef & get_name() const
std::string get_icon() const
bool is_disabled_by_default() const
std::string get_object_id() const
EntityCategory get_entity_category() const
void subscribe_voice_assistant(const SubscribeVoiceAssistantRequest &msg) override
void select_command(const SelectCommandRequest &msg) override
BluetoothConnectionsFreeResponse subscribe_bluetooth_connections_free(const SubscribeBluetoothConnectionsFreeRequest &msg) override
bool try_send_alarm_control_panel_state_(alarm_control_panel::AlarmControlPanel *a_alarm_control_panel)
void send_valve_info(valve::Valve *valve)
void send_media_player_info(media_player::MediaPlayer *media_player)
bool try_send_time_state_(datetime::TimeEntity *time)
void bluetooth_gatt_write(const BluetoothGATTWriteRequest &msg) override
void send_light_info(light::LightState *light)
bool send_media_player_state(media_player::MediaPlayer *media_player)
bool try_send_valve_state_(valve::Valve *valve)
bool try_send_text_state_(text::Text *text)
bool send_time_state(datetime::TimeEntity *time)
void time_command(const TimeCommandRequest &msg) override
bool send_state_with_value_(EntityT *entity, bool(APIConnection::*try_send_entity_func)(EntityT *), bool(APIConnection::*try_send_state_func)(EntityT *, StateT, Args...), StateT state, Args... args)
Send entity state method that handles explicit state values.
bool send_buffer(ProtoWriteBuffer buffer, uint32_t message_type) override
void update_command(const UpdateCommandRequest &msg) override
void on_ping_response(const PingResponse &value) override
void send_climate_info(climate::Climate *climate)
void on_voice_assistant_announce_request(const VoiceAssistantAnnounceRequest &msg) override
bool try_send_sensor_state_(sensor::Sensor *sensor)
void set_camera_state(std::shared_ptr< esp32_camera::CameraImage > image)
bool send_state_(esphome::EntityBase *entity, send_message_t try_send_func)
Generic send entity state method to reduce code duplication.
ProtoWriteBuffer create_buffer(uint32_t reserve_size) override
esp32_camera::CameraImageReader image_reader_
bool send_select_state(select::Select *select, std::string state)
bool send_number_state(number::Number *number, float state)
void send_datetime_info(datetime::DateTimeEntity *datetime)
bool send_fan_state(fan::Fan *fan)
void bluetooth_scanner_set_mode(const BluetoothScannerSetModeRequest &msg) override
DeferredMessageQueue deferred_message_queue_
void on_voice_assistant_response(const VoiceAssistantResponse &msg) override
bool try_send_lock_info_(lock::Lock *a_lock)
bool try_send_text_info_(text::Text *text)
enum esphome::api::APIConnection::ConnectionState WAITING_FOR_HELLO
InitialStateIterator initial_state_iterator_
void subscribe_logs(const SubscribeLogsRequest &msg) override
std::unique_ptr< APIFrameHelper > helper_
void date_command(const DateCommandRequest &msg) override
void send_number_info(number::Number *number)
void send_info_(esphome::EntityBase *entity, send_message_t try_send_func)
Generic send entity info method to reduce code duplication.
void send_event(event::Event *event, std::string event_type)
void send_sensor_info(sensor::Sensor *sensor)
bool send_switch_state(switch_::Switch *a_switch, bool state)
std::string get_client_combined_info() const
bool try_send_cover_info_(cover::Cover *cover)
bool try_send_button_info_(button::Button *button)
void datetime_command(const DateTimeCommandRequest &msg) override
bool try_send_switch_state_(switch_::Switch *a_switch)
void send_switch_info(switch_::Switch *a_switch)
void voice_assistant_set_configuration(const VoiceAssistantSetConfiguration &msg) override
void send_binary_sensor_info(binary_sensor::BinarySensor *binary_sensor)
bool send_valve_state(valve::Valve *valve)
void send_select_info(select::Select *select)
void bluetooth_gatt_write_descriptor(const BluetoothGATTWriteDescriptorRequest &msg) override
bool try_send_select_info_(select::Select *select)
bool send_lock_state(lock::Lock *a_lock, lock::LockState state)
void bluetooth_gatt_read(const BluetoothGATTReadRequest &msg) override
bool try_send_select_state_(select::Select *select)
bool try_send_cover_state_(cover::Cover *cover)
bool try_send_datetime_state_(datetime::DateTimeEntity *datetime)
VoiceAssistantConfigurationResponse voice_assistant_get_configuration(const VoiceAssistantConfigurationRequest &msg) override
bool try_send_binary_sensor_state_(binary_sensor::BinarySensor *binary_sensor)
DisconnectResponse disconnect(const DisconnectRequest &msg) override
void text_command(const TextCommandRequest &msg) override
bool send_sensor_state(sensor::Sensor *sensor, float state)
bool try_send_fan_info_(fan::Fan *fan)
bool send_(const void *buf, size_t len, bool force)
bool try_send_lock_state_(lock::Lock *a_lock)
HelloResponse hello(const HelloRequest &msg) override
bool try_send_log_message(int level, const char *tag, const char *line)
bool send_update_state(update::UpdateEntity *update)
void on_voice_assistant_audio(const VoiceAssistantAudio &msg) override
bool try_send_datetime_info_(datetime::DateTimeEntity *datetime)
bool try_send_entity_info_(esphome::EntityBase *entity, ResponseT &response, bool(APIServerConnectionBase::*send_response_func)(const ResponseT &))
Generic function for generating entity info response messages.
void send_alarm_control_panel_info(alarm_control_panel::AlarmControlPanel *a_alarm_control_panel)
void send_update_info(update::UpdateEntity *update)
bool try_send_climate_info_(climate::Climate *climate)
bool try_send_date_state_(datetime::DateEntity *date)
void alarm_control_panel_command(const AlarmControlPanelCommandRequest &msg) override
bool try_send_time_info_(datetime::TimeEntity *time)
bool try_send_alarm_control_panel_info_(alarm_control_panel::AlarmControlPanel *a_alarm_control_panel)
bool try_send_event_(event::Event *event)
bool send_binary_sensor_state(binary_sensor::BinarySensor *binary_sensor, bool state)
void unsubscribe_bluetooth_le_advertisements(const UnsubscribeBluetoothLEAdvertisementsRequest &msg) override
void number_command(const NumberCommandRequest &msg) override
bool try_send_text_sensor_info_(text_sensor::TextSensor *text_sensor)
bool try_send_binary_sensor_info_(binary_sensor::BinarySensor *binary_sensor)
void send_camera_info(esp32_camera::ESP32Camera *camera)
void list_entities(const ListEntitiesRequest &msg) override
bool try_send_switch_info_(switch_::Switch *a_switch)
bool try_send_valve_info_(valve::Valve *valve)
void media_player_command(const MediaPlayerCommandRequest &msg) override
void bluetooth_gatt_notify(const BluetoothGATTNotifyRequest &msg) override
void subscribe_homeassistant_services(const SubscribeHomeassistantServicesRequest &msg) override
APIConnection(std::unique_ptr< socket::Socket > socket, APIServer *parent)
void subscribe_states(const SubscribeStatesRequest &msg) override
void send_event_info(event::Event *event)
bool try_send_light_state_(light::LightState *light)
void subscribe_bluetooth_le_advertisements(const SubscribeBluetoothLEAdvertisementsRequest &msg) override
bool send_date_state(datetime::DateEntity *date)
void bluetooth_gatt_read_descriptor(const BluetoothGATTReadDescriptorRequest &msg) override
void climate_command(const ClimateCommandRequest &msg) override
void send_date_info(datetime::DateEntity *date)
void bluetooth_gatt_get_services(const BluetoothGATTGetServicesRequest &msg) override
bool is_connection_setup() override
std::vector< uint8_t > proto_write_buffer_
void on_voice_assistant_timer_event_response(const VoiceAssistantTimerEventResponse &msg) override
bool try_send_climate_state_(climate::Climate *climate)
void fan_command(const FanCommandRequest &msg) override
void on_voice_assistant_event_response(const VoiceAssistantEventResponse &msg) override
PingResponse ping(const PingRequest &msg) override
NoiseEncryptionSetKeyResponse noise_encryption_set_key(const NoiseEncryptionSetKeyRequest &msg) override
void send_text_sensor_info(text_sensor::TextSensor *text_sensor)
bool try_send_number_info_(number::Number *number)
bool send_light_state(light::LightState *light)
DeviceInfoResponse device_info(const DeviceInfoRequest &msg) override
bool try_send_light_info_(light::LightState *light)
void valve_command(const ValveCommandRequest &msg) override
void on_home_assistant_state_response(const HomeAssistantStateResponse &msg) override
void send_button_info(button::Button *button)
void cover_command(const CoverCommandRequest &msg) override
bool try_send_camera_info_(esp32_camera::ESP32Camera *camera)
bool try_send_text_sensor_state_(text_sensor::TextSensor *text_sensor)
void send_fan_info(fan::Fan *fan)
void on_get_time_response(const GetTimeResponse &value) override
bool try_send_date_info_(datetime::DateEntity *date)
void send_time_info(datetime::TimeEntity *time)
bool try_send_fan_state_(fan::Fan *fan)
void subscribe_home_assistant_states(const SubscribeHomeAssistantStatesRequest &msg) override
bool send_text_sensor_state(text_sensor::TextSensor *text_sensor, std::string state)
bool send_bluetooth_le_advertisement(const BluetoothLEAdvertisementResponse &msg)
bool send_text_state(text::Text *text, std::string state)
void send_homeassistant_service_call(const HomeassistantServiceResponse &call)
bool try_send_event_info_(event::Event *event)
bool try_send_update_state_(update::UpdateEntity *update)
void on_disconnect_response(const DisconnectResponse &value) override
bool send_datetime_state(datetime::DateTimeEntity *datetime)
ListEntitiesIterator list_entities_iterator_
bool try_send_media_player_info_(media_player::MediaPlayer *media_player)
bool try_send_media_player_state_(media_player::MediaPlayer *media_player)
bool send_alarm_control_panel_state(alarm_control_panel::AlarmControlPanel *a_alarm_control_panel)
void camera_image(const CameraImageRequest &msg) override
void light_command(const LightCommandRequest &msg) override
GetTimeResponse get_time(const GetTimeRequest &msg) override
void send_cover_info(cover::Cover *cover)
void switch_command(const SwitchCommandRequest &msg) override
bool try_send_sensor_info_(sensor::Sensor *sensor)
bool try_send_update_info_(update::UpdateEntity *update)
bool try_send_number_state_(number::Number *number)
void send_lock_info(lock::Lock *a_lock)
void send_text_info(text::Text *text)
ConnectResponse connect(const ConnectRequest &msg) override
void lock_command(const LockCommandRequest &msg) override
void bluetooth_device_request(const BluetoothDeviceRequest &msg) override
void execute_service(const ExecuteServiceRequest &msg) override
bool send_climate_state(climate::Climate *climate)
bool try_to_clear_buffer(bool log_out_of_space)
bool send_cover_state(cover::Cover *cover)
void button_command(const ButtonCommandRequest &msg) override
void on_unauthenticated_access() override
bool send_list_entities_done_response(const ListEntitiesDoneResponse &msg)
bool send_homeassistant_service_response(const HomeassistantServiceResponse &msg)
bool send_get_time_request(const GetTimeRequest &msg)
std::vector< DeferredMessage > deferred_queue_
void dmq_push_back_with_dedup_(void *source, send_message_t send_message)
DeferredMessageQueue(APIConnection *api_connection)
void defer(void *source, send_message_t send_message)
Base class for all binary_sensor-type classes.
Base class for all buttons.
Definition button.h:29
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:63
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:57
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
struct @67::@68 __attribute__
bool state
Definition fan.h:0
bool(APIConnection::*)(void *) send_message_t
LockState
Enum for all states a lock can be in.
Definition lock.h:26
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string size_t len
Definition helpers.h:301
Application App
Global storage of Application pointer - only one Application can exist.