ESPHome  2024.12.2
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
esphome::api::APIConnection Class Reference

#include <api_connection.h>

Inheritance diagram for esphome::api::APIConnection:
esphome::api::APIServerConnection esphome::api::APIServerConnectionBase esphome::api::ProtoService

Public Member Functions

 APIConnection (std::unique_ptr< socket::Socket > socket, APIServer *parent)
 
virtual ~APIConnection ()
 
void start ()
 
void loop ()
 
bool send_list_info_done ()
 
bool send_binary_sensor_state (binary_sensor::BinarySensor *binary_sensor, bool state)
 
bool send_binary_sensor_info (binary_sensor::BinarySensor *binary_sensor)
 
bool send_cover_state (cover::Cover *cover)
 
bool send_cover_info (cover::Cover *cover)
 
void cover_command (const CoverCommandRequest &msg) override
 
bool send_fan_state (fan::Fan *fan)
 
bool send_fan_info (fan::Fan *fan)
 
void fan_command (const FanCommandRequest &msg) override
 
bool send_light_state (light::LightState *light)
 
bool send_light_info (light::LightState *light)
 
void light_command (const LightCommandRequest &msg) override
 
bool send_sensor_state (sensor::Sensor *sensor, float state)
 
bool send_sensor_info (sensor::Sensor *sensor)
 
bool send_switch_state (switch_::Switch *a_switch, bool state)
 
bool send_switch_info (switch_::Switch *a_switch)
 
void switch_command (const SwitchCommandRequest &msg) override
 
bool send_text_sensor_state (text_sensor::TextSensor *text_sensor, std::string state)
 
bool send_text_sensor_info (text_sensor::TextSensor *text_sensor)
 
void send_camera_state (std::shared_ptr< esp32_camera::CameraImage > image)
 
bool send_camera_info (esp32_camera::ESP32Camera *camera)
 
void camera_image (const CameraImageRequest &msg) override
 
bool send_climate_state (climate::Climate *climate)
 
bool send_climate_info (climate::Climate *climate)
 
void climate_command (const ClimateCommandRequest &msg) override
 
bool send_number_state (number::Number *number, float state)
 
bool send_number_info (number::Number *number)
 
void number_command (const NumberCommandRequest &msg) override
 
bool send_date_state (datetime::DateEntity *date)
 
bool send_date_info (datetime::DateEntity *date)
 
void date_command (const DateCommandRequest &msg) override
 
bool send_time_state (datetime::TimeEntity *time)
 
bool send_time_info (datetime::TimeEntity *time)
 
void time_command (const TimeCommandRequest &msg) override
 
bool send_datetime_state (datetime::DateTimeEntity *datetime)
 
bool send_datetime_info (datetime::DateTimeEntity *datetime)
 
void datetime_command (const DateTimeCommandRequest &msg) override
 
bool send_text_state (text::Text *text, std::string state)
 
bool send_text_info (text::Text *text)
 
void text_command (const TextCommandRequest &msg) override
 
bool send_select_state (select::Select *select, std::string state)
 
bool send_select_info (select::Select *select)
 
void select_command (const SelectCommandRequest &msg) override
 
bool send_button_info (button::Button *button)
 
void button_command (const ButtonCommandRequest &msg) override
 
bool send_lock_state (lock::Lock *a_lock, lock::LockState state)
 
bool send_lock_info (lock::Lock *a_lock)
 
void lock_command (const LockCommandRequest &msg) override
 
bool send_valve_state (valve::Valve *valve)
 
bool send_valve_info (valve::Valve *valve)
 
void valve_command (const ValveCommandRequest &msg) override
 
bool send_media_player_state (media_player::MediaPlayer *media_player)
 
bool send_media_player_info (media_player::MediaPlayer *media_player)
 
void media_player_command (const MediaPlayerCommandRequest &msg) override
 
bool send_log_message (int level, const char *tag, const char *line)
 
void send_homeassistant_service_call (const HomeassistantServiceResponse &call)
 
void subscribe_bluetooth_le_advertisements (const SubscribeBluetoothLEAdvertisementsRequest &msg) override
 
void unsubscribe_bluetooth_le_advertisements (const UnsubscribeBluetoothLEAdvertisementsRequest &msg) override
 
bool send_bluetooth_le_advertisement (const BluetoothLEAdvertisementResponse &msg)
 
void bluetooth_device_request (const BluetoothDeviceRequest &msg) override
 
void bluetooth_gatt_read (const BluetoothGATTReadRequest &msg) override
 
void bluetooth_gatt_write (const BluetoothGATTWriteRequest &msg) override
 
void bluetooth_gatt_read_descriptor (const BluetoothGATTReadDescriptorRequest &msg) override
 
void bluetooth_gatt_write_descriptor (const BluetoothGATTWriteDescriptorRequest &msg) override
 
void bluetooth_gatt_get_services (const BluetoothGATTGetServicesRequest &msg) override
 
void bluetooth_gatt_notify (const BluetoothGATTNotifyRequest &msg) override
 
BluetoothConnectionsFreeResponse subscribe_bluetooth_connections_free (const SubscribeBluetoothConnectionsFreeRequest &msg) override
 
void send_time_request ()
 
void subscribe_voice_assistant (const SubscribeVoiceAssistantRequest &msg) override
 
void on_voice_assistant_response (const VoiceAssistantResponse &msg) override
 
void on_voice_assistant_event_response (const VoiceAssistantEventResponse &msg) override
 
