Update kinderhandy

This commit is contained in:
2026-01-17 20:10:29 +01:00
parent 37e387f0e1
commit 7ebfa6a5e0
2 changed files with 199 additions and 82 deletions

View File

@@ -16,7 +16,7 @@ api:
ota: ota:
password: !secret ota_password password: !secret ota_password
platform: esphome
external_components: external_components:
- source: - source:
@@ -108,7 +108,7 @@ packages:
file: "modbus_relay.yaml" file: "modbus_relay.yaml"
vars: vars:
cid: relayboard32 cid: relayboard32
name: "ventil-sprinkler-westen" name: "defekt"
dev_addr: 0x1 dev_addr: 0x1
register_addr: 0x03 register_addr: 0x03
relay04: !include relay04: !include
@@ -139,6 +139,13 @@ packages:
name: "ventil-brunnen-in-zisterne" name: "ventil-brunnen-in-zisterne"
dev_addr: 0x1 dev_addr: 0x1
register_addr: 0x07 register_addr: 0x07
relay08: !include
file: "modbus_relay.yaml"
vars:
cid: relayboard32
name: "ventil-sprinkler-westen"
dev_addr: 0x1
register_addr: 0x08
#--- obere reihe #--- obere reihe
relay29: !include relay29: !include
file: "modbus_relay.yaml" file: "modbus_relay.yaml"

View File

@@ -21,7 +21,13 @@ logger:
api: api:
encryption: encryption:
key: !secret api_encryption_key key: !secret api_encryption_key
actions:
- action: rtttl_play
variables:
song_str: string
then:
- rtttl.play:
rtttl: !lambda 'return song_str;'
wifi: wifi:
ssid: WLAN ssid: WLAN
password: !secret wifi_password password: !secret wifi_password
@@ -53,6 +59,9 @@ output:
- platform: ledc - platform: ledc
pin: GPIO21 pin: GPIO21
id: backlight_pwm id: backlight_pwm
- platform: ledc
pin: GPIO1
id: buzzer_output
display: display:
- platform: ili9xxx - platform: ili9xxx
@@ -61,7 +70,8 @@ display:
cs_pin: GPIO15 cs_pin: GPIO15
dc_pin: GPIO2 dc_pin: GPIO2
invert_colors: false invert_colors: false
color_palette: 8BIT auto_clear_enabled: false
update_interval: never
# Set up the xpt2046 touch platform # Set up the xpt2046 touch platform
touchscreen: touchscreen:
@@ -129,91 +139,179 @@ number:
# Display # 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: lvgl:
on_idle: 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: then:
- logger.log: "LVGL is idle" - logger.log: "LVGL is idle"
- light.turn_off: display_backlight - light.turn_off: display_backlight
- lvgl.pause: - lvgl.pause:
buffer_size: 50% buffer_size: 50%
widgets: style_definitions:
- label: - id: header_footer
align: TOP_MID bg_color: 0x2F8CD8
y: 10 bg_grad_color: 0x005782
text: "Lukas und Hannas\nZahnputz Timer" bg_grad_dir: VER
text_font: montserrat_20 bg_opa: COVER
- container: border_opa: TRANSP
id: arc_container border_width: 0
align: CENTER outline_width: 0
y: 20 radius: 0
width: 240 pad_all: 0
height: 240 pad_row: 0
on_press: pad_column: 0
then: border_color: 0x0077b3
- if: text_color: 0xFFFFFF
condition: width: 100%
lambda: 'return id(timer_running);' height: 60
then:
- globals.set: top_layer:
id: timer_running widgets:
value: 'false' - buttonmatrix:
- logger.log: align: bottom_mid
format: "Pause" styles: header_footer
- lvgl.arc.update: pad_all: 0
id: arc_timer outline_width: 0
indicator: id: top_layer
arc_color: 0x0000EE items:
else: styles: header_footer
- globals.set: text_font: roboto_icons_42
id: timer_running rows:
value: 'true' - buttons:
- logger.log: - id: page_light
format: "Gestartet" text: "\U000F0335"
- lvgl.arc.update: on_press:
id: arc_timer then:
value: !lambda return id(timer_seconds); - lvgl.page.show: kinderzimmer_page
indicator: - id: page_timer
arc_color: 0xFF0000 text: "\U000F0954"
on_long_press: on_press:
then: then:
- globals.set: - lvgl.page.show: timer_page
id: timer_seconds
value: '120' pages:
- globals.set: - id: timer_page
id: timer_running widgets:
value: 'false' - label:
- lvgl.arc.update: align: TOP_MID
id: arc_timer y: 10
value: 0 text: "Lukas und Hannas\nZahnputz Timer"
indicator: text_font: montserrat_20
arc_color: 0xFF0000 text_align: CENTER
- lvgl.label.update: - container:
id: timer_label id: arc_container
text: !lambda 'return std::string("02:00");' align: CENTER
- logger.log: y: 15
format: "Timer reset (long press)" width: 200
widgets: height: 200
- arc: on_press:
id: arc_timer then:
align: CENTER - if:
width: 220 condition:
height: 220 lambda: 'return id(timer_running);'
min_value: 0 then:
max_value: 120 - globals.set:
value: 0 id: timer_running
arc_width: 8 value: 'false'
arc_color: 0x404040 - logger.log:
# Indicator arc styling (the progress) format: "Pause"
indicator: - lvgl.arc.update:
arc_width: 20 id: arc_timer
arc_opa: COVER indicator:
arc_color: 0xFF0000 # Start with red arc_color: 0x888888
- label: else:
id: timer_label - globals.set:
align: CENTER id: timer_running
text_font: montserrat_28 value: 'true'
text: "02:00" - 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:
- interval: 1s - interval: 1s
@@ -270,3 +368,15 @@ interval:
indicator: indicator:
arc_color: 0x00FF00 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