From 8c66de239191fe4e5eed9a5defe49e31a094442e Mon Sep 17 00:00:00 2001 From: Pavlo Dudnytskyi Date: Wed, 2 Aug 2023 01:06:23 +0200 Subject: [PATCH] Vertical and horizontal airflow actions fix for Haier climate (#5164) Co-authored-by: Pavlo Dudnytskyi --- esphome/components/haier/climate.py | 9 +++++++-- esphome/components/haier/hon_climate.cpp | 12 ++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/esphome/components/haier/climate.py b/esphome/components/haier/climate.py index 12b76084ba..c518282bfa 100644 --- a/esphome/components/haier/climate.py +++ b/esphome/components/haier/climate.py @@ -54,18 +54,23 @@ HonClimate = haier_ns.class_("HonClimate", HaierClimateBase) Smartair2Climate = haier_ns.class_("Smartair2Climate", HaierClimateBase) -AirflowVerticalDirection = haier_ns.enum("AirflowVerticalDirection") +AirflowVerticalDirection = haier_ns.enum("AirflowVerticalDirection", True) AIRFLOW_VERTICAL_DIRECTION_OPTIONS = { + "HEALTH_UP": AirflowVerticalDirection.HEALTH_UP, + "MAX_UP": AirflowVerticalDirection.MAX_UP, "UP": AirflowVerticalDirection.UP, "CENTER": AirflowVerticalDirection.CENTER, "DOWN": AirflowVerticalDirection.DOWN, + "HEALTH_DOWN": AirflowVerticalDirection.HEALTH_DOWN, } -AirflowHorizontalDirection = haier_ns.enum("AirflowHorizontalDirection") +AirflowHorizontalDirection = haier_ns.enum("AirflowHorizontalDirection", True) AIRFLOW_HORIZONTAL_DIRECTION_OPTIONS = { + "MAX_LEFT": AirflowHorizontalDirection.MAX_LEFT, "LEFT": AirflowHorizontalDirection.LEFT, "CENTER": AirflowHorizontalDirection.CENTER, "RIGHT": AirflowHorizontalDirection.RIGHT, + "MAX_RIGHT": AirflowHorizontalDirection.MAX_RIGHT, } SUPPORTED_SWING_MODES_OPTIONS = { diff --git a/esphome/components/haier/hon_climate.cpp b/esphome/components/haier/hon_climate.cpp index 3016cda397..3950b34724 100644 --- a/esphome/components/haier/hon_climate.cpp +++ b/esphome/components/haier/hon_climate.cpp @@ -81,22 +81,14 @@ void HonClimate::set_outdoor_temperature_sensor(esphome::sensor::Sensor *sensor) AirflowVerticalDirection HonClimate::get_vertical_airflow() const { return this->vertical_direction_; }; void HonClimate::set_vertical_airflow(AirflowVerticalDirection direction) { - if (direction > AirflowVerticalDirection::DOWN) { - this->vertical_direction_ = AirflowVerticalDirection::CENTER; - } else { - this->vertical_direction_ = direction; - } + this->vertical_direction_ = direction; this->set_force_send_control_(true); } AirflowHorizontalDirection HonClimate::get_horizontal_airflow() const { return this->horizontal_direction_; } void HonClimate::set_horizontal_airflow(AirflowHorizontalDirection direction) { - if (direction > AirflowHorizontalDirection::RIGHT) { - this->horizontal_direction_ = AirflowHorizontalDirection::CENTER; - } else { - this->horizontal_direction_ = direction; - } + this->horizontal_direction_ = direction; this->set_force_send_control_(true); }