ESPHome  2021.11.3
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;
26  void set_outdoor_temperature_sensor(Sensor *sensor) { this->outdoor_sensor_ = sensor; }
27  void set_humidity_setpoint_sensor(Sensor *sensor) { this->humidity_sensor_ = sensor; }
28  void set_power_sensor(Sensor *sensor) { this->power_sensor_ = sensor; }
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 set_supported_modes(const std::set<ClimateMode> &modes) { this->supported_modes_ = modes; }
43  void set_supported_swing_modes(const std::set<ClimateSwingMode> &modes) { this->supported_swing_modes_ = modes; }
44  void set_supported_presets(const std::set<ClimatePreset> &presets) { this->supported_presets_ = presets; }
45  void set_custom_presets(const std::set<std::string> &presets) { this->supported_custom_presets_ = presets; }
46  void set_custom_fan_modes(const std::set<std::string> &modes) { this->supported_custom_fan_modes_ = modes; }
47 
48  protected:
49  void control(const ClimateCall &call) override;
50  ClimateTraits traits() override;
51  std::set<ClimateMode> supported_modes_{};
52  std::set<ClimateSwingMode> supported_swing_modes_{};
53  std::set<ClimatePreset> supported_presets_{};
54  std::set<std::string> supported_custom_presets_{};
55  std::set<std::string> supported_custom_fan_modes_{};
58  Sensor *power_sensor_{nullptr};
59 };
60 
61 } // namespace ac
62 } // namespace midea
63 } // namespace esphome
64 
65 #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 modes a climate swing can be in.
Definition: climate_mode.h:80
This class contains all static data for climate devices.
void do_follow_me(float temperature, bool beeper=false)
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:68
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_
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
Library based on https://github.com/miguelbalboa/rfid and adapted to ESPHome by . ...
Definition: a4988.cpp:4
Base-class for all sensors.
Definition: sensor.h:47
void set_power_sensor(Sensor *sensor)
ClimateDevice - This is the base class for all climate integrations.
Definition: climate.h:167