ESPHome  2024.9.2
air_conditioner.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_ARDUINO
4 
5 // MideaUART
6 #include <Appliance/AirConditioner/AirConditioner.h>
7 
8 #include "appliance_base.h"
10 
11 namespace esphome {
12 namespace midea {
13 namespace ac {
14 
15 using sensor::Sensor;
16 using climate::ClimateCall;
18 using climate::ClimateTraits;
22 
23 class AirConditioner : public ApplianceBase<dudanov::midea::ac::AirConditioner>, public climate::Climate {
24  public:
25  void dump_config() override;
29  void on_status_change() override;
30 
31  /* ############### */
32  /* ### ACTIONS ### */
33  /* ############### */
34 
35  void do_follow_me(float temperature, bool beeper = false);
36  void do_display_toggle();
37  void do_swing_step();
38  void do_beeper_on() { this->set_beeper_feedback(true); }
39  void do_beeper_off() { this->set_beeper_feedback(false); }
40  void do_power_on() { this->base_.setPowerState(true); }
41  void do_power_off() { this->base_.setPowerState(false); }
42  void do_power_toggle() { this->base_.setPowerState(this->mode == ClimateMode::CLIMATE_MODE_OFF); }
43  void set_supported_modes(const std::set<ClimateMode> &modes) { this->supported_modes_ = modes; }
44  void set_supported_swing_modes(const std::set<ClimateSwingMode> &modes) { this->supported_swing_modes_ = modes; }
45  void set_supported_presets(const std::set<ClimatePreset> &presets) { this->supported_presets_ = presets; }
46  void set_custom_presets(const std::set<std::string> &presets) { this->supported_custom_presets_ = presets; }
47  void set_custom_fan_modes(const std::set<std::string> &modes) { this->supported_custom_fan_modes_ = modes; }
48 
49  protected:
50  void control(const ClimateCall &call) override;
51  ClimateTraits traits() override;
52  std::set<ClimateMode> supported_modes_{};
53  std::set<ClimateSwingMode> supported_swing_modes_{};
54  std::set<ClimatePreset> supported_presets_{};
55  std::set<std::string> supported_custom_presets_{};
56  std::set<std::string> supported_custom_fan_modes_{};
59  Sensor *power_sensor_{nullptr};
60 };
61 
62 } // namespace ac
63 } // namespace midea
64 } // namespace esphome
65 
66 #endif // USE_ARDUINO
This class is used to encode all control actions on a climate device.
Definition: climate.h:33
std::set< std::string > supported_custom_presets_
ClimatePreset
Enum for all preset modes.
Definition: climate_mode.h:82
This class contains all static data for climate devices.
void do_follow_me(float temperature, bool beeper=false)
ClimateMode mode
The active mode of the climate device.
Definition: climate.h:173
std::set< ClimateSwingMode > supported_swing_modes_
void set_supported_modes(const std::set< ClimateMode > &modes)
ClimateSwingMode
Enum for all modes a climate swing can be in.
Definition: climate_mode.h:70
void set_outdoor_temperature_sensor(Sensor *sensor)
std::set< ClimatePreset > supported_presets_
void control(const ClimateCall &call) override
std::set< std::string > supported_custom_fan_modes_
uint16_t temperature
Definition: sun_gtil2.cpp:26
void set_supported_presets(const std::set< ClimatePreset > &presets)
void set_custom_fan_modes(const std::set< std::string > &modes)
void set_custom_presets(const std::set< std::string > &presets)
ClimateMode
Enum for all modes a climate device can be in.
Definition: climate_mode.h:10
void set_supported_swing_modes(const std::set< ClimateSwingMode > &modes)
std::set< ClimateMode > supported_modes_
void set_humidity_setpoint_sensor(Sensor *sensor)
ClimateTraits traits() override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57
void set_power_sensor(Sensor *sensor)
esphome::sensor::Sensor * sensor
Definition: statsd.h:37
ClimateDevice - This is the base class for all climate integrations.
Definition: climate.h:168