Fix climate page not opening when offline

Solves https://github.com/Blackymas/NSPanel_HA_Blueprint/discussions/995#discussioncomment-6834067
This commit is contained in:
Edward Firmo
2023-09-18 16:39:22 +02:00
parent 8859d8b229
commit ee5ccd0bff
13 changed files with 17 additions and 9 deletions

View File

@@ -852,7 +852,7 @@ api:
id(last_media_position) = media_position;
id(disp1).set_component_value("prg_current", int(round(min(media_position + media_position_delta, media_duration))));
}
id(disp1).set_component_value("prg_total", media_duration);
id(disp1).set_component_value("prg_total", int(round(media_duration)));
id(disp1).send_command_printf("prg_timer.en=%i", (state == "playing") ? 1 : 0);
id(disp1).show_component("time_current");
id(disp1).show_component("time_total");
@@ -1357,7 +1357,7 @@ text_sensor:
{"entity", entity}
});
ESP_LOGV("text_sensor.nspanelevent", "Call add-ons scripts for new page");
id(addon_climate_set_climate).execute(page=="climate" and entity=="embedded_climate");
id(addon_climate_set_climate).execute(page=="climate" and entity == "embedded_climate");
ESP_LOGV("text_sensor.nspanelevent", "Publish current_page sensor");
id(current_page).publish_state(page);
ESP_LOGV("text_sensor.nspanelevent", "Construct new page");
@@ -1497,7 +1497,11 @@ text_sensor:
else if (event=="short_click" or event=="long_click") id(ha_button).execute(page.c_str(), component.c_str(), event.c_str());
else if (event=="click")
{
if (page == "home" and component == "climate") id(entity_id) = (id(is_embedded_thermostat)) ? "embedded_climate" : "";
if (page == "home" and component == "climate")
{
id(entity_id) = (id(is_embedded_thermostat)) ? "embedded_climate" : "";
id(disp1).set_component_value("climate.embedded", (id(is_embedded_thermostat)) ? 1 : 0);
}
id(disp1).goto_page("climate");
}
else if (page == "light" or page == "climate" or page == "notification")// Generic event