From 7b23050791a3cfc810bf5d23c193e23fbdb65e4a Mon Sep 17 00:00:00 2001 From: deejaybeam Date: Wed, 1 Feb 2023 19:20:37 +0100 Subject: [PATCH] upd: remove global variable touchevent --- nspanel_esphome.yaml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml index 6f7fa76..cc84601 100644 --- a/nspanel_esphome.yaml +++ b/nspanel_esphome.yaml @@ -333,12 +333,6 @@ globals: restore_value: no initial_value: '' - ##### lastclick_touchevent State ##### - - id: touchevent_global - type: std::string - restore_value: no - initial_value: '' - ##### START - BINARY SENSOR CONFIGURATION ##### binary_sensor: @@ -670,28 +664,27 @@ text_sensor: ##### touchevent sensor, Reset the page timeout ##### - platform: nextion nextion_id: disp1 - name: ${device_name} touchevent + #name: ${device_name} touchevent id: disp1_touchevent update_interval: 50ms component_name: touchevent internal: true filters: - lambda: |- - if (strcmp(x.c_str(), id(touchevent_global).c_str()) != 0) { + static std::string touchevent_history = ""; + if (strcmp(x.c_str(), touchevent_history.c_str()) != 0) { + touchevent_history = x; return x; + // touchevent_history = ""; } else { return {}; } on_value: then: - - globals.set: - id: touchevent_global - value: !lambda return x; - lambda: |- id(page_timer)->execute(int(id(page_timeout).state)); - ##### START - SWITCH CONFIGURATION ##### switch: