From 5b287303f1a193d7b214e8b40ebf4ffa1f833a60 Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Thu, 28 May 2026 22:58:15 +0200 Subject: [PATCH] Add backlight idle script --- esphome/lab-ble-proxy.yaml | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/esphome/lab-ble-proxy.yaml b/esphome/lab-ble-proxy.yaml index 40939f4..22d203e 100644 --- a/esphome/lab-ble-proxy.yaml +++ b/esphome/lab-ble-proxy.yaml @@ -79,6 +79,34 @@ globals: initial_value: "false" restore_value: no +script: + - id: wake_backlight + mode: restart + then: + - script.stop: backlight_idle + - light.turn_on: + id: backlight + brightness: 100% + - id: backlight_idle + mode: restart + then: + - delay: 2min + - if: + condition: + lambda: |- + return !owon_meter.connected && !id(atorch_connected); + then: + - light.turn_on: + id: backlight + brightness: 50% + - delay: 3min + - if: + condition: + lambda: |- + return !owon_meter.connected && !id(atorch_connected); + then: + - light.turn_off: backlight + interval: - interval: 10s then: @@ -103,6 +131,7 @@ ble_client: id: owon_ble_client on_connect: then: + - script.execute: wake_backlight - lambda: |- owon_meter.on_connect(); id(display_page) = 0; @@ -115,11 +144,18 @@ ble_client: id(display_page) = 1; } id(lcd).update(); + - if: + condition: + lambda: |- + return !owon_meter.connected && !id(atorch_connected); + then: + - script.execute: backlight_idle - mac_address: ${dl24_mac_address} id: atorch_ble_client on_connect: then: + - script.execute: wake_backlight - lambda: |- id(atorch_connected) = true; id(display_page) = 1; @@ -132,6 +168,12 @@ ble_client: id(display_page) = 0; } id(lcd).update(); + - if: + condition: + lambda: |- + return !owon_meter.connected && !id(atorch_connected); + then: + - script.execute: backlight_idle atorch_dl24: - id: atorch0 @@ -291,6 +333,15 @@ touchscreen: - platform: ft63x6 id: touch display: lcd + on_touch: + then: + - script.execute: wake_backlight + - if: + condition: + lambda: |- + return !owon_meter.connected && !id(atorch_connected); + then: + - script.execute: backlight_idle binary_sensor: - platform: touchscreen