kinderhandy: screen off & better timer pause visualization

This commit is contained in:
2026-01-03 22:07:59 +01:00
parent de2bdd9b53
commit 37e387f0e1

View File

@@ -1,3 +1,9 @@
# TODO:
# - auto turn off
# - navigation bar at bottom
# - buttons for home assistant actions
substitutions: substitutions:
device_name: kinderhandy device_name: kinderhandy
friendly_name: Kinder Handy friendly_name: Kinder Handy
@@ -28,7 +34,7 @@ light:
- platform: monochromatic - platform: monochromatic
output: backlight_pwm output: backlight_pwm
name: Display Backlight name: Display Backlight
id: backlight id: display_backlight
restore_mode: ALWAYS_ON restore_mode: ALWAYS_ON
@@ -73,6 +79,14 @@ touchscreen:
transform: transform:
swap_xy: false swap_xy: false
mirror_x: true 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: # on_touch:
# - lambda: |- # - lambda: |-
# ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d", # ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
@@ -94,11 +108,34 @@ globals:
type: bool type: bool
initial_value: 'false' 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 # Display
# ============================================================ # ============================================================
lvgl: 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% buffer_size: 50%
widgets: widgets:
- label: - label:
@@ -123,12 +160,21 @@ lvgl:
value: 'false' value: 'false'
- logger.log: - logger.log:
format: "Pause" format: "Pause"
- lvgl.arc.update:
id: arc_timer
indicator:
arc_color: 0x0000EE
else: else:
- globals.set: - globals.set:
id: timer_running id: timer_running
value: 'true' value: 'true'
- logger.log: - logger.log:
format: "Gestartet" format: "Gestartet"
- lvgl.arc.update:
id: arc_timer
value: !lambda return id(timer_seconds);
indicator:
arc_color: 0xFF0000
on_long_press: on_long_press:
then: then:
- globals.set: - globals.set: