Fix Climate page when embedded climate

And also added a lot of logs which should be removed later as it takes from memory.

Solves https://github.com/Blackymas/NSPanel_HA_Blueprint/discussions/995#discussioncomment-6835260
This commit is contained in:
Edward Firmo
2023-08-29 11:55:50 +02:00
parent 44f233fa26
commit f29eeda845
4 changed files with 90 additions and 27 deletions

View File

@@ -63,15 +63,15 @@ script:
- id: !extend addon_climate_update_page_home
mode: restart
then:
- lambda: ESP_LOGV("script.addon_climate_update_page_home", "Starting");
- if:
condition:
- binary_sensor.is_on: nextion_init
then:
- lambda: |-
// Update home.entity variable
ESP_LOGV("script.addon_climate_update_page_home", "Update home.entity variable: %s", (id(is_embedded_thermostat)) ? "embedded_climate" : "");
id(disp1).set_component_text_printf("home.entity", (id(is_embedded_thermostat)) ? "embedded_climate" : "");
//if (id(is_embedded_thermostat)) id(disp1).set_component_text_printf("home.entity", "embedded_climate");
//else id(disp1).set_component_text_printf("home.entity", "");
- if:
condition:
@@ -79,6 +79,7 @@ script:
then:
- lambda: |-
// Update chips
ESP_LOGV("script.addon_climate_update_page_home", "Update chips");
ESP_LOGV("script.refresh_chips_climate", "thermostat_embedded.action=%i", int(id(thermostat_embedded).action));
switch (int(id(thermostat_embedded).action)) // CLIMATE_ACTION_OFF = 0, CLIMATE_ACTION_COOLING = 2, CLIMATE_ACTION_HEATING = 3, CLIMATE_ACTION_IDLE = 4, CLIMATE_ACTION_DRYING = 5, CLIMATE_ACTION_FAN = 6
{
@@ -136,6 +137,7 @@ script:
id(disp1).set_component_font_color("home.icon_top_03", 1530);
break;
}
- lambda: ESP_LOGV("script.addon_climate_update_page_home", "Finished");
- id: !extend addon_climate_service_call
then:
@@ -158,6 +160,7 @@ script:
then:
- lambda: |-
ESP_LOGV("script.addon_climate_set_climate", "Starting");
ESP_LOGV("script.addon_climate_set_climate", "embedded_climate: %i", (embedded_climate) ? 1 : 0);
id(is_addon_climate_visible) = embedded_climate;
ESP_LOGV("script.addon_climate_set_climate", "Finished");
@@ -165,19 +168,24 @@ script:
then:
- lambda: |-
ESP_LOGV("script.addon_climate_global_settings", "Starting");
ESP_LOGV("script.addon_climate_global_settings", "embedded_climate: %i", (embedded_climate) ? 1 : 0);
id(is_embedded_thermostat) = embedded_climate;
ESP_LOGV("script.addon_climate_global_settings", "Finished");
- id: !extend addon_climate_update_page_climate
then:
- lambda: ESP_LOGV("script.addon_climate_update_page_climate", "Starting");
- lambda: |-
ESP_LOGV("script.addon_climate_update_page_climate", "Starting");
ESP_LOGV("script.addon_climate_update_page_climate", "nextion_init: %i", (id(nextion_init)) ? 1 : 0);
ESP_LOGV("script.addon_climate_update_page_climate", "current_page: %s", id(current_page).state.c_str());
ESP_LOGV("script.addon_climate_update_page_climate", "is_addon_climate_visible: %i", (id(is_addon_climate_visible)) ? 1 : 0);
- if:
condition:
- binary_sensor.is_on: nextion_init
- text_sensor.state: # Is climate page visible?
id: current_page
state: 'climate'
- lambda: !lambda return id(is_addon_climate_visible);
- lambda: !lambda return (id(is_addon_climate_visible));
then: # Embedded thermostat is visible
# Update slider, current temperature & target temperature
- script.execute: