ESPHome
2023.11.6
|
#include <api_server.h>
Data Structures | |
struct | HomeAssistantStateSubscription |
Public Member Functions | |
APIServer () | |
void | setup () override |
uint16_t | get_port () const |
float | get_setup_priority () const override |
void | loop () override |
void | dump_config () override |
void | on_shutdown () override |
bool | check_password (const std::string &password) const |
bool | uses_password () const |
void | set_port (uint16_t port) |
void | set_password (const std::string &password) |
void | set_reboot_timeout (uint32_t reboot_timeout) |
void | set_noise_psk (psk_t psk) |
std::shared_ptr< APINoiseContext > | get_noise_ctx () |
void | handle_disconnect (APIConnection *conn) |
void | on_binary_sensor_update (binary_sensor::BinarySensor *obj, bool state) override |
void | on_cover_update (cover::Cover *obj) override |
void | on_fan_update (fan::Fan *obj) override |
void | on_light_update (light::LightState *obj) override |
void | on_sensor_update (sensor::Sensor *obj, float state) override |
void | on_switch_update (switch_::Switch *obj, bool state) override |
void | on_text_sensor_update (text_sensor::TextSensor *obj, const std::string &state) override |
void | on_climate_update (climate::Climate *obj) override |
void | on_number_update (number::Number *obj, float state) override |
void | on_text_update (text::Text *obj, const std::string &state) override |
void | on_select_update (select::Select *obj, const std::string &state, size_t index) override |
void | on_lock_update (lock::Lock *obj) override |
void | on_media_player_update (media_player::MediaPlayer *obj) override |
void | send_homeassistant_service_call (const HomeassistantServiceResponse &call) |
void | register_user_service (UserServiceDescriptor *descriptor) |
void | request_time () |
void | on_alarm_control_panel_update (alarm_control_panel::AlarmControlPanel *obj) override |
bool | is_connected () const |
void | subscribe_home_assistant_state (std::string entity_id, optional< std::string > attribute, std::function< void(std::string)> f) |
const std::vector< HomeAssistantStateSubscription > & | get_state_subs () const |
const std::vector< UserServiceDescriptor * > & | get_user_services () const |
Trigger< std::string, std::string > * | get_client_connected_trigger () const |
Trigger< std::string, std::string > * | get_client_disconnected_trigger () const |
![]() | |
float | get_actual_setup_priority () const |
void | set_setup_priority (float priority) |
virtual float | get_loop_priority () const |
priority of loop(). More... | |
void | call () |
virtual void | on_safe_shutdown () |
uint32_t | get_component_state () const |
virtual void | mark_failed () |
Mark this component as failed. More... | |
bool | is_failed () |
bool | is_ready () |
virtual bool | can_proceed () |
bool | status_has_warning () |
bool | status_has_error () |
void | status_set_warning () |
void | status_set_error () |
void | status_clear_warning () |
void | status_clear_error () |
void | status_momentary_warning (const std::string &name, uint32_t length=5000) |
void | status_momentary_error (const std::string &name, uint32_t length=5000) |
bool | has_overridden_loop () const |
void | set_component_source (const char *source) |
Set where this component was loaded from for some debug messages. More... | |
const char * | get_component_source () const |
Get the integration where this component was declared as a string. More... | |
![]() | |
void | setup_controller (bool include_internal=false) |
Protected Attributes | |
std::unique_ptr< socket::Socket > | socket_ = nullptr |
uint16_t | port_ {6053} |
uint32_t | reboot_timeout_ {300000} |
uint32_t | last_connected_ {0} |
std::vector< std::unique_ptr< APIConnection > > | clients_ |
std::string | password_ |
std::vector< HomeAssistantStateSubscription > | state_subs_ |
std::vector< UserServiceDescriptor * > | user_services_ |
Trigger< std::string, std::string > * | client_connected_trigger_ = new Trigger<std::string, std::string>() |
Trigger< std::string, std::string > * | client_disconnected_trigger_ = new Trigger<std::string, std::string>() |
std::shared_ptr< APINoiseContext > | noise_ctx_ = std::make_shared<APINoiseContext>() |
![]() | |
uint32_t | component_state_ {0x0000} |
State of this component. More... | |
float | setup_priority_override_ {NAN} |
const char * | component_source_ {nullptr} |
Additional Inherited Members | |
![]() | |
virtual void | call_loop () |
virtual void | call_setup () |
virtual void | call_dump_config () |
void | set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f) |
Set an interval function with a unique name. More... | |
void | set_interval (uint32_t interval, std::function< void()> &&f) |
bool | cancel_interval (const std::string &name) |
Cancel an interval function. More... | |
void | set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
Set an retry function with a unique name. More... | |
void | set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
bool | cancel_retry (const std::string &name) |
Cancel a retry function. More... | |
void | set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f) |
Set a timeout function with a unique name. More... | |
void | set_timeout (uint32_t timeout, std::function< void()> &&f) |
bool | cancel_timeout (const std::string &name) |
Cancel a timeout function. More... | |
void | defer (const std::string &name, std::function< void()> &&f) |
Defer a callback to the next loop() call. More... | |
void | defer (std::function< void()> &&f) |
Defer a callback to the next loop() call. More... | |
bool | cancel_defer (const std::string &name) |
Cancel a defer callback using the specified name, name must not be empty. More... | |
Definition at line 21 of file api_server.h.
esphome::api::APIServer::APIServer | ( | ) |
Definition at line 305 of file api_server.cpp.
bool esphome::api::APIServer::check_password | ( | const std::string & | password | ) | const |
Definition at line 148 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 138 of file api_server.cpp.
|
inline |
Definition at line 104 of file api_server.h.
|
inline |
Definition at line 105 of file api_server.h.
|
inline |
Definition at line 38 of file api_server.h.
uint16_t esphome::api::APIServer::get_port | ( | ) | const |
Definition at line 317 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 294 of file api_server.cpp.
const std::vector< APIServer::HomeAssistantStateSubscription > & esphome::api::APIServer::get_state_subs | ( | ) | const |
Definition at line 314 of file api_server.cpp.
|
inline |
Definition at line 102 of file api_server.h.
void esphome::api::APIServer::handle_disconnect | ( | APIConnection * | conn | ) |
Definition at line 176 of file api_server.cpp.
bool esphome::api::APIServer::is_connected | ( | ) | const |
Definition at line 327 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 94 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 336 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 178 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 241 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 187 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 196 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 205 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 277 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 286 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 250 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 268 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 214 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 328 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 223 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 232 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 259 of file api_server.cpp.
|
inline |
Definition at line 82 of file api_server.h.
void esphome::api::APIServer::request_time | ( | ) |
Definition at line 320 of file api_server.cpp.
void esphome::api::APIServer::send_homeassistant_service_call | ( | const HomeassistantServiceResponse & | call | ) |
Definition at line 299 of file api_server.cpp.
|
inline |
Definition at line 37 of file api_server.h.
void esphome::api::APIServer::set_password | ( | const std::string & | password | ) |
Definition at line 298 of file api_server.cpp.
void esphome::api::APIServer::set_port | ( | uint16_t | port | ) |
Definition at line 295 of file api_server.cpp.
void esphome::api::APIServer::set_reboot_timeout | ( | uint32_t | reboot_timeout | ) |
Definition at line 318 of file api_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 24 of file api_server.cpp.
void esphome::api::APIServer::subscribe_home_assistant_state | ( | std::string | entity_id, |
optional< std::string > | attribute, | ||
std::function< void(std::string)> | f | ||
) |
Definition at line 306 of file api_server.cpp.
bool esphome::api::APIServer::uses_password | ( | ) | const |
Definition at line 147 of file api_server.cpp.
|
protected |
Definition at line 118 of file api_server.h.
|
protected |
Definition at line 119 of file api_server.h.
|
protected |
Definition at line 114 of file api_server.h.
|
protected |
Definition at line 113 of file api_server.h.
|
protected |
Definition at line 122 of file api_server.h.
|
protected |
Definition at line 115 of file api_server.h.
|
protected |
Definition at line 111 of file api_server.h.
|
protected |
Definition at line 112 of file api_server.h.
|
protected |
Definition at line 110 of file api_server.h.
|
protected |
Definition at line 116 of file api_server.h.
|
protected |
Definition at line 117 of file api_server.h.