From ae566427c2f1ef46874763a97a9e376ea65082b7 Mon Sep 17 00:00:00 2001 From: ESPHome Device Builder Date: Tue, 14 Jul 2026 22:39:41 +1200 Subject: [PATCH] Edit esp-bedside-panel.yaml --- esphome/esp-bedside-panel.yaml | 88 +++++++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 13 deletions(-) diff --git a/esphome/esp-bedside-panel.yaml b/esphome/esp-bedside-panel.yaml index 0703e9c..f072930 100644 --- a/esphome/esp-bedside-panel.yaml +++ b/esphome/esp-bedside-panel.yaml @@ -7,6 +7,7 @@ #:########################################################################################:# # VERSIONS: # V0.8 2026-07-14 Added large bedside clock, idle dimming and first bedroom control page +# Corrected YAML parsing of conditional LVGL colour lambdas # V0.7 2026-07-14 Added first landscape LVGL page and Home Assistant test button # V0.6 2026-07-14 Added GT911 touchscreen and touch-coordinate logging # V0.5 2026-07-14 Added corrected JC1060P470 MIPI display configuration and text test @@ -465,7 +466,10 @@ binary_sensor: then: - lvgl.widget.update: id: north_lights_button - bg_color: !lambda return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + bg_color: !lambda |- + return x + ? lv_color_hex(0xB88918) + : lv_color_hex(0x28313D); - platform: homeassistant id: ha_south_lights @@ -476,7 +480,10 @@ binary_sensor: then: - lvgl.widget.update: id: south_lights_button - bg_color: !lambda return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + bg_color: !lambda |- + return x + ? lv_color_hex(0xB88918) + : lv_color_hex(0x28313D); - platform: homeassistant id: ha_bedside_lamp @@ -487,7 +494,10 @@ binary_sensor: then: - lvgl.widget.update: id: bedside_lamp_button - bg_color: !lambda return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + bg_color: !lambda |- + return x + ? lv_color_hex(0xB88918) + : lv_color_hex(0x28313D); - platform: homeassistant id: ha_hall_floor @@ -498,7 +508,10 @@ binary_sensor: then: - lvgl.widget.update: id: hall_floor_button - bg_color: !lambda return x ? lv_color_hex(0x92702D) : lv_color_hex(0x28313D); + bg_color: !lambda |- + return x + ? lv_color_hex(0x92702D) + : lv_color_hex(0x28313D); - platform: homeassistant id: ha_hall_lights @@ -509,7 +522,10 @@ binary_sensor: then: - lvgl.widget.update: id: hall_lights_button - bg_color: !lambda return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + bg_color: !lambda |- + return x + ? lv_color_hex(0xB88918) + : lv_color_hex(0x28313D); - platform: homeassistant id: ha_bathroom_lights @@ -520,7 +536,10 @@ binary_sensor: then: - lvgl.widget.update: id: bathroom_lights_button - bg_color: !lambda return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + bg_color: !lambda |- + return x + ? lv_color_hex(0xB88918) + : lv_color_hex(0x28313D); - platform: homeassistant id: ha_patio_lights @@ -531,7 +550,10 @@ binary_sensor: then: - lvgl.widget.update: id: patio_lights_button - bg_color: !lambda return x ? lv_color_hex(0xA87500) : lv_color_hex(0x28313D); + bg_color: !lambda |- + return x + ? lv_color_hex(0xA87500) + : lv_color_hex(0x28313D); - platform: homeassistant id: ha_garage_lights @@ -546,7 +568,10 @@ binary_sensor: if (id(ha_garage_door).state) { return lv_color_hex(0xC25B13); } - return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + + return x + ? lv_color_hex(0xB88918) + : lv_color_hex(0x28313D); - platform: homeassistant id: ha_garage_door @@ -561,6 +586,7 @@ binary_sensor: if (x) { return lv_color_hex(0xC25B13); } + return id(ha_garage_lights).state ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); @@ -574,7 +600,10 @@ binary_sensor: then: - lvgl.widget.update: id: bathroom_fan_button - bg_color: !lambda return x ? lv_color_hex(0x1668A8) : lv_color_hex(0x28313D); + bg_color: !lambda |- + return x + ? lv_color_hex(0x1668A8) + : lv_color_hex(0x28313D); - platform: homeassistant id: ha_quiet_time @@ -585,12 +614,17 @@ binary_sensor: then: - lvgl.widget.update: id: bedtime_button - bg_color: !lambda return x ? lv_color_hex(0x705295) : lv_color_hex(0x3B3048); + bg_color: !lambda |- + return x + ? lv_color_hex(0x705295) + : lv_color_hex(0x3B3048); - lvgl.label.update: id: clock_status_label text: !lambda |- - return x ? "Quiet Time active" : ""; + return x + ? std::string("Quiet Time active") + : std::string(""); #:########################################################################################:# # INTERVAL: @@ -601,27 +635,34 @@ interval: then: - if: condition: - lambda: return id(ha_time).now().is_valid(); + lambda: |- + return id(ha_time).now().is_valid(); + then: - lvgl.label.update: id: clock_time_label text: !lambda |- auto now = id(ha_time).now(); + char buffer[8]; now.strftime(buffer, sizeof(buffer), "%I:%M"); std::string value(buffer); + if (!value.empty() && value.front() == '0') { value.erase(0, 1); } + return value; - lvgl.label.update: id: clock_ampm_label text: !lambda |- auto now = id(ha_time).now(); + char buffer[4]; now.strftime(buffer, sizeof(buffer), "%p"); + return std::string(buffer); - lvgl.label.update: @@ -726,7 +767,6 @@ lvgl: bg_opa: COVER widgets: - # Transparent full-screen wake button. - button: id: clock_wake_button x: 0 @@ -858,8 +898,10 @@ lvgl: border_width: 2 border_color: 0x445365 radius: 18 + pressed: bg_color: 0x425166 + on_click: - homeassistant.action: action: light.toggle @@ -879,8 +921,10 @@ lvgl: border_width: 2 border_color: 0x445365 radius: 18 + pressed: bg_color: 0x425166 + on_click: - homeassistant.action: action: switch.toggle @@ -900,8 +944,10 @@ lvgl: border_width: 2 border_color: 0x445365 radius: 18 + pressed: bg_color: 0x425166 + on_click: - homeassistant.action: action: switch.toggle @@ -922,8 +968,10 @@ lvgl: border_width: 2 border_color: 0x445365 radius: 18 + pressed: bg_color: 0x425166 + on_click: - homeassistant.action: action: switch.toggle @@ -943,8 +991,10 @@ lvgl: border_width: 2 border_color: 0x445365 radius: 18 + pressed: bg_color: 0x425166 + on_click: - homeassistant.action: action: switch.toggle @@ -964,8 +1014,10 @@ lvgl: border_width: 2 border_color: 0x445365 radius: 18 + pressed: bg_color: 0x425166 + on_click: - homeassistant.action: action: switch.toggle @@ -986,8 +1038,10 @@ lvgl: border_width: 2 border_color: 0x445365 radius: 18 + pressed: bg_color: 0x425166 + on_click: - homeassistant.action: action: switch.toggle @@ -1007,8 +1061,10 @@ lvgl: border_width: 2 border_color: 0x445365 radius: 18 + pressed: bg_color: 0x425166 + on_click: - homeassistant.action: action: switch.toggle @@ -1028,8 +1084,10 @@ lvgl: border_width: 2 border_color: 0x445365 radius: 18 + pressed: bg_color: 0x425166 + on_click: - homeassistant.action: action: switch.toggle @@ -1050,6 +1108,7 @@ lvgl: border_width: 2 border_color: 0x3E7FA7 radius: 16 + on_click: - lvgl.page.show: id: climate_page @@ -1069,6 +1128,7 @@ lvgl: border_width: 2 border_color: 0x548C6C radius: 16 + on_click: - lvgl.page.show: id: downstairs_page @@ -1137,6 +1197,7 @@ lvgl: text_font: font_button bg_color: 0x28313D radius: 18 + on_click: - lvgl.page.show: id: bedroom_page @@ -1174,6 +1235,7 @@ lvgl: text_font: font_button bg_color: 0x28313D radius: 18 + on_click: - lvgl.page.show: id: bedroom_page