void on_voice_assistant_audio (const VoiceAssistantAudio &msg) override
 
void on_voice_assistant_timer_event_response (const VoiceAssistantTimerEventResponse &msg) override
 
void on_voice_assistant_announce_request (const VoiceAssistantAnnounceRequest &msg) override
 
VoiceAssistantConfigurationResponse voice_assistant_get_configuration (const VoiceAssistantConfigurationRequest &msg) override
 
void voice_assistant_set_configuration (const VoiceAssistantSetConfiguration &msg) override
 
bool send_alarm_control_panel_state (alarm_control_panel::AlarmControlPanel *a_alarm_control_panel)
 
bool send_alarm_control_panel_info (alarm_control_panel::AlarmControlPanel *a_alarm_control_panel)
 
void alarm_control_panel_command (const AlarmControlPanelCommandRequest &msg) override
 
bool send_event (event::Event *event, std::string event_type)
 
bool send_event_info (event::Event *event)
 
bool send_update_state (update::UpdateEntity *update)
 
bool send_update_info (update::UpdateEntity *update)
 
void update_command (const UpdateCommandRequest &msg) override
 
void on_disconnect_response (const DisconnectResponse &value) override
 
void on_ping_response (const PingResponse &value) override
 
void on_home_assistant_state_response (const HomeAssistantStateResponse &msg) override
 
void on_get_time_response (const GetTimeResponse &value) override
 
HelloResponse hello (const HelloRequest &msg) override
 
ConnectResponse connect (const ConnectRequest &msg) override
 
DisconnectResponse disconnect (const DisconnectRequest &msg) override
 
PingResponse ping (const PingRequest &msg) override
 
DeviceInfoResponse device_info (const DeviceInfoRequest &msg) override
 
void list_entities (const ListEntitiesRequest &msg) override
 
void subscribe_states (const SubscribeStatesRequest &msg) override
 
void subscribe_logs (const SubscribeLogsRequest &msg) override
 
void subscribe_homeassistant_services (const SubscribeHomeassistantServicesRequest &msg) override
 
void subscribe_home_assistant_states (const SubscribeHomeAssistantStatesRequest &msg) override
 
GetTimeResponse get_time (const GetTimeRequest &msg) override
 
void execute_service (const ExecuteServiceRequest &msg) override
 
bool is_authenticated () override
 
bool is_connection_setup () override
 
void on_fatal_error () override
 
void on_unauthenticated_access () override
 
void on_no_setup_connection () override
 
ProtoWriteBuffer create_buffer () override
 
bool send_buffer (ProtoWriteBuffer buffer, uint32_t message_type) override
 
std::string get_client_combined_info () const
 
- Public Member Functions inherited from esphome::api::APIServerConnectionBase
bool send_hello_response (const HelloResponse &msg)
 
bool send_connect_response (const ConnectResponse &msg)
 
bool send_disconnect_request (const DisconnectRequest &msg)
 
bool send_disconnect_response (const DisconnectResponse &msg)
 
bool send_ping_request (const PingRequest &msg)
 
bool send_ping_response (const PingResponse &msg)
 
bool send_device_info_response (const DeviceInfoResponse &msg)
 
bool send_list_entities_done_response (const ListEntitiesDoneResponse &msg)
 
bool send_list_entities_binary_sensor_response (const ListEntitiesBinarySensorResponse &msg)
 
bool send_binary_sensor_state_response (const BinarySensorStateResponse &msg)
 
bool send_list_entities_cover_response (const ListEntitiesCoverResponse &msg)
 
bool send_cover_state_response (const CoverStateResponse &msg)
 
bool send_list_entities_fan_response (const ListEntitiesFanResponse &msg)
 
bool send_fan_state_response (const FanStateResponse &msg)
 
bool send_list_entities_light_response (const ListEntitiesLightResponse &msg)
 
bool send_light_state_response (const LightStateResponse &msg)
 
bool send_list_entities_sensor_response (const ListEntitiesSensorResponse &msg)
 
bool send_sensor_state_response (const SensorStateResponse &msg)
 
bool send_list_entities_switch_response (const ListEntitiesSwitchResponse &msg)
 
bool send_switch_state_response (const SwitchStateResponse &msg)
 
bool send_list_entities_text_sensor_response (const ListEntitiesTextSensorResponse &msg)
 
bool send_text_sensor_state_response (const TextSensorStateResponse &msg)
 
bool send_subscribe_logs_response (const SubscribeLogsResponse &msg)
 
bool send_homeassistant_service_response (const HomeassistantServiceResponse &msg)
 
bool send_subscribe_home_assistant_state_response (const SubscribeHomeAssistantStateResponse &msg)
 
bool send_get_time_request (const GetTimeRequest &msg)
 
bool send_get_time_response (const GetTimeResponse &msg)
 
bool send_list_entities_services_response (const ListEntitiesServicesResponse &msg)
 
bool send_list_entities_camera_response (const ListEntitiesCameraResponse &msg)
 
bool send_camera_image_response (const CameraImageResponse &msg)
 
bool send_list_entities_climate_response (const ListEntitiesClimateResponse &msg)
 
bool send_climate_state_response (const ClimateStateResponse &msg)
 
bool send_list_entities_number_response (const ListEntitiesNumberResponse &msg)
 
bool send_number_state_response (const NumberStateResponse &msg)
 
bool send_list_entities_select_response (const ListEntitiesSelectResponse &msg)
 
bool send_select_state_response (const SelectStateResponse &msg)
 
