Fix page_changed on customizations

This commit is contained in:
Edward Firmo
2024-03-17 02:26:44 +01:00
parent 79573eb541
commit 05bb498e34
2 changed files with 6 additions and 6 deletions

View File

@@ -133,12 +133,12 @@ script:
- id: !extend page_changed
then:
- lambda: |-
ESP_LOGD("script.page_changed(custom)", "page: %s", page.c_str());
ESP_LOGD("script.page_changed(custom)", "page: %s", current_page->state.c_str());
ESP_LOGV("script.page_changed(custom)", "is_on(): %s", display_light->current_values.is_on() ? "True" : "False");
if (page == "screensaver" and display_light->current_values.is_on()) {
if (current_page->state == "screensaver" and display_light->current_values.is_on()) {
auto call = display_light->turn_off();
call.perform();
} else if (page != "screensaver" and (not display_light->current_values.is_on())) {
} else if (current_page->state != "screensaver" and (not display_light->current_values.is_on())) {
auto call = display_light->turn_on();
call.perform();
}

View File

@@ -432,12 +432,12 @@ script:
- id: !extend page_changed
then:
- lambda: |-
ESP_LOGD("script.page_changed(custom)", "page: %s", page.c_str());
ESP_LOGD("script.page_changed(custom)", "page: %s", current_page->state.c_str());
ESP_LOGV("script.page_changed(custom)", "is_on(): %s", display_light->current_values.is_on() ? "True" : "False");
if (page == "screensaver" and display_light->current_values.is_on()) {
if (current_page->state == "screensaver" and display_light->current_values.is_on()) {
auto call = display_light->turn_off();
call.perform();
} else if (page != "screensaver" and (not display_light->current_values.is_on())) {
} else if (current_page->state != "screensaver" and (not display_light->current_values.is_on())) {
auto call = display_light->turn_on();
call.perform();
}