26#ifdef USE_API_USER_DEFINED_ACTIONS
28class UserServiceDescriptor;
50 void setup()
override;
58 void on_log(uint8_t level,
const char *tag,
const char *
message,
size_t message_len)
override;
61 void on_camera_image(
const std::shared_ptr<camera::CameraImage> &image)
override;
63#ifdef USE_API_PASSWORD
64 bool check_password(
const uint8_t *password_data,
size_t password_len)
const;
85#ifdef USE_BINARY_SENSOR
103#ifdef USE_TEXT_SENSOR
112#ifdef USE_DATETIME_DATE
115#ifdef USE_DATETIME_TIME
118#ifdef USE_DATETIME_DATETIME
133#ifdef USE_MEDIA_PLAYER
136#ifdef USE_API_HOMEASSISTANT_SERVICES
139#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
144#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
146 const uint8_t *response_data,
size_t response_data_len);
150#ifdef USE_API_USER_DEFINED_ACTIONS
154#ifdef USE_API_CUSTOM_SERVICES
158#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES
165 void send_action_response(uint32_t action_call_id,
bool success,
const std::string &error_message);
166#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES_JSON
167 void send_action_response(uint32_t action_call_id,
bool success,
const std::string &error_message,
168 const uint8_t *response_data,
size_t response_data_len);
172#ifdef USE_HOMEASSISTANT_TIME
176#ifdef USE_ALARM_CONTROL_PANEL
185#ifdef USE_ZWAVE_PROXY
189 bool is_connected(
bool state_subscription_only =
false)
const;
191#ifdef USE_API_HOMEASSISTANT_STATES
210 std::function<
void(std::string)> f);
212 std::function<
void(std::string)> f);
214 const std::vector<HomeAssistantStateSubscription> &
get_state_subs()
const;
216#ifdef USE_API_USER_DEFINED_ACTIONS
220#ifdef USE_API_CLIENT_CONNECTED_TRIGGER
223#ifdef USE_API_CLIENT_DISCONNECTED_TRIGGER
232 const psk_t &active_psk,
bool make_active);
234#ifdef USE_API_HOMEASSISTANT_STATES
239 std::function<
void(std::string)> f,
bool once);
242 std::unique_ptr<socket::Socket>
socket_ =
nullptr;
243#ifdef USE_API_CLIENT_CONNECTED_TRIGGER
246#ifdef USE_API_CLIENT_DISCONNECTED_TRIGGER
255 std::vector<std::unique_ptr<APIConnection>>
clients_;
256#ifdef USE_API_PASSWORD
260#ifdef USE_API_HOMEASSISTANT_STATES
263#ifdef USE_API_USER_DEFINED_ACTIONS
265#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES
277#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
304 TEMPLATABLE_VALUE(
bool, state_subscription_only)
306 bool check(
const Ts &...
x)
override {
Base class for all automation conditions.
virtual bool check(const Ts &...x)=0
void get_home_assistant_state(const char *entity_id, const char *attribute, std::function< void(std::string)> f)
void on_valve_update(valve::Valve *obj) override
uint16_t get_batch_delay() const
void on_switch_update(switch_::Switch *obj) override
void register_action_response_callback(uint32_t call_id, ActionResponseCallback callback)
std::vector< std::unique_ptr< APIConnection > > clients_
void set_password(const std::string &password)
void on_time_update(datetime::TimeEntity *obj) override
void on_cover_update(cover::Cover *obj) override
void on_camera_image(const std::shared_ptr< camera::CameraImage > &image) override
std::vector< UserServiceDescriptor * > user_services_
void on_light_update(light::LightState *obj) override
void on_media_player_update(media_player::MediaPlayer *obj) override
const std::vector< UserServiceDescriptor * > & get_user_services() const
void initialize_user_services(std::initializer_list< UserServiceDescriptor * > services)
void set_port(uint16_t port)
void dump_config() override
void unregister_active_action_calls_for_connection(APIConnection *conn)
void handle_disconnect(APIConnection *conn)
void set_batch_delay(uint16_t batch_delay)
void set_reboot_timeout(uint32_t reboot_timeout)
void set_listen_backlog(uint8_t listen_backlog)
Trigger< std::string, std::string > * client_connected_trigger_
APINoiseContext & get_noise_ctx()
void register_user_service(UserServiceDescriptor *descriptor)
bool save_noise_psk(psk_t psk, bool make_active=true)
void on_lock_update(lock::Lock *obj) override
void on_date_update(datetime::DateEntity *obj) override
void handle_action_response(uint32_t call_id, bool success, const std::string &error_message)
APINoiseContext noise_ctx_
void unregister_active_action_call(uint32_t action_call_id)
void on_number_update(number::Number *obj) override
void send_homeassistant_action(const HomeassistantActionRequest &call)
void on_event(event::Event *obj) override
void on_update(update::UpdateEntity *obj) override
uint32_t next_action_call_id_
bool check_password(const uint8_t *password_data, size_t password_len) const
std::vector< PendingActionResponse > action_response_callbacks_
const std::vector< HomeAssistantStateSubscription > & get_state_subs() const
Trigger< std::string, std::string > * client_disconnected_trigger_
std::vector< uint8_t > shared_write_buffer_
void on_climate_update(climate::Climate *obj) override
std::function< void(const class ActionResponse &)> ActionResponseCallback
bool update_noise_psk_(const SavedNoisePsk &new_psk, const LogString *save_log_msg, const LogString *fail_log_msg, const psk_t &active_psk, bool make_active)
void set_max_connections(uint8_t max_connections)
void on_binary_sensor_update(binary_sensor::BinarySensor *obj) override
bool is_connected(bool state_subscription_only=false) const
ESPPreferenceObject noise_pref_
void on_fan_update(fan::Fan *obj) override
std::vector< HomeAssistantStateSubscription > state_subs_
void on_zwave_proxy_request(const esphome::api::ProtoMessage &msg)
bool clear_noise_psk(bool make_active=true)
void on_select_update(select::Select *obj) override
uint16_t get_port() const
std::vector< uint8_t > & get_shared_buffer_ref()
void on_text_update(text::Text *obj) override
void on_text_sensor_update(text_sensor::TextSensor *obj) override
std::vector< ActiveActionCall > active_action_calls_
void set_noise_psk(psk_t psk)
void on_datetime_update(datetime::DateTimeEntity *obj) override
Trigger< std::string, std::string > * get_client_disconnected_trigger() const
void on_sensor_update(sensor::Sensor *obj) override
void send_action_response(uint32_t action_call_id, bool success, const std::string &error_message)
void add_state_subscription_(const char *entity_id, const char *attribute, std::function< void(std::string)> f, bool once)
float get_setup_priority() const override
std::unique_ptr< socket::Socket > socket_
uint32_t register_active_action_call(uint32_t client_call_id, APIConnection *conn)
void subscribe_home_assistant_state(const char *entity_id, const char *attribute, std::function< void(std::string)> f)
void on_shutdown() override
void on_log(uint8_t level, const char *tag, const char *message, size_t message_len) override
Trigger< std::string, std::string > * get_client_connected_trigger() const
void on_alarm_control_panel_update(alarm_control_panel::AlarmControlPanel *obj) override
Base class for all binary_sensor-type classes.
Listener interface for camera events.
ClimateDevice - This is the base class for all climate integrations.
Base class for all cover devices.
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Base class for all locks.
Interface for receiving log messages without std::function overhead.
Base-class for all numbers.
Base-class for all selects.
Base-class for all sensors.
Base class for all switches.
Base-class for all text inputs.
Base class for all valve devices.
APIServer * global_api_server
struct esphome::api::SavedNoisePsk PACKED
std::array< uint8_t, 32 > psk_t
APIConnection * connection
std::function< void(std::string)> callback
std::unique_ptr< std::string > entity_id_dynamic_storage
std::unique_ptr< std::string > attribute_dynamic_storage
ActionResponseCallback callback