Vertical and horizontal airflow actions fix for Haier climate (#5164)

Co-authored-by: Pavlo Dudnytskyi <pdudnytskyi@astrata.eu>
This commit is contained in:
Pavlo Dudnytskyi 2023-08-02 01:06:23 +02:00 committed by GitHub
parent cb8ca433d9
commit 8c66de2391
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 12 deletions

View file

@ -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 = {

View file

@ -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->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->set_force_send_control_(true);
}