ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
midea_data.h
Go to the documentation of this file.
1#pragma once
2
5
7
11
12class ControlData : public MideaData {
13 public:
14 // Default constructor (power: ON, mode: AUTO, fan: AUTO, temp: 25C)
15 ControlData() : MideaData({MIDEA_TYPE_CONTROL, 0x82, 0x48, 0xFF, 0xFF}) {}
16 // Copy from Base
18
19 void set_temp(float temp);
20 float get_temp() const;
21
23 ClimateMode get_mode() const;
24
27
28 void set_sleep_preset(bool value) { this->set_mask_(1, value, 64); }
29 bool get_sleep_preset() const { return this->get_value_(1, 64); }
30
31 void set_fahrenheit(bool value) { this->set_mask_(2, value, 32); }
32 bool get_fahrenheit() const { return this->get_value_(2, 32); }
33
34 void fix();
35
36 protected:
50 void set_fan_mode_(FanMode mode) { this->set_value_(1, mode, 3, 3); }
51 FanMode get_fan_mode_() const { return static_cast<FanMode>(this->get_value_(1, 3, 3)); }
52 void set_mode_(Mode mode) { this->set_value_(1, mode, 7); }
53 Mode get_mode_() const { return static_cast<Mode>(this->get_value_(1, 7)); }
54 void set_power_(bool value) { this->set_mask_(1, value, 128); }
55 bool get_power_() const { return this->get_value_(1, 128); }
56};
57
58class FollowMeData : public MideaData {
59 public:
60 // Default constructor (temp: 30C, beeper: off)
61 FollowMeData() : MideaData({MIDEA_TYPE_FOLLOW_ME, 0x82, 0x48, 0x7F, 0x1F}) {}
62 // Copy from Base
64 // Direct from temperature and beeper values
65 FollowMeData(uint8_t temp, bool beeper = false) : FollowMeData() {
66 this->set_temp(temp);
67 this->set_beeper(beeper);
68 }
69
70 /* TEMPERATURE */
71 uint8_t temp() const { return this->get_value_(4) - 1; }
72 void set_temp(uint8_t val) { this->set_value_(4, std::min(MAX_TEMP, val) + 1); }
73
74 /* BEEPER */
75 bool beeper() const { return this->get_value_(3, 128); }
76 void set_beeper(bool value) { this->set_mask_(3, value, 128); }
77
78 protected:
79 static const uint8_t MAX_TEMP = 37;
80};
81
82class SpecialData : public MideaData {
83 public:
84 SpecialData(uint8_t code) : MideaData({MIDEA_TYPE_SPECIAL, code, 0xFF, 0xFF, 0xFF}) {}
85 static const uint8_t VSWING_STEP = 1;
86 static const uint8_t VSWING_TOGGLE = 2;
87 static const uint8_t TURBO_TOGGLE = 9;
88};
89
90} // namespace esphome::midea_ir
BedjetMode mode
BedJet operating mode.
ControlData(const MideaData &data)
Definition midea_data.h:17
void set_mode(ClimateMode mode)
Definition midea_ir.cpp:40
void set_sleep_preset(bool value)
Definition midea_data.h:28
void set_fahrenheit(bool value)
Definition midea_data.h:31
ClimateMode get_mode() const
Definition midea_ir.cpp:64
FanMode get_fan_mode_() const
Definition midea_data.h:51
void set_fan_mode(ClimateFanMode mode)
Definition midea_ir.cpp:81
void set_power_(bool value)
Definition midea_data.h:54
ClimateFanMode get_fan_mode() const
Definition midea_ir.cpp:98
void set_fan_mode_(FanMode mode)
Definition midea_data.h:50
FollowMeData(const MideaData &data)
Definition midea_data.h:63
static const uint8_t MAX_TEMP
Definition midea_data.h:79
FollowMeData(uint8_t temp, bool beeper=false)
Definition midea_data.h:65
static const uint8_t VSWING_STEP
Definition midea_data.h:85
static const uint8_t TURBO_TOGGLE
Definition midea_data.h:87
static const uint8_t VSWING_TOGGLE
Definition midea_data.h:86
void set_value_(uint8_t idx, uint8_t value, uint8_t mask=255, uint8_t shift=0)
uint8_t get_value_(uint8_t idx, uint8_t mask=255, uint8_t shift=0) const
void set_mask_(uint8_t idx, bool state, uint8_t mask=255)
mopeka_std_values val[3]
ClimateMode
Enum for all modes a climate device can be in.
ClimateFanMode
NOTE: If adding values, update ClimateFanModeMask in climate_traits.h to use the new last value.