Skip to content

Commit

Permalink
Added vertical airflow select implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavlo Dudnytskyi committed Sep 13, 2024
1 parent 2060961 commit 39a017a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
25 changes: 25 additions & 0 deletions components/haier/select/vertical_airflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@ namespace esphome {
namespace haier {

void VerticalAirflowSelect::control(const std::string &value) {
hon_protocol::VerticalSwingMode state;
if (value == "Auto") {
state = hon_protocol::VerticalSwingMode::AUTO;
} else if (value == "Health Up") {
state = hon_protocol::VerticalSwingMode::HEALTH_UP;
} else if (value == "Max Up") {
state = hon_protocol::VerticalSwingMode::MAX_UP;
} else if (value == "Up") {
state = hon_protocol::VerticalSwingMode::UP;
} else if (value == "Center") {
state = hon_protocol::VerticalSwingMode::CENTER;
} else if (value == "Down") {
state = hon_protocol::VerticalSwingMode::DOWN;
} else if (value == "Max Down") {
state = hon_protocol::VerticalSwingMode::MAX_DOWN;
} else if (value == "Health Down") {
state = hon_protocol::VerticalSwingMode::HEALTH_DOWN;
} else {
ESP_LOGE("haier", "Invalid vertical airflow mode: %s", value.c_str());
return;
}
const esphome::optional<hon_protocol::VerticalSwingMode> current_state = this->parent_->get_vertical_airflow();
if (!current_state.has_value() || (current_state.value() != state)) {
this->parent_->set_vertical_airflow(state);
}
this->publish_state(value);
}

Expand Down
6 changes: 3 additions & 3 deletions docs/script/make_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import os
import sys

doc_file_path = [
doc_file_path = [
"/".join(["esphome-docs", "climate", "haier.rst"]),
"/".join(["esphome-docs", "sensor", "haier.rst"]),
"/".join(["esphome-docs", "binary_sensor", "haier.rst"]),
"/".join(["esphome-docs", "text_sensor", "haier.rst"]),
"/".join(["esphome-docs", "button", "haier.rst"]),
"/".join(["esphome-docs", "switch", "haier.rst"]),
"/".join(["esphome-docs", "switch", "haier.rst"]),
"esp32_backup.rst",
"additional_information.rst",
]
Expand All @@ -29,7 +29,7 @@ def process_esphome_refs(line, l_num):
(":ref:`Text Sensor <config-text_sensor>`", "`Text Sensor <https://esphome.io/components/text_sensor/index.html#base-text-sensor-configuration>`_"),
(":ref:`Button <config-button>`", "`Button <https://esphome.io/components/button/index.html#base-button-configuration>`_"),
(":ref:`Switch <config-switch>`", "`Switch <https://esphome.io/components/switch/index.html#base-switch-configuration>`_"),

(":ref:`Select <config-select>`", "`Select <https://esphome.io/components/select/index.html#base-select-configuration>`_"),
]
res = line
for o, r in esphome_refs:
Expand Down

0 comments on commit 39a017a

Please sign in to comment.