From 7bd3e3a0c2a3bd2527a124be889f0dc970613677 Mon Sep 17 00:00:00 2001 From: ESPHome Device Builder Date: Tue, 14 Jul 2026 22:34:05 +1200 Subject: [PATCH] Edit esp-bedside-panel.yaml --- esphome/esp-bedside-panel.yaml | 1044 ++++++++++++++++++++++++++------ 1 file changed, 844 insertions(+), 200 deletions(-) diff --git a/esphome/esp-bedside-panel.yaml b/esphome/esp-bedside-panel.yaml index 0069c11..9183ad8 100644 --- a/esphome/esp-bedside-panel.yaml +++ b/esphome/esp-bedside-panel.yaml @@ -6,6 +6,7 @@ # https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-bedside-panel.yaml #:########################################################################################:# # VERSIONS: +# V0.8 2026-07-14 Added large bedside clock, idle dimming and first bedroom control page # 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 @@ -23,7 +24,6 @@ # - 32MB PSRAM # - 100 Mbps Ethernet # - Dual USB-C ports -# - Camera, speaker connector, microSD and RTC features present on board # # Confirmed hardware details: # - Display model: JC1060P470 @@ -38,31 +38,24 @@ # - Touch I2C address: 0x5D #:########################################################################################:# # OPERATION NOTES: -# - Flash this to the ESP32-P4 side of the board. -# - This version introduces LVGL while retaining landscape orientation. -# - The screen displays: -# - A title -# - A connection/status message -# - One large test button -# - Pressing the test button calls Home Assistant to toggle: -# input_boolean.test_touchscreen_button -# - Home Assistant action calls must be enabled for this ESPHome device. -# - Backlight brightness remains adjustable from Home Assistant. -# - Touch coordinates continue to be logged for initial testing. -# - This version intentionally does not yet configure: -# - Ethernet -# - Multiple LVGL pages -# - Bedside clock -# - Automatic brightness -# - Ambient light sensor -# - RTC -# - Camera +# - The display remains in its native 1024x600 landscape orientation. +# - The default active page is the Bedroom control page. +# - After 60 seconds without touchscreen activity: +# - The large bedside clock page is displayed. +# - The backlight dims to the configured clock brightness. +# - Touching the clock: +# - Returns to the Bedroom page. +# - Restores the configured control-page brightness. +# - Bedroom light/control buttons use live Home Assistant states. +# - Active controls use function-specific colours. +# - Bedtime requires a long press to reduce accidental activation. +# - Climate and Downstairs placeholder pages are included for navigation testing. #:########################################################################################:# # OFFLINE NOTES: -# - LVGL, display rendering, touch and backlight operate locally. -# - The test button remains visible while Home Assistant is offline. -# - Pressing the button while the API is disconnected will not toggle the -# Home Assistant helper. +# - LVGL, the clock, touch and backlight continue operating locally. +# - The clock continues using the last synchronised time if Home Assistant disconnects. +# - Home Assistant control buttons cannot operate while the API is disconnected. +# - Imported entity states may remain at their last received values while offline. #:########################################################################################:# #:########################################################################################:# @@ -74,20 +67,20 @@ substitutions: # Device Naming device_name: "esp-bedside-panel" friendly_name: "ESP Bedside Panel" - description_comment: "Guition JC1060P470C_I_W_Y ESP32-P4 7 inch bedside control panel. First landscape LVGL button test. (Layout V1.1)" - device_area: "Bedroom" # Allows ESP device to be automatically linked to an 'Area' in Home Assistant. + description_comment: "Guition JC1060P470C_I_W_Y ESP32-P4 bedside clock and Home Assistant control panel. (Layout V1.1)" + device_area: "Bedroom" # Project Naming - project_name: "Guition.JC1060P470C_I_W_Y" # Project Details - project_version: "v0.7" # Project V denotes release of yaml file, allowing checking of deployed vs latest version + project_name: "Guition.JC1060P470C_I_W_Y" + project_version: "v0.8" # Passwords & Secrets - api_key: !secret esp-api_key # unfortunately you can't use substitutions inside secrets names - ota_pass: !secret esp-ota_pass # unfortunately you can't use substitutions inside secrets names + api_key: !secret esp-api_key + ota_pass: !secret esp-ota_pass # Device Settings - log_level: "INFO" # Define logging level: NONE, ERROR, WARN, INFO, DEBUG, VERBOSE, VERY_VERBOSE - update_interval: "60s" # update time for general sensors etc + log_level: "INFO" + update_interval: "60s" # Display Settings backlight_pin: "GPIO23" @@ -99,8 +92,32 @@ substitutions: touch_interrupt_pin: "GPIO21" touch_reset_pin: "GPIO22" - # Home Assistant Test Entity - test_helper_entity: "input_boolean.test_touchscreen_button" + # Clock / Screen Settings + clock_idle_timeout: "60s" + control_brightness: "80%" + clock_brightness: "4%" + + # Home Assistant Entities - Environment + bedroom_temperature_entity: "sensor.master_bedroom_environment_zth01_temperature_2" + bedroom_humidity_entity: "sensor.master_bedroom_environment_zth01_humidity_2" + + # Home Assistant Entities - Bedroom / Nearby Controls + north_lights_entity: "light.tasmo_ifan02_3793_bedrm1_1" + south_lights_entity: "switch.master_bedroom_master_bedroom_main_lights_south_relay_2_master_bedroom_south_lights" + bedside_lamp_entity: "switch.master_bedroom_bedside_lamp_arlec_bulb_master_bedroom_bedside_lamp_arlec_bulb_jump_fade_up_down" + hall_floor_entity: "switch.main_hallway_nightlights_1_relay_1_main_hallway_nightlights" + hall_lights_entity: "switch.main_hallway_lightswitch_relay_1_main_hallway_lights" + bathroom_lights_entity: "switch.main_bathroom_lightswitch_3_2_all_main_bathroom_lights" + patio_lights_entity: "switch.esp_garageentrylights_relay_2_patio_lights" + garage_lights_entity: "switch.esp_garageentrylights_relay_3_garage_lights" + bathroom_fan_entity: "switch.esp_mainbathfancombo_relay_1_extract_fan" + + # Home Assistant Entities - Status + garage_door_entity: "binary_sensor.garage_roller_door_x18rs_contact" + quiet_time_entity: "input_boolean.quiet_time" + + # Home Assistant Entities - Actions + bedtime_button_entity: "input_button.bedtime_mode" #:########################################################################################:# # PACKAGES: @@ -109,15 +126,13 @@ substitutions: #:########################################################################################:# packages: #### WIFI, Network DHCP, Fallback AP, Safemode #### - # This board does not have native WiFi in the ESP32-P4 itself. - # The esp32_hosted section below exposes the ESP32-C6 co-processor as WiFi. common_wifi: !include file: common/network_common_dhcp.yaml vars: local_device_name: "${device_name}" local_ota_pass: "${ota_pass}" - #### HOME ASSISTANT API (choose encryption or no encryption options) #### + #### HOME ASSISTANT API #### common_api: !include file: common/api_common.yaml #file: common/api_common_noencryption.yaml @@ -133,7 +148,7 @@ packages: #### WEB PORTAL #### #common_webportal: !include common/webportal_common_nopass.yaml - #### SNTP (Only use if you want/need accurate timeclocks) #### + #### SNTP #### #common_sntp: !include common/sntp_common.yaml #### DIAGNOSTICS Sensors #### @@ -149,7 +164,7 @@ packages: esphome: name: "${device_name}" friendly_name: "${friendly_name}" - comment: "${description_comment}" # Appears on the ESPHome page in HA + comment: "${description_comment}" area: "${device_area}" project: name: "${project_name}" @@ -213,10 +228,9 @@ esp_ldo: # https://esphome.io/components/logger.html #:########################################################################################:# logger: - level: "${log_level}" # INFO Level suggested, or DEBUG for testing + level: "${log_level}" baud_rate: 115200 hardware_uart: USB_SERIAL_JTAG - #tx_buffer_size: 64 #:########################################################################################:# # HOME ASSISTANT API: @@ -229,8 +243,8 @@ api: format: "API connected: ESP Bedside Panel is online" - lvgl.label.update: - id: connection_status_label - text: "Connected to Home Assistant" + id: bedroom_connection_label + text: "HA connected" text_color: 0x65D483 on_client_disconnected: @@ -240,9 +254,9 @@ api: format: "API disconnected: ESP Bedside Panel is offline from Home Assistant" - lvgl.label.update: - id: connection_status_label - text: "Home Assistant disconnected" - text_color: 0xF0A45D + id: bedroom_connection_label + text: "HA offline" + text_color: 0xF06A6A #:########################################################################################:# # OTA: @@ -292,7 +306,7 @@ light: id: display_backlight icon: "mdi:brightness-6" restore_mode: RESTORE_DEFAULT_ON - default_transition_length: 0s + default_transition_length: 500ms gamma_correct: 1.0 #:########################################################################################:# @@ -331,176 +345,64 @@ touchscreen: mode: output: true - on_touch: - then: - - lambda: |- - ESP_LOGD( - "touch", - "Touch detected: x=%d, y=%d, x_raw=%d, y_raw=%d", - touch.x, - touch.y, - touch.x_raw, - touch.y_raw - ); - - on_release: - then: - - logger.log: - level: DEBUG - format: "Touch released" - #:########################################################################################:# # FONTS: # https://esphome.io/components/font.html #:########################################################################################:# font: - file: "gfonts://Roboto" - id: font_heading - size: 54 + id: font_clock + size: 230 glyphs: - - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - - "abcdefghijklmnopqrstuvwxyz" - - "0123456789" - - " .:-" + - "0123456789:" - file: "gfonts://Roboto" - id: font_normal - size: 32 + id: font_clock_ampm + size: 42 glyphs: - - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - - "abcdefghijklmnopqrstuvwxyz" - - "0123456789" - - " .:-" + - "AMP" - file: "gfonts://Roboto" - id: font_button + id: font_clock_date size: 42 glyphs: - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - - "0123456789" - - " .:-" + - "0123456789, " + + - file: "gfonts://Roboto" + id: font_page_title + size: 38 + glyphs: + - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + - "abcdefghijklmnopqrstuvwxyz" + - "0123456789 /-" + + - file: "gfonts://Roboto" + id: font_button + size: 25 + glyphs: + - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + - "abcdefghijklmnopqrstuvwxyz" + - "0123456789 .:/-" + + - file: "gfonts://Roboto" + id: font_small + size: 22 + glyphs: + - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + - "abcdefghijklmnopqrstuvwxyz" + - "0123456789 .:%°/-" + + - file: "gfonts://Roboto" + id: font_environment + size: 34 + glyphs: + - "0123456789.-%°C " #:########################################################################################:# -# LVGL: -# https://esphome.io/components/lvgl/ -#:########################################################################################:# -lvgl: - id: panel_lvgl - - displays: - - main_display - - touchscreens: - - touchscreen_id: main_touchscreen - long_press_time: 500ms - long_press_repeat_time: 200ms - - # Retain the native 1024x600 landscape orientation. - rotation: 0 - - # A partial buffer gives good performance while reducing memory use. - buffer_size: 12% - - log_level: WARN - default_font: font_normal - - theme: - dark_mode: true - - pages: - - id: test_page - bg_color: 0x10151D - bg_opa: COVER - - widgets: - - label: - id: page_title_label - align: TOP_MID - y: 55 - text: "ESPHome LVGL Test" - text_font: font_heading - text_color: 0xFFFFFF - - - label: - id: connection_status_label - align: TOP_MID - y: 135 - text: "Waiting for Home Assistant" - text_font: font_normal - text_color: 0xF0A45D - - - button: - id: ha_test_button - align: CENTER - y: 45 - width: 620 - height: 210 - - bg_color: 0x2678C9 - bg_opa: COVER - border_width: 3 - border_color: 0x70B7F3 - radius: 24 - shadow_width: 18 - shadow_opa: 35% - shadow_spread: 2 - - pressed: - bg_color: 0x185991 - border_color: 0xFFFFFF - transform_width: -8 - transform_height: -8 - - widgets: - - label: - id: ha_test_button_label - align: CENTER - text: "Toggle HA Test Helper" - text_font: font_button - text_color: 0xFFFFFF - - on_click: - then: - - if: - condition: - api.connected: - then: - - homeassistant.action: - action: input_boolean.toggle - data: - entity_id: "${test_helper_entity}" - - - lvgl.label.update: - id: action_result_label - text: "Command sent to Home Assistant" - text_color: 0x65D483 - - - logger.log: - level: INFO - format: "LVGL test button pressed: toggled ${test_helper_entity}" - - else: - - lvgl.label.update: - id: action_result_label - text: "Cannot send: Home Assistant offline" - text_color: 0xEF6A6A - - - logger.log: - level: WARN - format: "LVGL test button pressed while API disconnected" - - - label: - id: action_result_label - align: BOTTOM_MID - y: -70 - text: "Press the button to test LVGL touch" - text_font: font_normal - text_color: 0xAAB5C2 - -#:########################################################################################:# -# SENSORS: -# https://esphome.io/components/sensor/ +# HOME ASSISTANT NUMERIC SENSORS: +# https://esphome.io/components/sensor/homeassistant.html #:########################################################################################:# sensor: - platform: uptime @@ -513,6 +415,237 @@ sensor: id: wifi_signal_sensor update_interval: "${update_interval}" + - platform: homeassistant + id: bedroom_temperature + entity_id: "${bedroom_temperature_entity}" + internal: true + on_value: + then: + - lvgl.label.update: + id: clock_temperature_label + text: + format: "%.1f°C" + args: [x] + + - lvgl.label.update: + id: bedroom_temperature_label + text: + format: "%.1f°C" + args: [x] + + - platform: homeassistant + id: bedroom_humidity + entity_id: "${bedroom_humidity_entity}" + internal: true + on_value: + then: + - lvgl.label.update: + id: clock_humidity_label + text: + format: "%.0f%%" + args: [x] + + - lvgl.label.update: + id: bedroom_humidity_label + text: + format: "%.0f%%" + args: [x] + +#:########################################################################################:# +# HOME ASSISTANT BINARY SENSORS: +# Imported states used to colour LVGL buttons +#:########################################################################################:# +binary_sensor: + - platform: homeassistant + id: ha_north_lights + entity_id: "${north_lights_entity}" + internal: true + trigger_on_initial_state: true + on_state: + then: + - lvgl.widget.update: + id: north_lights_button + bg_color: !lambda return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + + - platform: homeassistant + id: ha_south_lights + entity_id: "${south_lights_entity}" + internal: true + trigger_on_initial_state: true + on_state: + then: + - lvgl.widget.update: + id: south_lights_button + bg_color: !lambda return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + + - platform: homeassistant + id: ha_bedside_lamp + entity_id: "${bedside_lamp_entity}" + internal: true + trigger_on_initial_state: true + on_state: + then: + - lvgl.widget.update: + id: bedside_lamp_button + bg_color: !lambda return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + + - platform: homeassistant + id: ha_hall_floor + entity_id: "${hall_floor_entity}" + internal: true + trigger_on_initial_state: true + on_state: + then: + - lvgl.widget.update: + id: hall_floor_button + bg_color: !lambda return x ? lv_color_hex(0x92702D) : lv_color_hex(0x28313D); + + - platform: homeassistant + id: ha_hall_lights + entity_id: "${hall_lights_entity}" + internal: true + trigger_on_initial_state: true + on_state: + then: + - lvgl.widget.update: + id: hall_lights_button + bg_color: !lambda return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + + - platform: homeassistant + id: ha_bathroom_lights + entity_id: "${bathroom_lights_entity}" + internal: true + trigger_on_initial_state: true + on_state: + then: + - lvgl.widget.update: + id: bathroom_lights_button + bg_color: !lambda return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + + - platform: homeassistant + id: ha_patio_lights + entity_id: "${patio_lights_entity}" + internal: true + trigger_on_initial_state: true + on_state: + then: + - lvgl.widget.update: + id: patio_lights_button + bg_color: !lambda return x ? lv_color_hex(0xA87500) : lv_color_hex(0x28313D); + + - platform: homeassistant + id: ha_garage_lights + entity_id: "${garage_lights_entity}" + internal: true + trigger_on_initial_state: true + on_state: + then: + - lvgl.widget.update: + id: garage_lights_button + bg_color: !lambda |- + if (id(ha_garage_door).state) { + return lv_color_hex(0xC25B13); + } + return x ? lv_color_hex(0xB88918) : lv_color_hex(0x28313D); + + - platform: homeassistant + id: ha_garage_door + entity_id: "${garage_door_entity}" + internal: true + trigger_on_initial_state: true + on_state: + then: + - lvgl.widget.update: + id: garage_lights_button + bg_color: !lambda |- + if (x) { + return lv_color_hex(0xC25B13); + } + return id(ha_garage_lights).state + ? lv_color_hex(0xB88918) + : lv_color_hex(0x28313D); + + - platform: homeassistant + id: ha_bathroom_fan + entity_id: "${bathroom_fan_entity}" + internal: true + trigger_on_initial_state: true + on_state: + then: + - lvgl.widget.update: + id: bathroom_fan_button + bg_color: !lambda return x ? lv_color_hex(0x1668A8) : lv_color_hex(0x28313D); + + - platform: homeassistant + id: ha_quiet_time + entity_id: "${quiet_time_entity}" + internal: true + trigger_on_initial_state: true + on_state: + then: + - lvgl.widget.update: + id: bedtime_button + 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" : ""; + +#:########################################################################################:# +# INTERVAL: +# Update the clock labels locally +#:########################################################################################:# +interval: + - interval: 1s + then: + - if: + condition: + 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: + id: clock_date_label + text: !lambda |- + auto now = id(ha_time).now(); + + char weekday[16]; + char month[16]; + + now.strftime(weekday, sizeof(weekday), "%A"); + now.strftime(month, sizeof(month), "%B"); + + char buffer[48]; + snprintf( + buffer, + sizeof(buffer), + "%s, %d %s", + weekday, + now.day_of_month, + month + ); + + return std::string(buffer); + #:########################################################################################:# # TEXT SENSOR COMPONENT: # https://esphome.io/components/text_sensor/ @@ -533,4 +666,515 @@ text_sensor: name: "${friendly_name} Connected BSSID" mac_address: - name: "${friendly_name} MAC Address" \ No newline at end of file + name: "${friendly_name} MAC Address" + +#:########################################################################################:# +# LVGL: +# https://esphome.io/components/lvgl/ +#:########################################################################################:# +lvgl: + id: panel_lvgl + + displays: + - main_display + + touchscreens: + - touchscreen_id: main_touchscreen + long_press_time: 1200ms + long_press_repeat_time: 500ms + + rotation: 0 + buffer_size: 12% + log_level: WARN + default_font: font_button + page_wrap: false + + theme: + dark_mode: true + + on_boot: + then: + - lvgl.page.show: bedroom_page + + - light.turn_on: + id: display_backlight + brightness: "${control_brightness}" + transition_length: 500ms + + on_idle: + - timeout: "${clock_idle_timeout}" + then: + - lvgl.page.show: + id: clock_page + animation: FADE_IN + time: 300ms + + - light.turn_on: + id: display_backlight + brightness: "${clock_brightness}" + transition_length: 2s + + pages: + + #:####################################################################################:# + # CLOCK PAGE + #:####################################################################################:# + - id: clock_page + skip: true + bg_color: 0x020304 + bg_opa: COVER + + widgets: + # Transparent full-screen wake button. + - button: + id: clock_wake_button + x: 0 + y: 0 + width: 1024 + height: 600 + bg_opa: TRANSP + border_width: 0 + shadow_width: 0 + radius: 0 + text: "" + + on_click: + then: + - lvgl.page.show: + id: bedroom_page + animation: FADE_OUT + time: 250ms + + - light.turn_on: + id: display_backlight + brightness: "${control_brightness}" + transition_length: 500ms + + - label: + id: clock_time_label + align: TOP_MID + y: 60 + text: "--:--" + text_font: font_clock + text_color: 0xE4DDD2 + clickable: false + + - label: + id: clock_ampm_label + x: 785 + y: 265 + text: "" + text_font: font_clock_ampm + text_color: 0x938D85 + clickable: false + + - label: + id: clock_date_label + align: TOP_MID + y: 335 + text: "Waiting for time" + text_font: font_clock_date + text_color: 0xA8A198 + clickable: false + + - label: + id: clock_temperature_label + x: 330 + y: 425 + text: "--.-°C" + text_font: font_environment + text_color: 0x8FAFC8 + clickable: false + + - label: + id: clock_humidity_label + x: 600 + y: 425 + text: "--%" + text_font: font_environment + text_color: 0x7FAE9B + clickable: false + + - label: + id: clock_status_label + align: BOTTOM_MID + y: -48 + text: "" + text_font: font_small + text_color: 0x887799 + clickable: false + + #:####################################################################################:# + # BEDROOM PAGE + #:####################################################################################:# + - id: bedroom_page + bg_color: 0x10151D + bg_opa: COVER + + widgets: + - label: + x: 35 + y: 20 + text: "Bedroom" + text_font: font_page_title + text_color: 0xFFFFFF + + - label: + id: bedroom_temperature_label + x: 665 + y: 28 + text: "--.-°C" + text_font: font_environment + text_color: 0x8FC6EE + + - label: + id: bedroom_humidity_label + x: 835 + y: 28 + text: "--%" + text_font: font_environment + text_color: 0x83C7AA + + - label: + id: bedroom_connection_label + x: 38 + y: 72 + text: "Waiting for HA" + text_font: font_small + text_color: 0xF0A45D + + # Row 1 + - button: + id: north_lights_button + x: 35 + y: 112 + width: 300 + height: 105 + text: "North Lights" + text_font: font_button + bg_color: 0x28313D + bg_opa: COVER + border_width: 2 + border_color: 0x445365 + radius: 18 + pressed: + bg_color: 0x425166 + on_click: + - homeassistant.action: + action: light.toggle + data: + entity_id: "${north_lights_entity}" + + - button: + id: south_lights_button + x: 362 + y: 112 + width: 300 + height: 105 + text: "South Lights" + text_font: font_button + bg_color: 0x28313D + bg_opa: COVER + border_width: 2 + border_color: 0x445365 + radius: 18 + pressed: + bg_color: 0x425166 + on_click: + - homeassistant.action: + action: switch.toggle + data: + entity_id: "${south_lights_entity}" + + - button: + id: bedside_lamp_button + x: 689 + y: 112 + width: 300 + height: 105 + text: "Bedside Lamp" + text_font: font_button + bg_color: 0x28313D + bg_opa: COVER + border_width: 2 + border_color: 0x445365 + radius: 18 + pressed: + bg_color: 0x425166 + on_click: + - homeassistant.action: + action: switch.toggle + data: + entity_id: "${bedside_lamp_entity}" + + # Row 2 + - button: + id: hall_floor_button + x: 35 + y: 235 + width: 300 + height: 105 + text: "Hall Floor" + text_font: font_button + bg_color: 0x28313D + bg_opa: COVER + border_width: 2 + border_color: 0x445365 + radius: 18 + pressed: + bg_color: 0x425166 + on_click: + - homeassistant.action: + action: switch.toggle + data: + entity_id: "${hall_floor_entity}" + + - button: + id: hall_lights_button + x: 362 + y: 235 + width: 300 + height: 105 + text: "Hall Lights" + text_font: font_button + bg_color: 0x28313D + bg_opa: COVER + border_width: 2 + border_color: 0x445365 + radius: 18 + pressed: + bg_color: 0x425166 + on_click: + - homeassistant.action: + action: switch.toggle + data: + entity_id: "${hall_lights_entity}" + + - button: + id: bathroom_lights_button + x: 689 + y: 235 + width: 300 + height: 105 + text: "Bathroom Lights" + text_font: font_button + bg_color: 0x28313D + bg_opa: COVER + border_width: 2 + border_color: 0x445365 + radius: 18 + pressed: + bg_color: 0x425166 + on_click: + - homeassistant.action: + action: switch.toggle + data: + entity_id: "${bathroom_lights_entity}" + + # Row 3 + - button: + id: patio_lights_button + x: 35 + y: 358 + width: 300 + height: 105 + text: "Patio Lights" + text_font: font_button + bg_color: 0x28313D + bg_opa: COVER + border_width: 2 + border_color: 0x445365 + radius: 18 + pressed: + bg_color: 0x425166 + on_click: + - homeassistant.action: + action: switch.toggle + data: + entity_id: "${patio_lights_entity}" + + - button: + id: garage_lights_button + x: 362 + y: 358 + width: 300 + height: 105 + text: "Garage Lights" + text_font: font_button + bg_color: 0x28313D + bg_opa: COVER + border_width: 2 + border_color: 0x445365 + radius: 18 + pressed: + bg_color: 0x425166 + on_click: + - homeassistant.action: + action: switch.toggle + data: + entity_id: "${garage_lights_entity}" + + - button: + id: bathroom_fan_button + x: 689 + y: 358 + width: 300 + height: 105 + text: "Bathroom Fan" + text_font: font_button + bg_color: 0x28313D + bg_opa: COVER + border_width: 2 + border_color: 0x445365 + radius: 18 + pressed: + bg_color: 0x425166 + on_click: + - homeassistant.action: + action: switch.toggle + data: + entity_id: "${bathroom_fan_entity}" + + # Bottom navigation / action bar + - button: + id: climate_navigation_button + x: 35 + y: 495 + width: 280 + height: 78 + text: "Climate" + text_font: font_button + bg_color: 0x214F72 + bg_opa: COVER + border_width: 2 + border_color: 0x3E7FA7 + radius: 16 + on_click: + - lvgl.page.show: + id: climate_page + animation: MOVE_LEFT + time: 220ms + + - button: + id: downstairs_navigation_button + x: 340 + y: 495 + width: 280 + height: 78 + text: "Downstairs" + text_font: font_button + bg_color: 0x315843 + bg_opa: COVER + border_width: 2 + border_color: 0x548C6C + radius: 16 + on_click: + - lvgl.page.show: + id: downstairs_page + animation: MOVE_LEFT + time: 220ms + + - button: + id: bedtime_button + x: 645 + y: 495 + width: 344 + height: 78 + text: "Hold for Bedtime" + text_font: font_button + bg_color: 0x3B3048 + bg_opa: COVER + border_width: 2 + border_color: 0x735E88 + radius: 16 + + on_long_press: + then: + - homeassistant.action: + action: input_button.press + data: + entity_id: "${bedtime_button_entity}" + + - lvgl.button.update: + id: bedtime_button + text: "Bedtime Activated" + + - delay: 2s + + - lvgl.button.update: + id: bedtime_button + text: "Hold for Bedtime" + + #:####################################################################################:# + # CLIMATE PLACEHOLDER PAGE + #:####################################################################################:# + - id: climate_page + bg_color: 0x111923 + bg_opa: COVER + + widgets: + - label: + align: TOP_MID + y: 100 + text: "Bedroom Climate" + text_font: font_page_title + text_color: 0xFFFFFF + + - label: + align: CENTER + y: -20 + text: "Climate controls will be added next" + text_font: font_button + text_color: 0x9AA9B8 + + - button: + align: BOTTOM_MID + y: -55 + width: 360 + height: 85 + text: "Back to Bedroom" + text_font: font_button + bg_color: 0x28313D + radius: 18 + on_click: + - lvgl.page.show: + id: bedroom_page + animation: MOVE_RIGHT + time: 220ms + + #:####################################################################################:# + # DOWNSTAIRS PLACEHOLDER PAGE + #:####################################################################################:# + - id: downstairs_page + bg_color: 0x111923 + bg_opa: COVER + + widgets: + - label: + align: TOP_MID + y: 100 + text: "Downstairs & Outside" + text_font: font_page_title + text_color: 0xFFFFFF + + - label: + align: CENTER + y: -20 + text: "Downstairs controls will be added next" + text_font: font_button + text_color: 0x9AA9B8 + + - button: + align: BOTTOM_MID + y: -55 + width: 360 + height: 85 + text: "Back to Bedroom" + text_font: font_button + bg_color: 0x28313D + radius: 18 + on_click: + - lvgl.page.show: + id: bedroom_page + animation: MOVE_RIGHT + time: 220ms \ No newline at end of file