From f3cfa2c8edf377ed5b6cdb2873edccb35b1173ff Mon Sep 17 00:00:00 2001 From: denes44 <60078357+denes44@users.noreply.github.com> Date: Wed, 26 Apr 2023 23:11:05 +0200 Subject: [PATCH] Wake up panel service call (#734) * Add service call for waking up the display * Option to reset the sleep and page timers --- nspanel_esphome.yaml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml index 37ac56a..d03d3f5 100644 --- a/nspanel_esphome.yaml +++ b/nspanel_esphome.yaml @@ -372,6 +372,40 @@ api: } else { id(disp1).set_component_text_printf(btnbri.c_str(), " "); } + ##### SERVICE TO WAKE UP THE DISPLAY ##### + - service: wake_up_display + variables: + option: string + then: + - if: + condition: + text_sensor.state: + id: disp1_currentpage + state: 'screensaver' + then: + - lambda: id(disp1).send_command_printf("page home"); + else: + - if: + condition: + text_sensor.state: + id: disp1_currentpage + state: 'home' + then: + - lambda: id(disp1).send_command_printf("dim=brightness.val"); + - 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)); #### Service to set the entities #### - service: set_entity