Support to wake-up page on wake_up_display service

This changes the behavior of a service introduced by #734.
This commit is contained in:
Edward Firmo
2023-08-31 19:59:59 +02:00
parent 7642088db0
commit 32b62adc96
2 changed files with 11 additions and 29 deletions

View File

@@ -383,33 +383,14 @@ api:
##### SERVICE TO WAKE UP THE DISPLAY #####
- service: wake_up_display
variables:
option: string
reset_timer: bool
then:
- lambda: |-
DynamicJsonDocument doc(1024);
deserializeJson(doc, id(disp1_nspanel_event).state);
std::string page = doc["page"];
if (page == "screensaver") {
id(disp1).send_command_printf("page home");
} else {
if (page == "home"){
id(disp1).send_command_printf("dim=brightness");
}
}
- if:
condition:
- lambda: 'return option == "keep_wake";'
then:
- lambda: id(disp1).send_command_printf("home.dimtimer.en=1");
- lambda: id(disp1).send_command_printf("home.sleeptimer.en=1");
- if:
condition:
- lambda: 'return option == "keep_page";'
then:
- lambda: id(disp1).send_command_printf("home.dimtimer.en=1");
- lambda: id(disp1).send_command_printf("home.sleeptimer.en=1");
- lambda: |-
id(page_timer)->execute(int(id(page_timeout).state));
if (id(current_page).state == "screensaver") id(disp1).send_command_printf("page %i", id(wakeup_page_id));
id(disp1).send_command_printf("dim=brightness");
id(disp1).send_command_printf("home.dimtimer.en=1");
id(disp1).send_command_printf("home.sleeptimer.en=1");
if (reset_timer) id(page_timer)->execute(int(id(page_timeout).state));
#### Service to set the entities ####
- service: set_entity