Fix page_changed on customizations
This commit is contained in:
@@ -133,12 +133,12 @@ script:
|
|||||||
- id: !extend page_changed
|
- id: !extend page_changed
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- 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");
|
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();
|
auto call = display_light->turn_off();
|
||||||
call.perform();
|
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();
|
auto call = display_light->turn_on();
|
||||||
call.perform();
|
call.perform();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -432,12 +432,12 @@ script:
|
|||||||
- id: !extend page_changed
|
- id: !extend page_changed
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- 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");
|
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();
|
auto call = display_light->turn_off();
|
||||||
call.perform();
|
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();
|
auto call = display_light->turn_on();
|
||||||
call.perform();
|
call.perform();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user