ESPHome 2025.5.0
Loading...
Searching...
No Matches
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
11namespace esphome {
12namespace midea {
13namespace ac {
14
15using sensor::Sensor;
16using climate::ClimateCall;
18using climate::ClimateTraits;
22
23class 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 use_fahrenheit, 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_{};
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
ClimateDevice - This is the base class for all climate integrations.
Definition climate.h:168
ClimateMode mode
The active mode of the climate device.
Definition climate.h:173
This class contains all static data for climate devices.
std::set< ClimateMode > supported_modes_
std::set< ClimateSwingMode > supported_swing_modes_
std::set< ClimatePreset > supported_presets_
std::set< std::string > supported_custom_presets_
void set_supported_modes(const std::set< ClimateMode > &modes)
void set_custom_presets(const std::set< std::string > &presets)
void do_follow_me(float temperature, bool use_fahrenheit, bool beeper=false)
void set_custom_fan_modes(const std::set< std::string > &modes)
void set_humidity_setpoint_sensor(Sensor *sensor)
void set_power_sensor(Sensor *sensor)
void set_supported_swing_modes(const std::set< ClimateSwingMode > &modes)
void set_outdoor_temperature_sensor(Sensor *sensor)
std::set< std::string > supported_custom_fan_modes_
void set_supported_presets(const std::set< ClimatePreset > &presets)
void control(const ClimateCall &call) override
Base-class for all sensors.
Definition sensor.h:57
ClimatePreset
Enum for all preset modes.
ClimateSwingMode
Enum for all modes a climate swing can be in.
ClimateMode
Enum for all modes a climate device can be in.
@ CLIMATE_MODE_OFF
The climate device is off.
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t temperature
Definition sun_gtil2.cpp:12