Update kinderhandy
This commit is contained in:
270
kinderhandy.yaml
270
kinderhandy.yaml
@@ -21,7 +21,13 @@ logger:
|
||||
api:
|
||||
encryption:
|
||||
key: !secret api_encryption_key
|
||||
|
||||
actions:
|
||||
- action: rtttl_play
|
||||
variables:
|
||||
song_str: string
|
||||
then:
|
||||
- rtttl.play:
|
||||
rtttl: !lambda 'return song_str;'
|
||||
wifi:
|
||||
ssid: WLAN
|
||||
password: !secret wifi_password
|
||||
@@ -53,6 +59,9 @@ output:
|
||||
- platform: ledc
|
||||
pin: GPIO21
|
||||
id: backlight_pwm
|
||||
- platform: ledc
|
||||
pin: GPIO1
|
||||
id: buzzer_output
|
||||
|
||||
display:
|
||||
- platform: ili9xxx
|
||||
@@ -61,7 +70,8 @@ display:
|
||||
cs_pin: GPIO15
|
||||
dc_pin: GPIO2
|
||||
invert_colors: false
|
||||
color_palette: 8BIT
|
||||
auto_clear_enabled: false
|
||||
update_interval: never
|
||||
|
||||
# Set up the xpt2046 touch platform
|
||||
touchscreen:
|
||||
@@ -129,91 +139,179 @@ number:
|
||||
# Display
|
||||
# ============================================================
|
||||
|
||||
font:
|
||||
- file: "fonts/RobotoCondensed-Regular.ttf"
|
||||
id: roboto_icons_42
|
||||
size: 42
|
||||
bpp: 4
|
||||
extras:
|
||||
- file: "fonts/materialdesignicons-webfont.ttf"
|
||||
glyphs: [
|
||||
"\U000F0335", # mdi-lightbulb
|
||||
"\U000F0954", # mdi-clock
|
||||
"\U000F0142", # mdi-chevron-right
|
||||
"\U000F004C", # mdi-bed
|
||||
"\U000F0761", # mdi-window-shutter-open
|
||||
"\U000F075E", # mdi-window-shutter
|
||||
]
|
||||
|
||||
|
||||
lvgl:
|
||||
on_idle:
|
||||
timeout: !lambda "return (id(display_timeout).state * 1000);"
|
||||
timeout: !lambda "return id(timer_running) ? 60 * 5 * 1000: (id(display_timeout).state * 1000);"
|
||||
then:
|
||||
- logger.log: "LVGL is idle"
|
||||
- light.turn_off: display_backlight
|
||||
- lvgl.pause:
|
||||
buffer_size: 50%
|
||||
widgets:
|
||||
- label:
|
||||
align: TOP_MID
|
||||
y: 10
|
||||
text: "Lukas und Hannas\nZahnputz Timer"
|
||||
text_font: montserrat_20
|
||||
- container:
|
||||
id: arc_container
|
||||
align: CENTER
|
||||
y: 20
|
||||
width: 240
|
||||
height: 240
|
||||
on_press:
|
||||
then:
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(timer_running);'
|
||||
then:
|
||||
- globals.set:
|
||||
id: timer_running
|
||||
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:
|
||||
id: timer_seconds
|
||||
value: '120'
|
||||
- globals.set:
|
||||
id: timer_running
|
||||
value: 'false'
|
||||
- lvgl.arc.update:
|
||||
id: arc_timer
|
||||
value: 0
|
||||
indicator:
|
||||
arc_color: 0xFF0000
|
||||
- lvgl.label.update:
|
||||
id: timer_label
|
||||
text: !lambda 'return std::string("02:00");'
|
||||
- logger.log:
|
||||
format: "Timer reset (long press)"
|
||||
widgets:
|
||||
- arc:
|
||||
id: arc_timer
|
||||
align: CENTER
|
||||
width: 220
|
||||
height: 220
|
||||
min_value: 0
|
||||
max_value: 120
|
||||
value: 0
|
||||
arc_width: 8
|
||||
arc_color: 0x404040
|
||||
# Indicator arc styling (the progress)
|
||||
indicator:
|
||||
arc_width: 20
|
||||
arc_opa: COVER
|
||||
arc_color: 0xFF0000 # Start with red
|
||||
- label:
|
||||
id: timer_label
|
||||
align: CENTER
|
||||
text_font: montserrat_28
|
||||
text: "02:00"
|
||||
style_definitions:
|
||||
- id: header_footer
|
||||
bg_color: 0x2F8CD8
|
||||
bg_grad_color: 0x005782
|
||||
bg_grad_dir: VER
|
||||
bg_opa: COVER
|
||||
border_opa: TRANSP
|
||||
border_width: 0
|
||||
outline_width: 0
|
||||
radius: 0
|
||||
pad_all: 0
|
||||
pad_row: 0
|
||||
pad_column: 0
|
||||
border_color: 0x0077b3
|
||||
text_color: 0xFFFFFF
|
||||
width: 100%
|
||||
height: 60
|
||||
|
||||
top_layer:
|
||||
widgets:
|
||||
- buttonmatrix:
|
||||
align: bottom_mid
|
||||
styles: header_footer
|
||||
pad_all: 0
|
||||
outline_width: 0
|
||||
id: top_layer
|
||||
items:
|
||||
styles: header_footer
|
||||
text_font: roboto_icons_42
|
||||
rows:
|
||||
- buttons:
|
||||
- id: page_light
|
||||
text: "\U000F0335"
|
||||
on_press:
|
||||
then:
|
||||
- lvgl.page.show: kinderzimmer_page
|
||||
- id: page_timer
|
||||
text: "\U000F0954"
|
||||
on_press:
|
||||
then:
|
||||
- lvgl.page.show: timer_page
|
||||
|
||||
pages:
|
||||
- id: timer_page
|
||||
widgets:
|
||||
- label:
|
||||
align: TOP_MID
|
||||
y: 10
|
||||
text: "Lukas und Hannas\nZahnputz Timer"
|
||||
text_font: montserrat_20
|
||||
text_align: CENTER
|
||||
- container:
|
||||
id: arc_container
|
||||
align: CENTER
|
||||
y: 15
|
||||
width: 200
|
||||
height: 200
|
||||
on_press:
|
||||
then:
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return id(timer_running);'
|
||||
then:
|
||||
- globals.set:
|
||||
id: timer_running
|
||||
value: 'false'
|
||||
- logger.log:
|
||||
format: "Pause"
|
||||
- lvgl.arc.update:
|
||||
id: arc_timer
|
||||
indicator:
|
||||
arc_color: 0x888888
|
||||
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:
|
||||
id: timer_seconds
|
||||
value: '120'
|
||||
- globals.set:
|
||||
id: timer_running
|
||||
value: 'false'
|
||||
- lvgl.arc.update:
|
||||
id: arc_timer
|
||||
value: 0
|
||||
indicator:
|
||||
arc_color: 0xFF0000
|
||||
- lvgl.label.update:
|
||||
id: timer_label
|
||||
text: !lambda 'return std::string("02:00");'
|
||||
- logger.log:
|
||||
format: "Timer reset (long press)"
|
||||
widgets:
|
||||
- arc:
|
||||
id: arc_timer
|
||||
align: CENTER
|
||||
width: 180
|
||||
height: 180
|
||||
min_value: 0
|
||||
max_value: 120
|
||||
value: 0
|
||||
arc_width: 8
|
||||
arc_color: 0x404040
|
||||
# Indicator arc styling (the progress)
|
||||
indicator:
|
||||
arc_width: 20
|
||||
arc_opa: COVER
|
||||
arc_color: 0xFF0000 # Start with red
|
||||
- label:
|
||||
id: timer_label
|
||||
align: CENTER
|
||||
text_font: montserrat_28
|
||||
text: "02:00"
|
||||
|
||||
- id: kinderzimmer_page
|
||||
widgets:
|
||||
- label:
|
||||
align: TOP_MID
|
||||
y: 10
|
||||
text: "Kinderzimmer"
|
||||
text_font: montserrat_20
|
||||
text_align: CENTER
|
||||
- buttonmatrix:
|
||||
align: CENTER
|
||||
width: 280
|
||||
height: 200
|
||||
items:
|
||||
text_font: roboto_icons_42
|
||||
rows:
|
||||
- buttons:
|
||||
- id: btn_shelf_light
|
||||
text: "\U000F0335"
|
||||
- id: btn_cover_open
|
||||
text: "\U000F0761"
|
||||
- buttons:
|
||||
- id: btn_cover_close
|
||||
text: "\U000F075E"
|
||||
- id: btn_bed
|
||||
text: "\U000F004C"
|
||||
|
||||
interval:
|
||||
- interval: 1s
|
||||
@@ -270,3 +368,15 @@ interval:
|
||||
indicator:
|
||||
arc_color: 0x00FF00
|
||||
|
||||
|
||||
# Buzzer
|
||||
rtttl:
|
||||
output: buzzer_output
|
||||
id: my_buzzer_rtttl
|
||||
gain: 60%
|
||||
on_finished_playback:
|
||||
- logger.log: 'Song ended!'
|
||||
|
||||
|
||||
#Entchen:d=4,o=5,b=120:c,d,e,f,2g,2g,a,a,a,a,1g,a,a,a,a,1g,f,f,f,f,2e,2e,g,g,g,g,1c
|
||||
#MissionImp:d=16,o=6,b=95:32d,32d#,32d,32d#,32d,32d#,32d,32d#,32d,32d,32d#,32e,32f,32f#,32g,g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#,p,g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#,p,a#,g,2d,32p,a#,g,2c#,32p,a#,g,2c,a#5,8c,2p,32p,a#5,g5,2f#,32p,a#5,g5,2f,32p,a#5,g5,2e,d#,8d
|
||||
Reference in New Issue
Block a user