mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 18:24:13 +01:00
Vertical and horizontal airflow actions fix for Haier climate (#5164)
Co-authored-by: Pavlo Dudnytskyi <pdudnytskyi@astrata.eu>
This commit is contained in:
parent
cb8ca433d9
commit
8c66de2391
2 changed files with 9 additions and 12 deletions
|
@ -54,18 +54,23 @@ HonClimate = haier_ns.class_("HonClimate", HaierClimateBase)
|
||||||
Smartair2Climate = haier_ns.class_("Smartair2Climate", HaierClimateBase)
|
Smartair2Climate = haier_ns.class_("Smartair2Climate", HaierClimateBase)
|
||||||
|
|
||||||
|
|
||||||
AirflowVerticalDirection = haier_ns.enum("AirflowVerticalDirection")
|
AirflowVerticalDirection = haier_ns.enum("AirflowVerticalDirection", True)
|
||||||
AIRFLOW_VERTICAL_DIRECTION_OPTIONS = {
|
AIRFLOW_VERTICAL_DIRECTION_OPTIONS = {
|
||||||
|
"HEALTH_UP": AirflowVerticalDirection.HEALTH_UP,
|
||||||
|
"MAX_UP": AirflowVerticalDirection.MAX_UP,
|
||||||
"UP": AirflowVerticalDirection.UP,
|
"UP": AirflowVerticalDirection.UP,
|
||||||
"CENTER": AirflowVerticalDirection.CENTER,
|
"CENTER": AirflowVerticalDirection.CENTER,
|
||||||
"DOWN": AirflowVerticalDirection.DOWN,
|
"DOWN": AirflowVerticalDirection.DOWN,
|
||||||
|
"HEALTH_DOWN": AirflowVerticalDirection.HEALTH_DOWN,
|
||||||
}
|
}
|
||||||
|
|
||||||
AirflowHorizontalDirection = haier_ns.enum("AirflowHorizontalDirection")
|
AirflowHorizontalDirection = haier_ns.enum("AirflowHorizontalDirection", True)
|
||||||
AIRFLOW_HORIZONTAL_DIRECTION_OPTIONS = {
|
AIRFLOW_HORIZONTAL_DIRECTION_OPTIONS = {
|
||||||
|
"MAX_LEFT": AirflowHorizontalDirection.MAX_LEFT,
|
||||||
"LEFT": AirflowHorizontalDirection.LEFT,
|
"LEFT": AirflowHorizontalDirection.LEFT,
|
||||||
"CENTER": AirflowHorizontalDirection.CENTER,
|
"CENTER": AirflowHorizontalDirection.CENTER,
|
||||||
"RIGHT": AirflowHorizontalDirection.RIGHT,
|
"RIGHT": AirflowHorizontalDirection.RIGHT,
|
||||||
|
"MAX_RIGHT": AirflowHorizontalDirection.MAX_RIGHT,
|
||||||
}
|
}
|
||||||
|
|
||||||
SUPPORTED_SWING_MODES_OPTIONS = {
|
SUPPORTED_SWING_MODES_OPTIONS = {
|
||||||
|
|
|
@ -81,22 +81,14 @@ void HonClimate::set_outdoor_temperature_sensor(esphome::sensor::Sensor *sensor)
|
||||||
AirflowVerticalDirection HonClimate::get_vertical_airflow() const { return this->vertical_direction_; };
|
AirflowVerticalDirection HonClimate::get_vertical_airflow() const { return this->vertical_direction_; };
|
||||||
|
|
||||||
void HonClimate::set_vertical_airflow(AirflowVerticalDirection direction) {
|
void HonClimate::set_vertical_airflow(AirflowVerticalDirection direction) {
|
||||||
if (direction > AirflowVerticalDirection::DOWN) {
|
this->vertical_direction_ = direction;
|
||||||
this->vertical_direction_ = AirflowVerticalDirection::CENTER;
|
|
||||||
} else {
|
|
||||||
this->vertical_direction_ = direction;
|
|
||||||
}
|
|
||||||
this->set_force_send_control_(true);
|
this->set_force_send_control_(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
AirflowHorizontalDirection HonClimate::get_horizontal_airflow() const { return this->horizontal_direction_; }
|
AirflowHorizontalDirection HonClimate::get_horizontal_airflow() const { return this->horizontal_direction_; }
|
||||||
|
|
||||||
void HonClimate::set_horizontal_airflow(AirflowHorizontalDirection direction) {
|
void HonClimate::set_horizontal_airflow(AirflowHorizontalDirection direction) {
|
||||||
if (direction > AirflowHorizontalDirection::RIGHT) {
|
this->horizontal_direction_ = direction;
|
||||||
this->horizontal_direction_ = AirflowHorizontalDirection::CENTER;
|
|
||||||
} else {
|
|
||||||
this->horizontal_direction_ = direction;
|
|
||||||
}
|
|
||||||
this->set_force_send_control_(true);
|
this->set_force_send_control_(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue