From 05bb498e34afaca06f92f6e2f30707b7c55e01a8 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Sun, 17 Mar 2024 02:26:44 +0100 Subject: [PATCH] Fix `page_changed` on customizations --- .test/esphome_advanced_climate_heat_customizations.yaml | 6 +++--- docs/customization.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.test/esphome_advanced_climate_heat_customizations.yaml b/.test/esphome_advanced_climate_heat_customizations.yaml index bda1da3..7227c97 100644 --- a/.test/esphome_advanced_climate_heat_customizations.yaml +++ b/.test/esphome_advanced_climate_heat_customizations.yaml @@ -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(); } diff --git a/docs/customization.md b/docs/customization.md index fd3e241..f2e3175 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -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(); }