lvgl trainer: add display idle

This commit is contained in:
randy committed 2026-10-27 21:16:06 +01:00
1 parent 5e7e4f065e
commit 6389bbdcef
1 file changed
+27 -8
+27 -8
View File
@@ -109,14 +109,7 @@ touchscreen:
# no calibration/transform: the driver defaults to the native 320x480 panel and # no calibration/transform: the driver defaults to the native 320x480 panel and
# LVGL applies its own rotation to touch points # LVGL applies its own rotation to touch points
on_release: on_release:
- if: - script.execute: display_idle
condition: lvgl.is_paused
then:
- lvgl.resume:
- lvgl.widget.redraw:
- light.turn_on:
id: display_backlight
transition_length: 300ms
uart: uart:
- id: ext_uart - id: ext_uart
@@ -136,6 +129,7 @@ binary_sensor:
id: basement_light_btn id: basement_light_btn
state: state:
checked: !lambda return x; checked: !lambda return x;
- script.execute: display_idle
- platform: homeassistant - platform: homeassistant
id: workbench_light id: workbench_light
entity_id: ${light_workbench} entity_id: ${light_workbench}
@@ -145,6 +139,7 @@ binary_sensor:
id: workbench_light_btn id: workbench_light_btn
state: state:
checked: !lambda return x; checked: !lambda return x;
- script.execute: display_idle
- platform: homeassistant - platform: homeassistant
id: exercise_light id: exercise_light
entity_id: ${light_exercise} entity_id: ${light_exercise}
@@ -154,6 +149,7 @@ binary_sensor:
id: exercise_light_btn id: exercise_light_btn
state: state:
checked: !lambda return x; checked: !lambda return x;
- script.execute: display_idle
# brightness and color temperature only make sense while the light is on # brightness and color temperature only make sense while the light is on
- if: - if:
condition: condition:
@@ -218,6 +214,29 @@ text_sensor:
- script.execute: update_training_status - script.execute: update_training_status
script: script:
# wakes the display, then turns it off once all basement lights stay off for 5 min;
# restarted by every light change and touch
- id: display_idle
mode: restart
then:
- if:
condition: lvgl.is_paused
then:
- lvgl.resume:
- lvgl.widget.redraw:
- light.turn_on:
id: display_backlight
transition_length: 300ms
- delay: 5min
- if:
condition:
lambda: return !id(basement_light).state && !id(workbench_light).state && !id(exercise_light).state;
then:
- light.turn_off:
id: display_backlight
transition_length: 1s
- delay: 1s
- lvgl.pause:
- id: update_fan_buttons - id: update_fan_buttons
then: then:
- lambda: |- - lambda: |-