mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-03 19:38:30 +02:00
Add preset, custom_preset and custom_fan_mode support to climate (#1471)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
namespace esphome {
|
||||
namespace midea_ac {
|
||||
|
||||
extern const std::string MIDEA_SILENT_FAN_MODE;
|
||||
extern const std::string MIDEA_TURBO_FAN_MODE;
|
||||
extern const std::string MIDEA_FREEZE_PROTECTION_PRESET;
|
||||
|
||||
/// Enum for all modes a Midea device can be in.
|
||||
enum MideaMode : uint8_t {
|
||||
/// The Midea device is set to automatically change the heating/cooling cycle
|
||||
@@ -23,12 +27,16 @@ enum MideaMode : uint8_t {
|
||||
enum MideaFanMode : uint8_t {
|
||||
/// The fan mode is set to Auto
|
||||
MIDEA_FAN_AUTO = 102,
|
||||
/// The fan mode is set to Silent
|
||||
MIDEA_FAN_SILENT = 20,
|
||||
/// The fan mode is set to Low
|
||||
MIDEA_FAN_LOW = 40,
|
||||
/// The fan mode is set to Medium
|
||||
MIDEA_FAN_MEDIUM = 60,
|
||||
/// The fan mode is set to High
|
||||
MIDEA_FAN_HIGH = 80,
|
||||
/// The fan mode is set to Turbo
|
||||
MIDEA_FAN_TURBO = 100,
|
||||
};
|
||||
|
||||
/// Enum for all modes a Midea swing can be in
|
||||
@@ -65,9 +73,13 @@ class PropertiesFrame : public midea_dongle::BaseFrame {
|
||||
void set_mode(climate::ClimateMode mode);
|
||||
|
||||
/* FAN SPEED */
|
||||
bool is_custom_fan_mode() const;
|
||||
climate::ClimateFanMode get_fan_mode() const;
|
||||
void set_fan_mode(climate::ClimateFanMode mode);
|
||||
|
||||
const std::string &get_custom_fan_mode() const;
|
||||
void set_custom_fan_mode(const std::string &mode);
|
||||
|
||||
/* SWING MODE */
|
||||
climate::ClimateSwingMode get_swing_mode() const;
|
||||
void set_swing_mode(climate::ClimateSwingMode mode);
|
||||
@@ -82,16 +94,28 @@ class PropertiesFrame : public midea_dongle::BaseFrame {
|
||||
float get_humidity_setpoint() const;
|
||||
|
||||
/* ECO MODE */
|
||||
bool get_eco_mode() const { return this->pbuf_[19]; }
|
||||
void set_eco_mode(bool state) { this->set_bytemask_(19, 0xFF, state); }
|
||||
bool get_eco_mode() const { return this->pbuf_[19] & 0x10; }
|
||||
void set_eco_mode(bool state) { this->set_bytemask_(19, 0x80, state); }
|
||||
|
||||
/* SLEEP MODE */
|
||||
bool get_sleep_mode() const { return this->pbuf_[20] & 0x01; }
|
||||
void set_sleep_mode(bool state) { this->set_bytemask_(20, 0x01, state); }
|
||||
|
||||
/* TURBO MODE */
|
||||
bool get_turbo_mode() const { return this->pbuf_[20] & 0x02; }
|
||||
void set_turbo_mode(bool state) { this->set_bytemask_(20, 0x02, state); }
|
||||
bool get_turbo_mode() const { return this->pbuf_[18] & 0x20; }
|
||||
void set_turbo_mode(bool state) { this->set_bytemask_(18, 0x20, state); }
|
||||
|
||||
/* FREEZE PROTECTION */
|
||||
bool get_freeze_protection_mode() const { return this->pbuf_[31] & 0x80; }
|
||||
void set_freeze_protection_mode(bool state) { this->set_bytemask_(31, 0x80, state); }
|
||||
|
||||
/* PRESET */
|
||||
optional<climate::ClimatePreset> get_preset() const;
|
||||
void set_preset(climate::ClimatePreset preset);
|
||||
|
||||
bool is_custom_preset() const;
|
||||
const std::string &get_custom_preset() const;
|
||||
void set_custom_preset(const std::string &preset);
|
||||
|
||||
/* POWER USAGE */
|
||||
float get_power_usage() const;
|
||||
|
||||
Reference in New Issue
Block a user