diff --git a/esphome/components/gree/gree.cpp b/esphome/components/gree/gree.cpp index 0e02f20080c..e85dd249e39 100644 --- a/esphome/components/gree/gree.cpp +++ b/esphome/components/gree/gree.cpp @@ -12,9 +12,12 @@ void GreeClimate::set_model(Model model) { this->swing_modes_.erase(climate::CLIMATE_SWING_BOTH); } if (model == GREE_YX1FF) { - this->fan_modes_.insert(climate::CLIMATE_FAN_QUIET); // YX1FF 4 speed - this->presets_.insert(climate::CLIMATE_PRESET_NONE); // YX1FF sleep mode - this->presets_.insert(climate::CLIMATE_PRESET_SLEEP); // YX1FF sleep mode + this->fan_modes_.insert(climate::CLIMATE_FAN_QUIET); // YX1FF 4 speed + } + // Models with a sleep preset + if (model == GREE_YX1FF || model == GREE_YAC1FB9) { + this->presets_.insert(climate::CLIMATE_PRESET_NONE); + this->presets_.insert(climate::CLIMATE_PRESET_SLEEP); } this->model_ = model; @@ -80,10 +83,10 @@ void GreeClimate::transmit_state() { if (this->fan_speed_() == GREE_FAN_TURBO) { remote_state[2] |= GREE_FAN_TURBO_BIT; } + } - if (this->preset_() == GREE_PRESET_SLEEP) { - remote_state[0] |= GREE_PRESET_SLEEP_BIT; - } + if (this->preset_() == GREE_PRESET_SLEEP) { + remote_state[0] |= GREE_PRESET_SLEEP_BIT; } // Calculate the checksum @@ -228,8 +231,8 @@ uint8_t GreeClimate::temperature_() { } uint8_t GreeClimate::preset_() { - // YX1FF has sleep preset - if (this->model_ == GREE_YX1FF) { + // YX1FF and YAC1FB9 have sleep preset + if (this->model_ == GREE_YX1FF || this->model_ == GREE_YAC1FB9) { switch (this->preset.value_or(climate::CLIMATE_PRESET_NONE)) { case climate::CLIMATE_PRESET_NONE: return GREE_PRESET_NONE; diff --git a/esphome/components/gree/gree.h b/esphome/components/gree/gree.h index a85878e764d..fedd6ecee92 100644 --- a/esphome/components/gree/gree.h +++ b/esphome/components/gree/gree.h @@ -69,9 +69,12 @@ static constexpr uint8_t GREE_HDIR_MRIGHT = 0x05; static constexpr uint8_t GREE_HDIR_RIGHT = 0x06; // Only available on YX1FF -// Turbo (high) fan mode + sleep preset mode +// Turbo (high) fan mode static constexpr uint8_t GREE_FAN_TURBO = 0x80; static constexpr uint8_t GREE_FAN_TURBO_BIT = 0x10; + +// Available on YX1FF and YAC1FB9 +// Sleep preset mode static constexpr uint8_t GREE_PRESET_NONE = 0x00; static constexpr uint8_t GREE_PRESET_SLEEP = 0x01; static constexpr uint8_t GREE_PRESET_SLEEP_BIT = 0x80; diff --git a/tests/components/gree/validate-yac1fb9.esp32-idf.yaml b/tests/components/gree/validate-yac1fb9.esp32-idf.yaml new file mode 100644 index 00000000000..69e1d8c6f47 --- /dev/null +++ b/tests/components/gree/validate-yac1fb9.esp32-idf.yaml @@ -0,0 +1,8 @@ +packages: + remote_transmitter: !include ../../test_build_components/common/remote_transmitter/esp32-idf.yaml + +climate: + - platform: gree + name: GREE + transmitter_id: xmitr + model: YAC1FB9