Manage indoor temp and weather icon as buttons

Solves #2056
This commit is contained in:
Edward Firmo
2024-04-24 15:46:11 +02:00
parent 72d4cd4b01
commit c4b91b8ea0
10 changed files with 157 additions and 23 deletions

View File

@@ -988,18 +988,6 @@ display:
break;
}
break;
case 1: // Home
switch (component_id) {
case 4: // indr_temp
case 27: // indr_temp_icon
if (id(is_climate) and !touch_event) { // Release
detailed_entity->publish_state((id(is_embedded_thermostat)) ? "embedded_climate" : "");
disp1->set_component_value("climate.embedded", id(is_embedded_thermostat) ? 1 : 0);
goto_page->execute("climate");
}
break;
}
break;
case 8: // Settings
switch (component_id) {
case 9: // Reboot button
@@ -1903,7 +1891,15 @@ text_sensor:
esphome::api::CustomAPIDevice ha_event;
// Send event to Home Assistant
if (event == "short_click" or event == "long_click") {
ha_button->execute(page.c_str(), component.c_str(), event.c_str());
if (api_server->is_connected() and page == "home" and component == "weather") {
goto_page->execute("weather01");
} else if (id(is_climate) and page == "home" and (component == "indr_temp" or component == "indr_temp_icon")) {
detailed_entity->publish_state((id(is_embedded_thermostat)) ? "embedded_climate" : "");
disp1->set_component_value("climate.embedded", id(is_embedded_thermostat) ? 1 : 0);
goto_page->execute("climate");
} else {
ha_button->execute(page.c_str(), component.c_str(), event.c_str());
}
} else if (page == "light" or page == "climate") { // Generic event
ha_event.fire_homeassistant_event("esphome.nspanel_ha_blueprint", {
{"device_name", device_name->state.c_str()},
@@ -2374,10 +2370,7 @@ script:
parameters:
page: string
then:
- lambda: |-
if (current_page->state != page) {
disp1->goto_page(page.c_str());
}
- lambda: if (current_page->state != page) disp1->goto_page(page.c_str());
- id: ha_button
mode: parallel