From 37e387f0e1414e1914bdb2bc89a64666b132b5cc Mon Sep 17 00:00:00 2001 From: Martin Bauer Date: Sat, 3 Jan 2026 22:07:59 +0100 Subject: [PATCH] kinderhandy: screen off & better timer pause visualization --- kinderhandy.yaml | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/kinderhandy.yaml b/kinderhandy.yaml index b107f36..078a61f 100644 --- a/kinderhandy.yaml +++ b/kinderhandy.yaml @@ -1,3 +1,9 @@ +# TODO: +# - auto turn off +# - navigation bar at bottom +# - buttons for home assistant actions + + substitutions: device_name: kinderhandy friendly_name: Kinder Handy @@ -28,7 +34,7 @@ light: - platform: monochromatic output: backlight_pwm name: Display Backlight - id: backlight + id: display_backlight restore_mode: ALWAYS_ON @@ -73,6 +79,14 @@ touchscreen: transform: swap_xy: false mirror_x: true + on_release: + - if: + condition: lvgl.is_paused + then: + - logger.log: "LVGL resuming" + - lvgl.resume: + - lvgl.widget.redraw: + - light.turn_on: display_backlight # on_touch: # - lambda: |- # ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d", @@ -94,11 +108,34 @@ globals: type: bool initial_value: 'false' +# ============================================================ +# Variables +# ============================================================ + +number: + - platform: template + name: LVGL Screen timeout + optimistic: true + id: display_timeout + unit_of_measurement: "s" + initial_value: 45 + restore_value: true + min_value: 10 + max_value: 180 + step: 5 + mode: box + # ============================================================ # Display # ============================================================ lvgl: + on_idle: + timeout: !lambda "return (id(display_timeout).state * 1000);" + then: + - logger.log: "LVGL is idle" + - light.turn_off: display_backlight + - lvgl.pause: buffer_size: 50% widgets: - label: @@ -123,12 +160,21 @@ lvgl: value: 'false' - logger.log: format: "Pause" + - lvgl.arc.update: + id: arc_timer + indicator: + arc_color: 0x0000EE else: - globals.set: id: timer_running value: 'true' - logger.log: format: "Gestartet" + - lvgl.arc.update: + id: arc_timer + value: !lambda return id(timer_seconds); + indicator: + arc_color: 0xFF0000 on_long_press: then: - globals.set: