From ba5db23ae6a20f4d85393b143f825c1d134b9a67 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Thu, 31 Aug 2023 20:08:29 +0200 Subject: [PATCH] Optimize `wake_up_display` service --- nspanel_esphome.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml index a2b7f2e..956551d 100644 --- a/nspanel_esphome.yaml +++ b/nspanel_esphome.yaml @@ -386,10 +386,13 @@ api: reset_timer: bool then: - lambda: |- - if (id(current_page).state == "screensaver") id(disp1).send_command_printf("page %i", id(wakeup_page_id)); + if (id(current_page).state == "home") + { + id(disp1).send_command_printf("home.dimtimer.en=1"); + id(disp1).send_command_printf("home.sleeptimer.en=1"); + } + else 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 ####