ESPHome  2024.12.2
subscribe_state.cpp
Go to the documentation of this file.
1 #include "subscribe_state.h"
2 #ifdef USE_API
3 #include "api_connection.h"
4 #include "esphome/core/log.h"
5 
6 namespace esphome {
7 namespace api {
8 
9 #ifdef USE_BINARY_SENSOR
11  return this->client_->send_binary_sensor_state(binary_sensor, binary_sensor->state);
12 }
13 #endif
14 #ifdef USE_COVER
16 #endif
17 #ifdef USE_FAN
18 bool InitialStateIterator::on_fan(fan::Fan *fan) { return this->client_->send_fan_state(fan); }
19 #endif
20 #ifdef USE_LIGHT
22 #endif
23 #ifdef USE_SENSOR
25  return this->client_->send_sensor_state(sensor, sensor->state);
26 }
27 #endif
28 #ifdef USE_SWITCH
30  return this->client_->send_switch_state(a_switch, a_switch->state);
31 }
32 #endif
33 #ifdef USE_TEXT_SENSOR
35  return this->client_->send_text_sensor_state(text_sensor, text_sensor->state);
36 }
37 #endif
38 #ifdef USE_CLIMATE
40 #endif
41 #ifdef USE_NUMBER
43  return this->client_->send_number_state(number, number->state);
44 }
45 #endif
46 #ifdef USE_DATETIME_DATE
48 #endif
49 #ifdef USE_DATETIME_TIME
51 #endif
52 #ifdef USE_DATETIME_DATETIME
54  return this->client_->send_datetime_state(datetime);
55 }
56 #endif
57 #ifdef USE_TEXT
58 bool InitialStateIterator::on_text(text::Text *text) { return this->client_->send_text_state(text, text->state); }
59 #endif
60 #ifdef USE_SELECT
62  return this->client_->send_select_state(select, select->state);
63 }
64 #endif
65 #ifdef USE_LOCK
66 bool InitialStateIterator::on_lock(lock::Lock *a_lock) { return this->client_->send_lock_state(a_lock, a_lock->state); }
67 #endif
68 #ifdef USE_VALVE
70 #endif
71 #ifdef USE_MEDIA_PLAYER
73  return this->client_->send_media_player_state(media_player);
74 }
75 #endif
76 #ifdef USE_ALARM_CONTROL_PANEL
78  return this->client_->send_alarm_control_panel_state(a_alarm_control_panel);
79 }
80 #endif
81 #ifdef USE_UPDATE
83 #endif
85 
86 } // namespace api
87 } // namespace esphome
88 #endif
Base class for all switches.
Definition: switch.h:39
bool send_text_sensor_state(text_sensor::TextSensor *text_sensor, std::string state)
bool send_alarm_control_panel_state(alarm_control_panel::AlarmControlPanel *a_alarm_control_panel)
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 cover devices.
Definition: cover.h:111
std::string state
Definition: text.h:26
bool on_light(light::LightState *light) override
bool send_switch_state(switch_::Switch *a_switch, bool state)
LockState state
The current reported state of the lock.
Definition: lock.h:122
bool on_date(datetime::DateEntity *date) override
bool send_valve_state(valve::Valve *valve)
bool send_fan_state(fan::Fan *fan)
bool send_climate_state(climate::Climate *climate)
bool send_lock_state(lock::Lock *a_lock, lock::LockState state)
bool send_text_state(text::Text *text, std::string state)
bool on_text_sensor(text_sensor::TextSensor *text_sensor) override
Base-class for all text inputs.
Definition: text.h:24
bool on_number(number::Number *number) override
InitialStateIterator(APIConnection *client)
bool on_lock(lock::Lock *a_lock) override
float state
This member variable stores the last state that has passed through all filters.
Definition: sensor.h:131
bool send_sensor_state(sensor::Sensor *sensor, float state)
bool on_sensor(sensor::Sensor *sensor) override
bool send_select_state(select::Select *select, std::string state)
bool on_time(datetime::TimeEntity *time) override
bool on_text(text::Text *text) override
Base-class for all numbers.
Definition: number.h:39
bool send_time_state(datetime::TimeEntity *time)
bool on_media_player(media_player::MediaPlayer *media_player) override
bool send_binary_sensor_state(binary_sensor::BinarySensor *binary_sensor, bool state)
bool on_update(update::UpdateEntity *update) override
bool state
The current reported state of the binary sensor.
Definition: binary_sensor.h:61
bool send_update_state(update::UpdateEntity *update)
bool on_select(select::Select *select) override
bool send_cover_state(cover::Cover *cover)
esphome::binary_sensor::BinarySensor * binary_sensor
Definition: statsd.h:41
bool on_climate(climate::Climate *climate) override
bool send_date_state(datetime::DateEntity *date)
std::string state
Definition: select.h:33
bool on_cover(cover::Cover *cover) override
bool on_valve(valve::Valve *valve) override
Base-class for all selects.
Definition: select.h:31
bool send_light_state(light::LightState *light)
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base class for all valve devices.
Definition: valve.h:105
bool send_media_player_state(media_player::MediaPlayer *media_player)
Base class for all binary_sensor-type classes.
Definition: binary_sensor.h:37
bool on_binary_sensor(binary_sensor::BinarySensor *binary_sensor) override
bool send_datetime_state(datetime::DateTimeEntity *datetime)
bool on_datetime(datetime::DateTimeEntity *datetime) override
Base-class for all sensors.
Definition: sensor.h:57
bool on_fan(fan::Fan *fan) override
bool send_number_state(number::Number *number, float state)
bool state
The current reported state of the binary sensor.
Definition: switch.h:53
esphome::sensor::Sensor * sensor
Definition: statsd.h:38
bool on_alarm_control_panel(alarm_control_panel::AlarmControlPanel *a_alarm_control_panel) override
Base class for all locks.
Definition: lock.h:103
bool on_switch(switch_::Switch *a_switch) override
ClimateDevice - This is the base class for all climate integrations.
Definition: climate.h:168