ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
air_conditioner.h
Go to the documentation of this file.
1#pragma once
2
3#if (defined(USE_ARDUINO) && !defined(USE_RP2) && !defined(USE_LIBRETINY)) || defined(USE_ESP_IDF)
4
5// MideaUART
6#include <Appliance/AirConditioner/AirConditioner.h>
7
8#include "appliance_base.h"
10
11namespace esphome::midea::ac {
12
13using sensor::Sensor;
14using climate::ClimateCall;
16using climate::ClimateTraits;
23
24// How the display toggle reaches the appliance; the AUTO rules are in do_display_toggle()
25enum class DisplayControl : uint8_t {
26 DISPLAY_CONTROL_UART, // always the UART request
27 DISPLAY_CONTROL_AUTO, // UART when the appliance reports it or no transmitter is built in, else IR
28 DISPLAY_CONTROL_IR, // always the IR remote, needs a transmitter
29};
30
31class AirConditioner final : public ApplianceBase<dudanov::midea::ac::AirConditioner>, public climate::Climate {
32 SUB_SENSOR(outdoor_temperature)
33 SUB_SENSOR(humidity_setpoint)
34 SUB_SENSOR(power)
35
36 public:
37 void dump_config() override;
38 void set_display_control(DisplayControl control) { this->display_control_ = control; }
39 void on_status_change() override;
40
41 /* ############### */
42 /* ### ACTIONS ### */
43 /* ############### */
44
45 void do_follow_me(float temperature, bool use_fahrenheit, bool beeper = false);
46 void do_display_toggle();
47 void do_swing_step();
48 void do_beeper_on() { this->set_beeper_feedback(true); }
49 void do_beeper_off() { this->set_beeper_feedback(false); }
50 void do_power_on() { this->base_.setPowerState(true); }
51 void do_power_off() { this->base_.setPowerState(false); }
52 void do_power_toggle() { this->base_.setPowerState(this->mode == ClimateMode::CLIMATE_MODE_OFF); }
53 void set_supported_modes(ClimateModeMask modes) { this->supported_modes_ = modes; }
54 void set_supported_swing_modes(ClimateSwingModeMask modes) { this->supported_swing_modes_ = modes; }
55 void set_supported_presets(ClimatePresetMask presets) { this->supported_presets_ = presets; }
56
57 protected:
58 void control(const ClimateCall &call) override;
59 ClimateTraits traits() override;
65};
66
67} // namespace esphome::midea::ac
68
69#endif // USE_ARDUINO || USE_ESP_IDF
virtual void dump_config()
This class is used to encode all control actions on a climate device.
Definition climate.h:31
ClimateDevice - This is the base class for all climate integrations.
Definition climate.h:192
ClimateMode mode
The active mode of the climate device.
Definition climate.h:317
ClimateSwingModeMask supported_swing_modes_
void control(const ClimateCall &call) override
FiniteSetMask< ClimateSwingMode, DefaultBitPolicy< ClimateSwingMode, CLIMATE_SWING_HORIZONTAL+1 > > ClimateSwingModeMask
FiniteSetMask< ClimatePreset, DefaultBitPolicy< ClimatePreset, CLIMATE_PRESET_ACTIVITY+1 > > ClimatePresetMask
FiniteSetMask< ClimateMode, DefaultBitPolicy< ClimateMode, CLIMATE_MODE_AUTO+1 > > ClimateModeMask
ClimatePreset
Enum for all preset modes NOTE: If adding values, update ClimatePresetMask in climate_traits....
ClimateSwingMode
Enum for all modes a climate swing can be in NOTE: If adding values, update ClimateSwingModeMask in c...
ClimateMode
Enum for all modes a climate device can be in.
@ CLIMATE_MODE_OFF
The climate device is off.
ClimateFanMode
NOTE: If adding values, update ClimateFanModeMask in climate_traits.h to use the new last value.
uint16_t temperature
Definition sun_gtil2.cpp:12