Edit esp-bedside-panel.yaml
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-bedside-panel.yaml
|
||||
#:########################################################################################:#
|
||||
# VERSIONS:
|
||||
# V0.8j 2026-07-16 Added delayed Home Assistant state synchronisation for button highlighting at startup
|
||||
# V0.8i 2026-07-16 Moved Clock date upward, added missing value glyphs and increased Clock to 190px
|
||||
# V0.8h 2026-07-16 Updated local environment entities and added Moon / Outdoor readings
|
||||
# V0.8g 2026-07-16 Added working Climate mode buttons and retained lightweight placeholders
|
||||
@@ -76,12 +77,12 @@ substitutions:
|
||||
# Device Naming
|
||||
device_name: "esp-bedside-panel"
|
||||
friendly_name: "ESP Bedside Panel"
|
||||
description_comment: "Guition JC1060P470C_I_W_Y ESP32-P4 bedside clock and Home Assistant control panel. Larger 24-hour clock with corrected environment symbols. (Layout V1.1)"
|
||||
description_comment: "Guition JC1060P470C_I_W_Y ESP32-P4 bedside clock and Home Assistant control panel. Startup state synchronisation for LVGL button highlighting. (Layout V1.1)"
|
||||
device_area: "Bedroom"
|
||||
|
||||
# Project Naming
|
||||
project_name: "Guition.JC1060P470C_I_W_Y"
|
||||
project_version: "v0.8i"
|
||||
project_version: "v0.8j"
|
||||
|
||||
# Passwords & Secrets
|
||||
api_key: !secret esp-api_key
|
||||
@@ -265,6 +266,10 @@ api:
|
||||
text: "HA connected"
|
||||
text_color: 0x65D483
|
||||
|
||||
# HA may deliver imported entity states before all LVGL widgets are ready.
|
||||
# Run a delayed two-pass refresh so startup colours always match HA.
|
||||
- script.execute: startup_button_state_sync
|
||||
|
||||
on_client_disconnected:
|
||||
then:
|
||||
- logger.log:
|
||||
@@ -649,6 +654,106 @@ binary_sensor:
|
||||
? std::string("Quiet Time active")
|
||||
: std::string("");
|
||||
|
||||
#:########################################################################################:#
|
||||
# SCRIPTS:
|
||||
# Refresh all state-dependent LVGL button colours
|
||||
#:########################################################################################:#
|
||||
script:
|
||||
# Immediate refresh using the latest imported Home Assistant states.
|
||||
- id: refresh_button_states
|
||||
mode: restart
|
||||
then:
|
||||
- lvgl.widget.update:
|
||||
id: north_lights_button
|
||||
bg_color: !lambda |-
|
||||
return id(ha_north_lights).state
|
||||
? lv_color_hex(0xB88918)
|
||||
: lv_color_hex(0x28313D);
|
||||
|
||||
- lvgl.widget.update:
|
||||
id: south_lights_button
|
||||
bg_color: !lambda |-
|
||||
return id(ha_south_lights).state
|
||||
? lv_color_hex(0xB88918)
|
||||
: lv_color_hex(0x28313D);
|
||||
|
||||
- lvgl.widget.update:
|
||||
id: bedside_lamp_button
|
||||
bg_color: !lambda |-
|
||||
return id(ha_bedside_lamp).state
|
||||
? lv_color_hex(0xB88918)
|
||||
: lv_color_hex(0x28313D);
|
||||
|
||||
- lvgl.widget.update:
|
||||
id: hall_floor_button
|
||||
bg_color: !lambda |-
|
||||
return id(ha_hall_floor).state
|
||||
? lv_color_hex(0x92702D)
|
||||
: lv_color_hex(0x28313D);
|
||||
|
||||
- lvgl.widget.update:
|
||||
id: hall_lights_button
|
||||
bg_color: !lambda |-
|
||||
return id(ha_hall_lights).state
|
||||
? lv_color_hex(0xB88918)
|
||||
: lv_color_hex(0x28313D);
|
||||
|
||||
- lvgl.widget.update:
|
||||
id: bathroom_lights_button
|
||||
bg_color: !lambda |-
|
||||
return id(ha_bathroom_lights).state
|
||||
? lv_color_hex(0xB88918)
|
||||
: lv_color_hex(0x28313D);
|
||||
|
||||
- lvgl.widget.update:
|
||||
id: patio_lights_button
|
||||
bg_color: !lambda |-
|
||||
return id(ha_patio_lights).state
|
||||
? lv_color_hex(0xA87500)
|
||||
: lv_color_hex(0x28313D);
|
||||
|
||||
- lvgl.widget.update:
|
||||
id: garage_lights_button
|
||||
bg_color: !lambda |-
|
||||
if (id(ha_garage_door).state) {
|
||||
return lv_color_hex(0xC25B13);
|
||||
}
|
||||
|
||||
return id(ha_garage_lights).state
|
||||
? lv_color_hex(0xB88918)
|
||||
: lv_color_hex(0x28313D);
|
||||
|
||||
- lvgl.widget.update:
|
||||
id: bathroom_fan_button
|
||||
bg_color: !lambda |-
|
||||
return id(ha_bathroom_fan).state
|
||||
? lv_color_hex(0x1668A8)
|
||||
: lv_color_hex(0x28313D);
|
||||
|
||||
- lvgl.widget.update:
|
||||
id: bedtime_button
|
||||
bg_color: !lambda |-
|
||||
return id(ha_quiet_time).state
|
||||
? lv_color_hex(0x705295)
|
||||
: lv_color_hex(0x3B3048);
|
||||
|
||||
- lvgl.label.update:
|
||||
id: clock_status_label
|
||||
text: !lambda |-
|
||||
return id(ha_quiet_time).state
|
||||
? std::string("Quiet Time active")
|
||||
: std::string("");
|
||||
|
||||
# Two passes allow time for LVGL creation and Home Assistant state delivery.
|
||||
- id: startup_button_state_sync
|
||||
mode: restart
|
||||
then:
|
||||
- delay: 1500ms
|
||||
- script.execute: refresh_button_states
|
||||
|
||||
- delay: 3500ms
|
||||
- script.execute: refresh_button_states
|
||||
|
||||
#:########################################################################################:#
|
||||
# INTERVAL:
|
||||
# Update minute-resolution clock values locally
|
||||
|
||||
Reference in New Issue
Block a user