bool send_list_entities_lock_response (const ListEntitiesLockResponse &msg)
 
bool send_lock_state_response (const LockStateResponse &msg)
 
bool send_list_entities_button_response (const ListEntitiesButtonResponse &msg)
 
bool send_list_entities_media_player_response (const ListEntitiesMediaPlayerResponse &msg)
 
bool send_media_player_state_response (const MediaPlayerStateResponse &msg)
 
bool send_bluetooth_le_advertisement_response (const BluetoothLEAdvertisementResponse &msg)
 
bool send_bluetooth_le_raw_advertisements_response (const BluetoothLERawAdvertisementsResponse &msg)
 
bool send_bluetooth_device_connection_response (const BluetoothDeviceConnectionResponse &msg)
 
bool send_bluetooth_gatt_get_services_response (const BluetoothGATTGetServicesResponse &msg)
 
bool send_bluetooth_gatt_get_services_done_response (const BluetoothGATTGetServicesDoneResponse &msg)
 
bool send_bluetooth_gatt_read_response (const BluetoothGATTReadResponse &msg)
 
bool send_bluetooth_gatt_notify_data_response (const BluetoothGATTNotifyDataResponse &msg)
 
bool send_bluetooth_connections_free_response (const BluetoothConnectionsFreeResponse &msg)
 
bool send_bluetooth_gatt_error_response (const BluetoothGATTErrorResponse &msg)
 
bool send_bluetooth_gatt_write_response (const BluetoothGATTWriteResponse &msg)
 
bool send_bluetooth_gatt_notify_response (const BluetoothGATTNotifyResponse &msg)
 
bool send_bluetooth_device_pairing_response (const BluetoothDevicePairingResponse &msg)
 
bool send_bluetooth_device_unpairing_response (const BluetoothDeviceUnpairingResponse &msg)
 
bool send_bluetooth_device_clear_cache_response (const BluetoothDeviceClearCacheResponse &msg)
 
bool send_voice_assistant_request (const VoiceAssistantRequest &msg)
 
bool send_voice_assistant_audio (const VoiceAssistantAudio &msg)
 
bool send_voice_assistant_announce_finished (const VoiceAssistantAnnounceFinished &msg)
 
bool send_voice_assistant_configuration_response (const VoiceAssistantConfigurationResponse &msg)
 
bool send_list_entities_alarm_control_panel_response (const ListEntitiesAlarmControlPanelResponse &msg)
 
bool send_alarm_control_panel_state_response (const AlarmControlPanelStateResponse &msg)
 
bool send_list_entities_text_response (const ListEntitiesTextResponse &msg)
 
bool send_text_state_response (const TextStateResponse &msg)
 
bool send_list_entities_date_response (const ListEntitiesDateResponse &msg)
 
bool send_date_state_response (const DateStateResponse &msg)
 
bool send_list_entities_time_response (const ListEntitiesTimeResponse &msg)
 
bool send_time_state_response (const TimeStateResponse &msg)
 
bool send_list_entities_event_response (const ListEntitiesEventResponse &msg)
 
bool send_event_response (const EventResponse &msg)
 
bool send_list_entities_valve_response (const ListEntitiesValveResponse &msg)
 
bool send_valve_state_response (const ValveStateResponse &msg)
 
bool send_list_entities_date_time_response (const ListEntitiesDateTimeResponse &msg)
 
bool send_date_time_state_response (const DateTimeStateResponse &msg)
 
bool send_list_entities_update_response (const ListEntitiesUpdateResponse &msg)
 
bool send_update_state_response (const UpdateStateResponse &msg)
 

Protected Types

enum  ConnectionState { ConnectionState::WAITING_FOR_HELLO, ConnectionState::CONNECTED, ConnectionState::AUTHENTICATED }
 

Protected Member Functions

bool send_ (const void *buf, size_t len, bool force)
 
- Protected Member Functions inherited from esphome::api::APIServerConnection
void on_hello_request (const HelloRequest &msg) override
 
void on_connect_request (const ConnectRequest &msg) override
 
void on_disconnect_request (const DisconnectRequest &msg) override
 
void on_ping_request (const PingRequest &msg) override
 
void on_device_info_request (const DeviceInfoRequest &msg) override
 
void on_list_entities_request (const ListEntitiesRequest &msg) override
 
void on_subscribe_states_request (const SubscribeStatesRequest &msg) override
 
void on_subscribe_logs_request (const SubscribeLogsRequest &msg) override
 
void on_subscribe_homeassistant_services_request (const SubscribeHomeassistantServicesRequest &msg) override
 
void on_subscribe_home_assistant_states_request (const SubscribeHomeAssistantStatesRequest &msg) override
 
void on_get_time_request (const GetTimeRequest &msg) override
 
void on_execute_service_request (const ExecuteServiceRequest &msg) override
 
void on_cover_command_request (const CoverCommandRequest &msg) override
 
void on_fan_command_request (const FanCommandRequest &msg) override
 
void on_light_command_request (const LightCommandRequest &msg) override
 
void on_switch_command_request (const SwitchCommandRequest &msg) override
 
void on_camera_image_request (const CameraImageRequest &msg) override
 
void on_climate_command_request (const ClimateCommandRequest &msg) override
 
void on_number_command_request (const NumberCommandRequest &msg) override
 
void on_text_command_request (const TextCommandRequest &msg) override
 
void on_select_command_request (const SelectCommandRequest &msg) override
 
void on_button_command_request (const ButtonCommandRequest &msg) override
 
void on_lock_command_request (const LockCommandRequest &msg) override
 
void on_valve_command_request (const ValveCommandRequest &msg) override
 
void on_media_player_command_request (const MediaPlayerCommandRequest &msg) override
 
void on_date_command_request (const DateCommandRequest &msg) override
 
void on_time_command_request (const TimeCommandRequest &msg) override
 
void on_date_time_command_request (const DateTimeCommandRequest &msg) override
 
void on_update_command_request (const UpdateCommandRequest &msg) override
 
void on_subscribe_bluetooth_le_advertisements_request (const SubscribeBluetoothLEAdvertisementsRequest &msg) override
 
void on_bluetooth_device_request (const BluetoothDeviceRequest &msg) override
 
void on_bluetooth_gatt_get_services_request (const BluetoothGATTGetServicesRequest &msg) override
 
void on_bluetooth_gatt_read_request (const BluetoothGATTReadRequest &msg) override
 
void on_bluetooth_gatt_write_request (const BluetoothGATTWriteRequest &msg) override
 
void on_bluetooth_gatt_read_descriptor_request (const BluetoothGATTReadDescriptorRequest &msg) override
 
void on_bluetooth_gatt_write_descriptor_request (const BluetoothGATTWriteDescriptorRequest &msg) override
 
void on_bluetooth_gatt_notify_request (const BluetoothGATTNotifyRequest &msg) override
 
void on_subscribe_bluetooth_connections_free_request (const SubscribeBluetoothConnectionsFreeRequest &msg) override
 
void on_unsubscribe_bluetooth_le_advertisements_request (const UnsubscribeBluetoothLEAdvertisementsRequest &msg) override
 
void on_subscribe_voice_assistant_request (const SubscribeVoiceAssistantRequest &msg) override
 
void on_voice_assistant_configuration_request (const VoiceAssistantConfigurationRequest &msg) override
 
void on_voice_assistant_set_configuration (const VoiceAssistantSetConfiguration &msg) override
 
void on_alarm_control_panel_command_request (const AlarmControlPanelCommandRequest &msg) override
 
- Protected Member Functions inherited from esphome::api::APIServerConnectionBase
bool read_message (uint32_t msg_size, uint32_t msg_type, uint8_t *msg_data) override
 
- Protected Member Functions inherited from esphome::api::ProtoService
template<class C >
bool send_message_ (const C &msg, uint32_t message_type)
 

Protected Attributes

friend APIServer
 
enum esphome::api::APIConnection::ConnectionState WAITING_FOR_HELLO
 
bool remove_ {false}
 
std::vector< uint8_t > proto_write_buffer_
 
std::unique_ptr< APIFrameHelperhelper_
 
std::string client_info_
 
std::string client_peername_
 
std::string client_combined_info_
 
uint32_t client_api_version_major_ {0}
 
uint32_t client_api_version_minor_ {0}
 
esp32_camera::CameraImageReader image_reader_
 
bool state_subscription_ {false}
 
int log_subscription_ {ESPHOME_LOG_LEVEL_NONE}
 
uint32_t last_traffic_
 
uint32_t next_ping_retry_ {0}
 
uint8_t ping_retries_ {0}
 
bool sent_ping_ {false}
 
bool service_call_subscription_ {false}
 
bool next_close_ = false
 
APIServerparent_
 
InitialStateIterator initial_state_iterator_
 
ListEntitiesIterator list_entities_iterator_
 
int state_subs_at_ = -1
 

Detailed Description

Definition at line 17 of file api_connection.h.

Member Enumeration Documentation

◆ ConnectionState

Enumerator
WAITING_FOR_HELLO 
CONNECTED 
AUTHENTICATED 

Definition at line 234 of file api_connection.h.

Constructor & Destructor Documentation

◆ APIConnection()

esphome::api::APIConnection::APIConnection ( std::unique_ptr< socket::Socket socket,
APIServer parent 
)

Definition at line 31 of file api_connection.cpp.

◆ ~APIConnection()

esphome::api::APIConnection::~APIConnection ( )
virtual

Definition at line 58 of file api_connection.cpp.

Member Function Documentation

◆ alarm_control_panel_command()

