From 479396fa46145491f907c62455ecdd8465194c33 Mon Sep 17 00:00:00 2001 From: Blackymas Date: Thu, 17 Nov 2022 09:49:58 +0100 Subject: [PATCH] current_page preload --- esphome.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/esphome.yaml b/esphome.yaml index 8794edb..0d007f8 100644 --- a/esphome.yaml +++ b/esphome.yaml @@ -364,6 +364,11 @@ globals: restore_value: no initial_value: '' + ##### lastclick_ccurrentpage State ##### + - id: currentpage_global + type: std::string + restore_value: no + initial_value: '' ##### START - BINARY SENSOR CONFIGURATION ##### binary_sensor: @@ -604,6 +609,27 @@ text_sensor: id: lastclick_climatesettings_global value: !lambda return x; + ##### currentpage sensor, the main action variable - push to HA ##### + - platform: nextion + nextion_id: disp1 + name: ${device_name} current Page New + id: disp1_currentpage_new + update_interval: 50ms + component_name: current_p_va + internal: false + filters: + - lambda: |- + if (strcmp(x.c_str(), id(currentpage_global).c_str()) != 0) { + return x; + } else { + return {}; + } + on_value: + then: + - globals.set: + id: currentpage_global + value: !lambda return x; + ##### START - SWITCH CONFIGURATION ##### switch: