2019-04-17 12:06:00 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "esphome/core/defines.h"
|
|
|
|
#ifdef USE_BINARY_SENSOR
|
|
|
|
#include "esphome/components/binary_sensor/binary_sensor.h"
|
|
|
|
#endif
|
|
|
|
#ifdef USE_FAN
|
|
|
|
#include "esphome/components/fan/fan_state.h"
|
|
|
|
#endif
|
|
|
|
#ifdef USE_LIGHT
|
|
|
|
#include "esphome/components/light/light_state.h"
|
|
|
|
#endif
|
|
|
|
#ifdef USE_COVER
|
|
|
|
#include "esphome/components/cover/cover.h"
|
|
|
|
#endif
|
|
|
|
#ifdef USE_SENSOR
|
|
|
|
#include "esphome/components/sensor/sensor.h"
|
|
|
|
#endif
|
|
|
|
#ifdef USE_TEXT_SENSOR
|
|
|
|
#include "esphome/components/text_sensor/text_sensor.h"
|
|
|
|
#endif
|
|
|
|
#ifdef USE_SWITCH
|
|
|
|
#include "esphome/components/switch/switch.h"
|
|
|
|
#endif
|
2021-11-29 20:00:51 +01:00
|
|
|
#ifdef USE_BUTTON
|
|
|
|
#include "esphome/components/button/button.h"
|
|
|
|
#endif
|
2019-04-17 12:06:00 +02:00
|
|
|
#ifdef USE_CLIMATE
|
|
|
|
#include "esphome/components/climate/climate.h"
|
|
|
|
#endif
|
2021-07-12 21:20:12 +02:00
|
|
|
#ifdef USE_NUMBER
|
|
|
|
#include "esphome/components/number/number.h"
|
|
|
|
#endif
|
2024-03-10 19:52:22 +01:00
|
|
|
#ifdef USE_DATETIME_DATE
|
|
|
|
#include "esphome/components/datetime/date_entity.h"
|
|
|
|
#endif
|
2024-04-09 03:46:35 +02:00
|
|
|
#ifdef USE_DATETIME_TIME
|
|
|
|
#include "esphome/components/datetime/time_entity.h"
|
|
|
|
#endif
|
2024-04-11 04:32:30 +02:00
|
|
|
#ifdef USE_DATETIME_DATETIME
|
|
|
|
#include "esphome/components/datetime/datetime_entity.h"
|
|
|
|
#endif
|
2023-10-25 11:00:32 +02:00
|
|
|
#ifdef USE_TEXT
|
|
|
|
#include "esphome/components/text/text.h"
|
|
|
|
#endif
|
2021-08-02 10:00:51 +02:00
|
|
|
#ifdef USE_SELECT
|
|
|
|
#include "esphome/components/select/select.h"
|
|
|
|
#endif
|
2022-02-03 19:24:31 +01:00
|
|
|
#ifdef USE_LOCK
|
|
|
|
#include "esphome/components/lock/lock.h"
|
|
|
|
#endif
|
2024-04-23 06:47:03 +02:00
|
|
|
#ifdef USE_VALVE
|
|
|
|
#include "esphome/components/valve/valve.h"
|
|
|
|
#endif
|
2022-06-02 07:00:17 +02:00
|
|
|
#ifdef USE_MEDIA_PLAYER
|
|
|
|
#include "esphome/components/media_player/media_player.h"
|
|
|
|
#endif
|
2023-06-15 02:34:39 +02:00
|
|
|
#ifdef USE_ALARM_CONTROL_PANEL
|
|
|
|
#include "esphome/components/alarm_control_panel/alarm_control_panel.h"
|
|
|
|
#endif
|
2024-04-24 04:35:26 +02:00
|
|
|
#ifdef USE_EVENT
|
|
|
|
#include "esphome/components/event/event.h"
|
|
|
|
#endif
|
2019-04-17 12:06:00 +02:00
|
|
|
|
|
|
|
namespace esphome {
|
|
|
|
|
|
|
|
class Controller {
|
|
|
|
public:
|
2021-11-29 16:52:20 +01:00
|
|
|
void setup_controller(bool include_internal = false);
|
2019-04-17 12:06:00 +02:00
|
|
|
#ifdef USE_BINARY_SENSOR
|
|
|
|
virtual void on_binary_sensor_update(binary_sensor::BinarySensor *obj, bool state){};
|
|
|
|
#endif
|
|
|
|
#ifdef USE_FAN
|
2022-01-23 10:21:54 +01:00
|
|
|
virtual void on_fan_update(fan::Fan *obj){};
|
2019-04-17 12:06:00 +02:00
|
|
|
#endif
|
|
|
|
#ifdef USE_LIGHT
|
|
|
|
virtual void on_light_update(light::LightState *obj){};
|
|
|
|
#endif
|
|
|
|
#ifdef USE_SENSOR
|
|
|
|
virtual void on_sensor_update(sensor::Sensor *obj, float state){};
|
|
|
|
#endif
|
|
|
|
#ifdef USE_SWITCH
|
|
|
|
virtual void on_switch_update(switch_::Switch *obj, bool state){};
|
|
|
|
#endif
|
|
|
|
#ifdef USE_COVER
|
|
|
|
virtual void on_cover_update(cover::Cover *obj){};
|
|
|
|
#endif
|
|
|
|
#ifdef USE_TEXT_SENSOR
|
2021-06-10 13:04:40 +02:00
|
|
|
virtual void on_text_sensor_update(text_sensor::TextSensor *obj, const std::string &state){};
|
2019-04-17 12:06:00 +02:00
|
|
|
#endif
|
|
|
|
#ifdef USE_CLIMATE
|
|
|
|
virtual void on_climate_update(climate::Climate *obj){};
|
|
|
|
#endif
|
2021-07-12 21:20:12 +02:00
|
|
|
#ifdef USE_NUMBER
|
|
|
|
virtual void on_number_update(number::Number *obj, float state){};
|
|
|
|
#endif
|
2024-03-10 19:52:22 +01:00
|
|
|
#ifdef USE_DATETIME_DATE
|
|
|
|
virtual void on_date_update(datetime::DateEntity *obj){};
|
|
|
|
#endif
|
2024-04-09 03:46:35 +02:00
|
|
|
#ifdef USE_DATETIME_TIME
|
|
|
|
virtual void on_time_update(datetime::TimeEntity *obj){};
|
|
|
|
#endif
|
2024-04-11 04:32:30 +02:00
|
|
|
#ifdef USE_DATETIME_DATETIME
|
|
|
|
virtual void on_datetime_update(datetime::DateTimeEntity *obj){};
|
|
|
|
#endif
|
2023-10-25 11:00:32 +02:00
|
|
|
#ifdef USE_TEXT
|
|
|
|
virtual void on_text_update(text::Text *obj, const std::string &state){};
|
|
|
|
#endif
|
2021-08-02 10:00:51 +02:00
|
|
|
#ifdef USE_SELECT
|
2022-05-10 06:41:16 +02:00
|
|
|
virtual void on_select_update(select::Select *obj, const std::string &state, size_t index){};
|
2021-08-02 10:00:51 +02:00
|
|
|
#endif
|
2022-02-03 19:24:31 +01:00
|
|
|
#ifdef USE_LOCK
|
|
|
|
virtual void on_lock_update(lock::Lock *obj){};
|
|
|
|
#endif
|
2024-04-23 06:47:03 +02:00
|
|
|
#ifdef USE_VALVE
|
|
|
|
virtual void on_valve_update(valve::Valve *obj){};
|
|
|
|
#endif
|
2022-06-02 07:00:17 +02:00
|
|
|
#ifdef USE_MEDIA_PLAYER
|
|
|
|
virtual void on_media_player_update(media_player::MediaPlayer *obj){};
|
|
|
|
#endif
|
2023-06-15 02:34:39 +02:00
|
|
|
#ifdef USE_ALARM_CONTROL_PANEL
|
|
|
|
virtual void on_alarm_control_panel_update(alarm_control_panel::AlarmControlPanel *obj){};
|
|
|
|
#endif
|
2024-04-24 04:35:26 +02:00
|
|
|
#ifdef USE_EVENT
|
|
|
|
virtual void on_event(event::Event *obj, const std::string &event_type){};
|
|
|
|
#endif
|
2019-04-17 12:06:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace esphome
|