void esphome::api::APIConnection::alarm_control_panel_command ( const AlarmControlPanelCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1290 of file api_connection.cpp.

◆ bluetooth_device_request()

void esphome::api::APIConnection::bluetooth_device_request ( const BluetoothDeviceRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1131 of file api_connection.cpp.

◆ bluetooth_gatt_get_services()

void esphome::api::APIConnection::bluetooth_gatt_get_services ( const BluetoothGATTGetServicesRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1146 of file api_connection.cpp.

◆ bluetooth_gatt_notify()

void esphome::api::APIConnection::bluetooth_gatt_notify ( const BluetoothGATTNotifyRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1150 of file api_connection.cpp.

◆ bluetooth_gatt_read()

void esphome::api::APIConnection::bluetooth_gatt_read ( const BluetoothGATTReadRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1134 of file api_connection.cpp.

◆ bluetooth_gatt_read_descriptor()

void esphome::api::APIConnection::bluetooth_gatt_read_descriptor ( const BluetoothGATTReadDescriptorRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1140 of file api_connection.cpp.

◆ bluetooth_gatt_write()

void esphome::api::APIConnection::bluetooth_gatt_write ( const BluetoothGATTWriteRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1137 of file api_connection.cpp.

◆ bluetooth_gatt_write_descriptor()

void esphome::api::APIConnection::bluetooth_gatt_write_descriptor ( const BluetoothGATTWriteDescriptorRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1143 of file api_connection.cpp.

◆ button_command()

void esphome::api::APIConnection::button_command ( const ButtonCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 905 of file api_connection.cpp.

◆ camera_image()

void esphome::api::APIConnection::camera_image ( const CameraImageRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1086 of file api_connection.cpp.

◆ climate_command()

void esphome::api::APIConnection::climate_command ( const ClimateCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 631 of file api_connection.cpp.

◆ connect()

ConnectResponse esphome::api::APIConnection::connect ( const ConnectRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1439 of file api_connection.cpp.

◆ cover_command()

void esphome::api::APIConnection::cover_command ( const CoverCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 269 of file api_connection.cpp.

◆ create_buffer()

ProtoWriteBuffer esphome::api::APIConnection::create_buffer ( )
inlineoverridevirtual

Implements esphome::api::ProtoService.

Definition at line 220 of file api_connection.h.

◆ date_command()

void esphome::api::APIConnection::date_command ( const DateCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 729 of file api_connection.cpp.

◆ datetime_command()

void esphome::api::APIConnection::datetime_command ( const DateTimeCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 804 of file api_connection.cpp.

◆ device_info()

DeviceInfoResponse esphome::api::APIConnection::device_info ( const DeviceInfoRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1457 of file api_connection.cpp.

◆ disconnect()

DisconnectResponse esphome::api::APIConnection::disconnect ( const DisconnectRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 195 of file api_connection.cpp.

◆ execute_service()

void esphome::api::APIConnection::execute_service ( const ExecuteServiceRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1505 of file api_connection.cpp.

◆ fan_command()

void esphome::api::APIConnection::fan_command ( const FanCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 337 of file api_connection.cpp.

◆ get_client_combined_info()

std::string esphome::api::APIConnection::get_client_combined_info ( ) const
inline

Definition at line 227 of file api_connection.h.

◆ get_time()

GetTimeResponse esphome::api::APIConnection::get_time ( const GetTimeRequest msg)
inlineoverridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 207 of file api_connection.h.

◆ hello()

HelloResponse esphome::api::APIConnection::hello ( const HelloRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1420 of file api_connection.cpp.

◆ is_authenticated()

bool esphome::api::APIConnection::is_authenticated ( )
inlineoverridevirtual

Implements esphome::api::ProtoService.

Definition at line 213 of file api_connection.h.

◆ is_connection_setup()

bool esphome::api::APIConnection::is_connection_setup ( )
inlineoverridevirtual

Implements esphome::api::ProtoService.

Definition at line 214 of file api_connection.h.

◆ light_command()

void esphome::api::APIConnection::light_command ( const LightCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 420 of file api_connection.cpp.

◆ list_entities()

void esphome::api::APIConnection::list_entities ( const ListEntitiesRequest msg)
inlineoverridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 193 of file api_connection.h.

◆ lock_command()

void esphome::api::APIConnection::lock_command ( const LockCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 939 of file api_connection.cpp.

◆ loop()

void esphome::api::APIConnection::loop ( )

Definition at line 71 of file api_connection.cpp.

◆ media_player_command()

void esphome::api::APIConnection::media_player_command ( const MediaPlayerCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1042 of file api_connection.cpp.

◆ number_command()

void esphome::api::APIConnection::number_command ( const NumberCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 692 of file api_connection.cpp.

◆ on_disconnect_response()

void esphome::api::APIConnection::on_disconnect_response ( const DisconnectResponse value)
overridevirtual

Reimplemented from esphome::api::APIServerConnectionBase.

Definition at line 204 of file api_connection.cpp.

◆ on_fatal_error()

void esphome::api::APIConnection::on_fatal_error ( )
overridevirtual

Implements esphome::api::ProtoService.

Definition at line 1565 of file api_connection.cpp.

◆ on_get_time_response()

void esphome::api::APIConnection::on_get_time_response ( const GetTimeResponse value)
overridevirtual

Reimplemented from esphome::api::APIServerConnectionBase.

Definition at line 1103 of file api_connection.cpp.

◆ on_home_assistant_state_response()

void esphome::api::APIConnection::on_home_assistant_state_response ( const HomeAssistantStateResponse msg)
overridevirtual

Reimplemented from esphome::api::APIServerConnectionBase.

Definition at line 1498 of file api_connection.cpp.

◆ on_no_setup_connection()

void esphome::api::APIConnection::on_no_setup_connection ( )
overridevirtual

Implements esphome::api::ProtoService.

Definition at line 1561 of file api_connection.cpp.

◆ on_ping_response()

void esphome::api::APIConnection::on_ping_response ( const PingResponse value)
inlineoverridevirtual

Reimplemented from esphome::api::APIServerConnectionBase.

Definition at line 179 of file api_connection.h.

◆ on_unauthenticated_access()

void esphome::api::APIConnection::on_unauthenticated_access ( )
overridevirtual

Implements esphome::api::ProtoService.

Definition at line 1557 of file api_connection.cpp.

◆ on_voice_assistant_announce_request()

void esphome::api::APIConnection::on_voice_assistant_announce_request ( const VoiceAssistantAnnounceRequest msg)
overridevirtual

Reimplemented from esphome::api::APIServerConnectionBase.

Definition at line 1218 of file api_connection.cpp.

◆ on_voice_assistant_audio()

void esphome::api::APIConnection::on_voice_assistant_audio ( const VoiceAssistantAudio msg)
overridevirtual

Reimplemented from esphome::api::APIServerConnectionBase.

Definition at line 1199 of file api_connection.cpp.

◆ on_voice_assistant_event_response()

void esphome::api::APIConnection::on_voice_assistant_event_response ( const VoiceAssistantEventResponse msg)
overridevirtual

Reimplemented from esphome::api::APIServerConnectionBase.

Definition at line 1190 of file api_connection.cpp.

◆ on_voice_assistant_response()

void esphome::api::APIConnection::on_voice_assistant_response ( const VoiceAssistantResponse msg)
overridevirtual

Reimplemented from esphome::api::APIServerConnectionBase.

Definition at line 1169 of file api_connection.cpp.

◆ on_voice_assistant_timer_event_response()

void esphome::api::APIConnection::on_voice_assistant_timer_event_response ( const VoiceAssistantTimerEventResponse msg)
overridevirtual

Reimplemented from esphome::api::APIServerConnectionBase.

Definition at line 1208 of file api_connection.cpp.

◆ ping()

PingResponse esphome::api::APIConnection::ping ( const PingRequest msg)
inlineoverridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 191 of file api_connection.h.

◆ select_command()

void esphome::api::APIConnection::select_command ( const SelectCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 880 of file api_connection.cpp.

◆ send_()

bool esphome::api::APIConnection::send_ ( const void *  buf,
size_t  len,
bool  force 
)
protected

◆ send_alarm_control_panel_info()

bool esphome::api::APIConnection::send_alarm_control_panel_info ( alarm_control_panel::AlarmControlPanel a_alarm_control_panel)

Definition at line 1276 of file api_connection.cpp.

◆ send_alarm_control_panel_state()

bool esphome::api::APIConnection::send_alarm_control_panel_state ( alarm_control_panel::AlarmControlPanel a_alarm_control_panel)

Definition at line 1267 of file api_connection.cpp.

◆ send_binary_sensor_info()

bool esphome::api::APIConnection::send_binary_sensor_info ( binary_sensor::BinarySensor binary_sensor)

Definition at line 219 of file api_connection.cpp.

◆ send_binary_sensor_state()

bool esphome::api::APIConnection::send_binary_sensor_state ( binary_sensor::BinarySensor binary_sensor,
bool  state 
)

Definition at line 209 of file api_connection.cpp.

◆ send_bluetooth_le_advertisement()

bool esphome::api::APIConnection::send_bluetooth_le_advertisement ( const BluetoothLEAdvertisementResponse msg)

Definition at line 1116 of file api_connection.cpp.

◆ send_buffer()

bool esphome::api::APIConnection::send_buffer ( ProtoWriteBuffer  buffer,
uint32_t  message_type 
)
overridevirtual

Implements esphome::api::ProtoService.

Definition at line 1519 of file api_connection.cpp.

◆ send_button_info()

bool esphome::api::APIConnection::send_button_info ( button::Button button)

Definition at line 892 of file api_connection.cpp.

◆ send_camera_info()

bool esphome::api::APIConnection::send_camera_info ( esp32_camera::ESP32Camera camera)

Definition at line 1074 of file api_connection.cpp.

◆ send_camera_state()

void esphome::api::APIConnection::send_camera_state ( std::shared_ptr< esp32_camera::CameraImage image)

Definition at line 1065 of file api_connection.cpp.

◆ send_climate_info()

bool esphome::api::APIConnection::send_climate_info ( climate::Climate climate)

Definition at line 588 of file api_connection.cpp.

◆ send_climate_state()

bool esphome::api::APIConnection::send_climate_state ( climate::Climate climate)

Definition at line 554 of file api_connection.cpp.

◆ send_cover_info()

bool esphome::api::APIConnection::send_cover_info ( cover::Cover cover)

Definition at line 251 of file api_connection.cpp.

◆ send_cover_state()

bool esphome::api::APIConnection::send_cover_state ( cover::Cover cover)

Definition at line 236 of file api_connection.cpp.

◆ send_date_info()

bool esphome::api::APIConnection::send_date_info ( datetime::DateEntity date)

Definition at line 716 of file api_connection.cpp.

◆ send_date_state()

bool esphome::api::APIConnection::send_date_state ( datetime::DateEntity date)

Definition at line 704 of file api_connection.cpp.

◆ send_datetime_info()

bool esphome::api::APIConnection::send_datetime_info ( datetime::DateTimeEntity datetime)

Definition at line 791 of file api_connection.cpp.

◆ send_datetime_state()

bool esphome::api::APIConnection::send_datetime_state ( datetime::DateTimeEntity datetime)

Definition at line 778 of file api_connection.cpp.

◆ send_event()

bool esphome::api::APIConnection::send_event ( event::Event event,
std::string  event_type 
)

Definition at line 1325 of file api_connection.cpp.

◆ send_event_info()

bool esphome::api::APIConnection::send_event_info ( event::Event event)

Definition at line 1331 of file api_connection.cpp.

◆ send_fan_info()

bool esphome::api::APIConnection::send_fan_info ( fan::Fan fan)

Definition at line 318 of file api_connection.cpp.

◆ send_fan_state()

bool esphome::api::APIConnection::send_fan_state ( fan::Fan fan)

Definition at line 299 of file api_connection.cpp.

◆ send_homeassistant_service_call()

void esphome::api::APIConnection::send_homeassistant_service_call ( const HomeassistantServiceResponse call)
inline

Definition at line 121 of file api_connection.h.

◆ send_light_info()

bool esphome::api::APIConnection::send_light_info ( light::LightState light)

Definition at line 385 of file api_connection.cpp.

◆ send_light_state()

bool esphome::api::APIConnection::send_light_state ( light::LightState light)

Definition at line 360 of file api_connection.cpp.

◆ send_list_info_done()

bool esphome::api::APIConnection::send_list_info_done ( )
inline

Definition at line 25 of file api_connection.h.

◆ send_lock_info()

bool esphome::api::APIConnection::send_lock_info ( lock::Lock a_lock)

Definition at line 924 of file api_connection.cpp.

◆ send_lock_state()

bool esphome::api::APIConnection::send_lock_state ( lock::Lock a_lock,
lock::LockState  state 
)

Definition at line 915 of file api_connection.cpp.

◆ send_log_message()

bool esphome::api::APIConnection::send_log_message ( int  level,
const char *  tag,
const char *  line 
)

Definition at line 1406 of file api_connection.cpp.

◆ send_media_player_info()

bool esphome::api::APIConnection::send_media_player_info ( media_player::MediaPlayer media_player)

Definition at line 1016 of file api_connection.cpp.

◆ send_media_player_state()

bool esphome::api::APIConnection::send_media_player_state ( media_player::MediaPlayer media_player)

Definition at line 1001 of file api_connection.cpp.

◆ send_number_info()

bool esphome::api::APIConnection::send_number_info ( number::Number number)

Definition at line 672 of file api_connection.cpp.

◆ send_number_state()

bool esphome::api::APIConnection::send_number_state ( number::Number number,
float  state 
)

Definition at line 662 of file api_connection.cpp.

◆ send_select_info()

bool esphome::api::APIConnection::send_select_info ( select::Select select)

Definition at line 864 of file api_connection.cpp.

◆ send_select_state()

bool esphome::api::APIConnection::send_select_state ( select::Select select,
std::string  state 
)

Definition at line 854 of file api_connection.cpp.

◆ send_sensor_info()

bool esphome::api::APIConnection::send_sensor_info ( sensor::Sensor sensor)

Definition at line 468 of file api_connection.cpp.

◆ send_sensor_state()

bool esphome::api::APIConnection::send_sensor_state ( sensor::Sensor sensor,
float  state 
)

Definition at line 458 of file api_connection.cpp.

◆ send_switch_info()

bool esphome::api::APIConnection::send_switch_info ( switch_::Switch a_switch)

Definition at line 499 of file api_connection.cpp.

◆ send_switch_state()

bool esphome::api::APIConnection::send_switch_state ( switch_::Switch a_switch,
bool  state 
)

Definition at line 490 of file api_connection.cpp.

◆ send_text_info()

bool esphome::api::APIConnection::send_text_info ( text::Text text)

Definition at line 826 of file api_connection.cpp.

◆ send_text_sensor_info()

bool esphome::api::APIConnection::send_text_sensor_info ( text_sensor::TextSensor text_sensor)

Definition at line 537 of file api_connection.cpp.

◆ send_text_sensor_state()

bool esphome::api::APIConnection::send_text_sensor_state ( text_sensor::TextSensor text_sensor,
std::string  state 
)

Definition at line 527 of file api_connection.cpp.

◆ send_text_state()

bool esphome::api::APIConnection::send_text_state ( text::Text text,
std::string  state 
)

Definition at line 816 of file api_connection.cpp.

◆ send_time_info()

bool esphome::api::APIConnection::send_time_info ( datetime::TimeEntity time)

Definition at line 753 of file api_connection.cpp.

◆ send_time_request()

void esphome::api::APIConnection::send_time_request ( )
inline

Definition at line 143 of file api_connection.h.

◆ send_time_state()

bool esphome::api::APIConnection::send_time_state ( datetime::TimeEntity time)

Definition at line 741 of file api_connection.cpp.

◆ send_update_info()

bool esphome::api::APIConnection::send_update_info ( update::UpdateEntity update)

Definition at line 1371 of file api_connection.cpp.

◆ send_update_state()

bool esphome::api::APIConnection::send_update_state ( update::UpdateEntity update)

Definition at line 1349 of file api_connection.cpp.

◆ send_valve_info()

bool esphome::api::APIConnection::send_valve_info ( valve::Valve valve)

Definition at line 969 of file api_connection.cpp.

◆ send_valve_state()

bool esphome::api::APIConnection::send_valve_state ( valve::Valve valve)

Definition at line 959 of file api_connection.cpp.

◆ start()

void esphome::api::APIConnection::start ( )

Definition at line 43 of file api_connection.cpp.

◆ subscribe_bluetooth_connections_free()

BluetoothConnectionsFreeResponse esphome::api::APIConnection::subscribe_bluetooth_connections_free ( const SubscribeBluetoothConnectionsFreeRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1154 of file api_connection.cpp.

◆ subscribe_bluetooth_le_advertisements()

void esphome::api::APIConnection::subscribe_bluetooth_le_advertisements ( const SubscribeBluetoothLEAdvertisementsRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1110 of file api_connection.cpp.

◆ subscribe_home_assistant_states()

void esphome::api::APIConnection::subscribe_home_assistant_states ( const SubscribeHomeAssistantStatesRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1516 of file api_connection.cpp.

◆ subscribe_homeassistant_services()

void esphome::api::APIConnection::subscribe_homeassistant_services ( const SubscribeHomeassistantServicesRequest msg)
inlineoverridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 203 of file api_connection.h.

◆ subscribe_logs()

void esphome::api::APIConnection::subscribe_logs ( const SubscribeLogsRequest msg)
inlineoverridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 198 of file api_connection.h.

◆ subscribe_states()

void esphome::api::APIConnection::subscribe_states ( const SubscribeStatesRequest msg)
inlineoverridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 194 of file api_connection.h.

◆ subscribe_voice_assistant()

void esphome::api::APIConnection::subscribe_voice_assistant ( const SubscribeVoiceAssistantRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1164 of file api_connection.cpp.

◆ switch_command()

void esphome::api::APIConnection::switch_command ( const SwitchCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 513 of file api_connection.cpp.

◆ text_command()

void esphome::api::APIConnection::text_command ( const TextCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 842 of file api_connection.cpp.

◆ time_command()

void esphome::api::APIConnection::time_command ( const TimeCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 766 of file api_connection.cpp.

◆ unsubscribe_bluetooth_le_advertisements()

void esphome::api::APIConnection::unsubscribe_bluetooth_le_advertisements ( const UnsubscribeBluetoothLEAdvertisementsRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1113 of file api_connection.cpp.

◆ update_command()

void esphome::api::APIConnection::update_command ( const UpdateCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1384 of file api_connection.cpp.

◆ valve_command()

void esphome::api::APIConnection::valve_command ( const ValveCommandRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 986 of file api_connection.cpp.

◆ voice_assistant_get_configuration()

VoiceAssistantConfigurationResponse esphome::api::APIConnection::voice_assistant_get_configuration ( const VoiceAssistantConfigurationRequest msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1228 of file api_connection.cpp.

◆ voice_assistant_set_configuration()

void esphome::api::APIConnection::voice_assistant_set_configuration ( const VoiceAssistantSetConfiguration msg)
overridevirtual

Implements esphome::api::APIServerConnection.

Definition at line 1254 of file api_connection.cpp.

Field Documentation

◆ APIServer

friend esphome::api::APIConnection::APIServer
protected

Definition at line 230 of file api_connection.h.

◆ client_api_version_major_

uint32_t esphome::api::APIConnection::client_api_version_major_ {0}
protected

Definition at line 250 of file api_connection.h.

◆ client_api_version_minor_

uint32_t esphome::api::APIConnection::client_api_version_minor_ {0}
protected

Definition at line 251 of file api_connection.h.

◆ client_combined_info_

std::string esphome::api::APIConnection::client_combined_info_
protected

Definition at line 249 of file api_connection.h.

◆ client_info_

std::string esphome::api::APIConnection::client_info_
protected

Definition at line 247 of file api_connection.h.

◆ client_peername_

std::string esphome::api::APIConnection::client_peername_
protected

Definition at line 248 of file api_connection.h.

◆ helper_

std::unique_ptr<APIFrameHelper> esphome::api::APIConnection::helper_
protected

Definition at line 245 of file api_connection.h.

◆ image_reader_

esp32_camera::CameraImageReader esphome::api::APIConnection::image_reader_
protected

Definition at line 253 of file api_connection.h.

◆ initial_state_iterator_

InitialStateIterator esphome::api::APIConnection::initial_state_iterator_
protected

Definition at line 265 of file api_connection.h.

◆ last_traffic_

uint32_t esphome::api::APIConnection::last_traffic_
protected

Definition at line 258 of file api_connection.h.

◆ list_entities_iterator_

ListEntitiesIterator esphome::api::APIConnection::list_entities_iterator_
protected

Definition at line 266 of file api_connection.h.

◆ log_subscription_

int esphome::api::APIConnection::log_subscription_ {ESPHOME_LOG_LEVEL_NONE}
protected

Definition at line 257 of file api_connection.h.

◆ next_close_

bool esphome::api::APIConnection::next_close_ = false
protected

Definition at line 263 of file api_connection.h.

◆ next_ping_retry_

uint32_t esphome::api::APIConnection::next_ping_retry_ {0}
protected

Definition at line 259 of file api_connection.h.

◆ parent_

APIServer* esphome::api::APIConnection::parent_
protected

Definition at line 264 of file api_connection.h.

◆ ping_retries_

uint8_t esphome::api::APIConnection::ping_retries_ {0}
protected

Definition at line 260 of file api_connection.h.

◆ proto_write_buffer_

std::vector<uint8_t> esphome::api::APIConnection::proto_write_buffer_
protected

Definition at line 244 of file api_connection.h.

◆ remove_

bool esphome::api::APIConnection::remove_ {false}
protected

Definition at line 240 of file api_connection.h.

◆ sent_ping_

bool esphome::api::APIConnection::sent_ping_ {false}
protected

Definition at line 261 of file api_connection.h.

◆ service_call_subscription_

bool esphome::api::APIConnection::service_call_subscription_ {false}
protected

Definition at line 262 of file api_connection.h.

◆ state_subs_at_

int esphome::api::APIConnection::state_subs_at_ = -1
protected

Definition at line 267 of file api_connection.h.

◆ state_subscription_

bool esphome::api::APIConnection::state_subscription_ {false}
protected

Definition at line 256 of file api_connection.h.

◆ WAITING_FOR_HELLO

enum esphome::api::APIConnection::ConnectionState esphome::api::APIConnection::WAITING_FOR_HELLO
protected

The documentation for this class was generated from the following files: