38 return (source_ == test.source_ && send_message_ == test.send_message_);
67 return this->send_list_entities_done_response(resp);
69 #ifdef USE_BINARY_SENSOR 72 static bool try_send_binary_sensor_state(
APIConnection *api,
void *v_binary_sensor);
74 static bool try_send_binary_sensor_info(
APIConnection *api,
void *v_binary_sensor);
79 static bool try_send_cover_state(
APIConnection *api,
void *v_cover);
80 static bool try_send_cover_info(
APIConnection *api,
void *v_cover);
86 static bool try_send_fan_state(
APIConnection *api,
void *v_fan);
87 static bool try_send_fan_info(
APIConnection *api,
void *v_fan);
93 static bool try_send_light_state(
APIConnection *api,
void *v_light);
94 static bool try_send_light_info(
APIConnection *api,
void *v_light);
100 static bool try_send_sensor_state(
APIConnection *api,
void *v_sensor);
102 static bool try_send_sensor_info(
APIConnection *api,
void *v_sensor);
107 static bool try_send_switch_state(
APIConnection *api,
void *v_a_switch);
109 static bool try_send_switch_info(
APIConnection *api,
void *v_a_switch);
112 #ifdef USE_TEXT_SENSOR 115 static bool try_send_text_sensor_state(
APIConnection *api,
void *v_text_sensor);
117 static bool try_send_text_sensor_info(
APIConnection *api,
void *v_text_sensor);
119 #ifdef USE_ESP32_CAMERA 120 void set_camera_state(std::shared_ptr<esp32_camera::CameraImage> image);
122 static bool try_send_camera_info(
APIConnection *api,
void *v_camera);
128 static bool try_send_climate_state(
APIConnection *api,
void *v_climate);
129 static bool try_send_climate_info(
APIConnection *api,
void *v_climate);
135 static bool try_send_number_state(
APIConnection *api,
void *v_number);
137 static bool try_send_number_info(
APIConnection *api,
void *v_number);
140 #ifdef USE_DATETIME_DATE 143 static bool try_send_date_state(
APIConnection *api,
void *v_date);
144 static bool try_send_date_info(
APIConnection *api,
void *v_date);
147 #ifdef USE_DATETIME_TIME 150 static bool try_send_time_state(
APIConnection *api,
void *v_time);
151 static bool try_send_time_info(
APIConnection *api,
void *v_time);
154 #ifdef USE_DATETIME_DATETIME 157 static bool try_send_datetime_state(
APIConnection *api,
void *v_datetime);
158 static bool try_send_datetime_info(
APIConnection *api,
void *v_datetime);
162 bool send_text_state(
text::Text *text, std::string state);
164 static bool try_send_text_state(
APIConnection *api,
void *v_text);
166 static bool try_send_text_info(
APIConnection *api,
void *v_text);
170 bool send_select_state(
select::Select *select, std::string state);
172 static bool try_send_select_state(
APIConnection *api,
void *v_select);
174 static bool try_send_select_info(
APIConnection *api,
void *v_select);
179 static bool try_send_button_info(
APIConnection *api,
void *v_button);
185 static bool try_send_lock_state(
APIConnection *api,
void *v_a_lock);
187 static bool try_send_lock_info(
APIConnection *api,
void *v_a_lock);
193 static bool try_send_valve_state(
APIConnection *api,
void *v_valve);
194 static bool try_send_valve_info(
APIConnection *api,
void *v_valve);
197 #ifdef USE_MEDIA_PLAYER 200 static bool try_send_media_player_state(
APIConnection *api,
void *v_media_player);
201 static bool try_send_media_player_info(
APIConnection *api,
void *v_media_player);
204 bool try_send_log_message(
int level,
const char *tag,
const char *line);
206 if (!this->service_call_subscription_)
208 this->send_homeassistant_service_response(call);
210 #ifdef USE_BLUETOOTH_PROXY 226 #ifdef USE_HOMEASSISTANT_TIME 229 this->send_get_time_request(req);
233 #ifdef USE_VOICE_ASSISTANT 245 #ifdef USE_ALARM_CONTROL_PANEL 248 static bool try_send_alarm_control_panel_state(
APIConnection *api,
void *v_a_alarm_control_panel);
249 static bool try_send_alarm_control_panel_info(
APIConnection *api,
void *v_a_alarm_control_panel);
254 void send_event(
event::Event *event, std::string event_type);
256 static bool try_send_event(
APIConnection *api,
void *v_event);
258 static bool try_send_event_info(
APIConnection *api,
void *v_event);
264 static bool try_send_update_state(
APIConnection *api,
void *v_update);
265 static bool try_send_update_info(
APIConnection *api,
void *v_update);
272 this->ping_retries_ = 0;
273 this->sent_ping_ =
false;
276 #ifdef USE_HOMEASSISTANT_TIME 286 this->state_subscription_ =
true;
287 this->initial_state_iterator_.begin();
290 this->log_subscription_ = msg.
level;
295 this->service_call_subscription_ =
true;
304 bool is_authenticated()
override {
return this->connection_state_ == ConnectionState::AUTHENTICATED; }
306 return this->connection_state_ == ConnectionState ::CONNECTED || this->is_authenticated();
308 void on_fatal_error()
override;
309 void on_unauthenticated_access()
override;
310 void on_no_setup_connection()
override;
313 this->proto_write_buffer_.clear();
314 return {&this->proto_write_buffer_};
323 bool send_(
const void *buf,
size_t len,
bool force);
329 } connection_state_{ConnectionState::WAITING_FOR_HELLO};
341 uint32_t client_api_version_major_{0};
342 uint32_t client_api_version_minor_{0};
343 #ifdef USE_ESP32_CAMERA 347 bool state_subscription_{
false};
348 int log_subscription_{ESPHOME_LOG_LEVEL_NONE};
350 uint32_t next_ping_retry_{0};
351 uint8_t ping_retries_{0};
352 bool sent_ping_{
false};
353 bool service_call_subscription_{
false};
354 bool next_close_ =
false;
359 int state_subs_at_ = -1;
std::string client_peername_
Base class for all switches.
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
void subscribe_homeassistant_services(const SubscribeHomeassistantServicesRequest &msg) override
void dmq_push_back_with_dedup_(void *source, send_message_t *send_message)
Base class for all cover devices.
void send_homeassistant_service_call(const HomeassistantServiceResponse &call)
InitialStateIterator initial_state_iterator_
bool(APIConnection *, void *) send_message_t
class esphome::bedjet::BedjetCodec __attribute__
std::unique_ptr< APIFrameHelper > helper_
void defer(void *source, send_message_t *send_message)
bool send_list_info_done()
std::string get_client_combined_info() const
DeferredMessageQueue deferred_message_queue_
Base-class for all text inputs.
std::string client_combined_info_
std::vector< uint8_t > proto_write_buffer_
Base-class for all numbers.
void schedule_dump_config()
void subscribe_states(const SubscribeStatesRequest &msg) override
Application App
Global storage of Application pointer - only one Application can exist.
send_message_t * send_message_
void on_ping_response(const PingResponse &value) override
esphome::binary_sensor::BinarySensor * binary_sensor
esp32_camera::CameraImageReader image_reader_
DeferredMessageQueue(APIConnection *api_connection)
GetTimeResponse get_time(const GetTimeRequest &msg) override
bool operator==(optional< T > const &x, optional< U > const &y)
void subscribe_logs(const SubscribeLogsRequest &msg) override
Base-class for all selects.
Implementation of SPI Controller mode.
bool is_authenticated() override
Base class for all valve devices.
Base class for all binary_sensor-type classes.
DeferredMessage(void *source, send_message_t *send_message)
LockState
Enum for all states a lock can be in.
ListEntitiesIterator list_entities_iterator_
bool is_connection_setup() override
Base-class for all sensors.
APIConnection * api_connection_
PingResponse ping(const PingRequest &msg) override
ProtoWriteBuffer create_buffer() override
esphome::sensor::Sensor * sensor
std::vector< DeferredMessage > deferred_queue_
Base class for all locks.
ClimateDevice - This is the base class for all climate integrations.
void list_entities(const ListEntitiesRequest &msg) override
std::unique_ptr< Socket > socket(int domain, int type, int protocol)
Create a socket of the given domain, type and protocol.