ESPHome  2024.12.2
controller.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "esphome/core/defines.h"
4 #ifdef USE_BINARY_SENSOR
6 #endif
7 #ifdef USE_FAN
9 #endif
10 #ifdef USE_LIGHT
12 #endif
13 #ifdef USE_COVER
15 #endif
16 #ifdef USE_SENSOR
18 #endif
19 #ifdef USE_TEXT_SENSOR
21 #endif
22 #ifdef USE_SWITCH
24 #endif
25 #ifdef USE_BUTTON
27 #endif
28 #ifdef USE_CLIMATE
30 #endif
31 #ifdef USE_NUMBER
33 #endif
34 #ifdef USE_DATETIME_DATE
36 #endif
37 #ifdef USE_DATETIME_TIME
39 #endif
40 #ifdef USE_DATETIME_DATETIME
42 #endif
43 #ifdef USE_TEXT
45 #endif
46 #ifdef USE_SELECT
48 #endif
49 #ifdef USE_LOCK
51 #endif
52 #ifdef USE_VALVE
54 #endif
55 #ifdef USE_MEDIA_PLAYER
57 #endif
58 #ifdef USE_ALARM_CONTROL_PANEL
60 #endif
61 #ifdef USE_EVENT
63 #endif
64 #ifdef USE_UPDATE
66 #endif
67 
68 namespace esphome {
69 
70 class Controller {
71  public:
72  void setup_controller(bool include_internal = false);
73 #ifdef USE_BINARY_SENSOR
75 #endif
76 #ifdef USE_FAN
77  virtual void on_fan_update(fan::Fan *obj){};
78 #endif
79 #ifdef USE_LIGHT
80  virtual void on_light_update(light::LightState *obj){};
81 #endif
82 #ifdef USE_SENSOR
83  virtual void on_sensor_update(sensor::Sensor *obj, float state){};
84 #endif
85 #ifdef USE_SWITCH
86  virtual void on_switch_update(switch_::Switch *obj, bool state){};
87 #endif
88 #ifdef USE_COVER
89  virtual void on_cover_update(cover::Cover *obj){};
90 #endif
91 #ifdef USE_TEXT_SENSOR
92  virtual void on_text_sensor_update(text_sensor::TextSensor *obj, const std::string &state){};
93 #endif
94 #ifdef USE_CLIMATE
95  virtual void on_climate_update(climate::Climate *obj){};
96 #endif
97 #ifdef USE_NUMBER
98  virtual void on_number_update(number::Number *obj, float state){};
99 #endif
100 #ifdef USE_DATETIME_DATE
101  virtual void on_date_update(datetime::DateEntity *obj){};
102 #endif
103 #ifdef USE_DATETIME_TIME
104  virtual void on_time_update(datetime::TimeEntity *obj){};
105 #endif
106 #ifdef USE_DATETIME_DATETIME
108 #endif
109 #ifdef USE_TEXT
110  virtual void on_text_update(text::Text *obj, const std::string &state){};
111 #endif
112 #ifdef USE_SELECT
113  virtual void on_select_update(select::Select *obj, const std::string &state, size_t index){};
114 #endif
115 #ifdef USE_LOCK
116  virtual void on_lock_update(lock::Lock *obj){};
117 #endif
118 #ifdef USE_VALVE
119  virtual void on_valve_update(valve::Valve *obj){};
120 #endif
121 #ifdef USE_MEDIA_PLAYER
123 #endif
124 #ifdef USE_ALARM_CONTROL_PANEL
126 #endif
127 #ifdef USE_EVENT
128  virtual void on_event(event::Event *obj, const std::string &event_type){};
129 #endif
130 #ifdef USE_UPDATE
131  virtual void on_update(update::UpdateEntity *obj){};
132 #endif
133 };
134 
135 } // namespace esphome
Base class for all switches.
Definition: switch.h:39
virtual void on_text_update(text::Text *obj, const std::string &state)
Definition: controller.h:110
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
virtual void on_select_update(select::Select *obj, const std::string &state, size_t index)
Definition: controller.h:113
virtual void on_date_update(datetime::DateEntity *obj)
Definition: controller.h:101
virtual void on_datetime_update(datetime::DateTimeEntity *obj)
Definition: controller.h:107
virtual void on_light_update(light::LightState *obj)
Definition: controller.h:80
virtual void on_number_update(number::Number *obj, float state)
Definition: controller.h:98
virtual void on_lock_update(lock::Lock *obj)
Definition: controller.h:116
Base-class for all text inputs.
Definition: text.h:24
virtual void on_time_update(datetime::TimeEntity *obj)
Definition: controller.h:104
virtual void on_event(event::Event *obj, const std::string &event_type)
Definition: controller.h:128
virtual void on_cover_update(cover::Cover *obj)
Definition: controller.h:89
virtual void on_valve_update(valve::Valve *obj)
Definition: controller.h:119
Base-class for all numbers.
Definition: number.h:39
virtual void on_update(update::UpdateEntity *obj)
Definition: controller.h:131
virtual void on_climate_update(climate::Climate *obj)
Definition: controller.h:95
virtual void on_alarm_control_panel_update(alarm_control_panel::AlarmControlPanel *obj)
Definition: controller.h:125
virtual void on_fan_update(fan::Fan *obj)
Definition: controller.h:77
virtual void on_text_sensor_update(text_sensor::TextSensor *obj, const std::string &state)
Definition: controller.h:92
virtual void on_sensor_update(sensor::Sensor *obj, float state)
Definition: controller.h:83
virtual void on_media_player_update(media_player::MediaPlayer *obj)
Definition: controller.h:122
void setup_controller(bool include_internal=false)
Definition: controller.cpp:7
Base-class for all selects.
Definition: select.h:31
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base class for all valve devices.
Definition: valve.h:105
Base class for all binary_sensor-type classes.
Definition: binary_sensor.h:37
virtual void on_switch_update(switch_::Switch *obj, bool state)
Definition: controller.h:86
Base-class for all sensors.
Definition: sensor.h:57
virtual void on_binary_sensor_update(binary_sensor::BinarySensor *obj, bool state)
Definition: controller.h:74
Base class for all locks.
Definition: lock.h:103
ClimateDevice - This is the base class for all climate integrations.
Definition: climate.h:168
bool state
Definition: fan.h:34