Edit esp-bedside-panel.yaml

This commit is contained in:
ESPHome Device Builder
2026-07-14 22:15:13 +12:00
parent e013bab5c9
commit 06a482b43f
+181 -68
View File
@@ -6,6 +6,7 @@
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-bedside-panel.yaml # https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-bedside-panel.yaml
#:########################################################################################:# #:########################################################################################:#
# VERSIONS: # VERSIONS:
# 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.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 # V0.5 2026-07-14 Added corrected JC1060P470 MIPI display configuration and text test
# V0.4 2026-07-14 Removed MIPI display test after setup watchdog boot loop; retained backlight-only test # V0.4 2026-07-14 Removed MIPI display test after setup watchdog boot loop; retained backlight-only test
@@ -24,7 +25,7 @@
# - Dual USB-C ports # - Dual USB-C ports
# - Camera, speaker connector, microSD and RTC features present on board # - Camera, speaker connector, microSD and RTC features present on board
# #
# Confirmed / referenced hardware details: # Confirmed hardware details:
# - Display model: JC1060P470 # - Display model: JC1060P470
# - Display interface: MIPI-DSI # - Display interface: MIPI-DSI
# - Display reset: GPIO5 # - Display reset: GPIO5
@@ -38,29 +39,30 @@
#:########################################################################################:# #:########################################################################################:#
# OPERATION NOTES: # OPERATION NOTES:
# - Flash this to the ESP32-P4 side of the board. # - Flash this to the ESP32-P4 side of the board.
# - This version is intended to confirm: # - This version introduces LVGL while retaining landscape orientation.
# - MIPI-DSI display remains stable # - The screen displays:
# - Display test text is rendered # - A title
# - Backlight brightness remains adjustable from Home Assistant # - A connection/status message
# - GT911 touchscreen initialises # - One large test button
# - Touch coordinates appear in ESPHome logs # - Pressing the test button calls Home Assistant to toggle:
# - Display remains in native landscape orientation for this test. # input_boolean.test_touchscreen_button
# - Touch the screen at several locations and inspect the logs. # - Home Assistant action calls must be enabled for this ESPHome device.
# - Expected coordinate range is approximately: # - Backlight brightness remains adjustable from Home Assistant.
# - X: 0 to 1023 # - Touch coordinates continue to be logged for initial testing.
# - Y: 0 to 599
# - Portrait rotation and LVGL will be added after touch is confirmed.
# - This version intentionally does not yet configure: # - This version intentionally does not yet configure:
# - Ethernet # - Ethernet
# - LVGL # - Multiple LVGL pages
# - Bedside clock
# - Automatic brightness
# - Ambient light sensor # - Ambient light sensor
# - RTC # - RTC
# - Camera # - Camera
#:########################################################################################:# #:########################################################################################:#
# OFFLINE NOTES: # OFFLINE NOTES:
# - Display rendering and touch detection operate locally. # - LVGL, display rendering, touch and backlight operate locally.
# - Home Assistant is not required for the display or touchscreen to work. # - The test button remains visible while Home Assistant is offline.
# - Backlight state is restored locally after restart. # - Pressing the button while the API is disconnected will not toggle the
# Home Assistant helper.
#:########################################################################################:# #:########################################################################################:#
#:########################################################################################:# #:########################################################################################:#
@@ -72,25 +74,24 @@ substitutions:
# Device Naming # Device Naming
device_name: "esp-bedside-panel" device_name: "esp-bedside-panel"
friendly_name: "ESP Bedside Panel" friendly_name: "ESP Bedside Panel"
description_comment: "Guition JC1060P470C_I_W_Y ESP32-P4 7 inch bedside control panel. Display and GT911 touchscreen test. (Layout V1.1)" 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. device_area: "Bedroom" # Allows ESP device to be automatically linked to an 'Area' in Home Assistant.
# Project Naming # Project Naming
project_name: "Guition.JC1060P470C_I_W_Y" # Project Details project_name: "Guition.JC1060P470C_I_W_Y" # Project Details
project_version: "v0.6" # Project V denotes release of yaml file, allowing checking of deployed vs latest version project_version: "v0.7" # Project V denotes release of yaml file, allowing checking of deployed vs latest version
# Passwords & Secrets # Passwords & Secrets
api_key: !secret esp-api_key # unfortunately you can't use substitutions inside secrets names 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 ota_pass: !secret esp-ota_pass # unfortunately you can't use substitutions inside secrets names
# Device Settings # Device Settings
log_level: "INFO" # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE log_level: "INFO" # Define logging level: NONE, ERROR, WARN, INFO, DEBUG, VERBOSE, VERY_VERBOSE
update_interval: "60s" # update time for general sensors etc update_interval: "60s" # update time for general sensors etc
# Display Settings # Display Settings
backlight_pin: "GPIO23" backlight_pin: "GPIO23"
backlight_frequency: "1220Hz" backlight_frequency: "1220Hz"
display_update_interval: "5s"
# Touchscreen Settings # Touchscreen Settings
touch_sda_pin: "GPIO7" touch_sda_pin: "GPIO7"
@@ -98,6 +99,9 @@ substitutions:
touch_interrupt_pin: "GPIO21" touch_interrupt_pin: "GPIO21"
touch_reset_pin: "GPIO22" touch_reset_pin: "GPIO22"
# Home Assistant Test Entity
test_helper_entity: "input_boolean.test_touchscreen_button"
#:########################################################################################:# #:########################################################################################:#
# PACKAGES: # PACKAGES:
# Included Common Packages # Included Common Packages
@@ -224,12 +228,22 @@ api:
level: INFO level: INFO
format: "API connected: ESP Bedside Panel is online" format: "API connected: ESP Bedside Panel is online"
- lvgl.label.update:
id: connection_status_label
text: "Connected to Home Assistant"
text_color: 0x65D483
on_client_disconnected: on_client_disconnected:
then: then:
- logger.log: - logger.log:
level: WARN level: WARN
format: "API disconnected: ESP Bedside Panel is offline from Home Assistant" 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
#:########################################################################################:# #:########################################################################################:#
# OTA: # OTA:
# https://esphome.io/components/ota/esphome.html # https://esphome.io/components/ota/esphome.html
@@ -292,48 +306,9 @@ display:
color_order: RGB color_order: RGB
reset_pin: reset_pin:
number: GPIO5 number: GPIO5
rotation: 0
hsync_pulse_width: 20 hsync_pulse_width: 20
update_interval: "${display_update_interval}" update_interval: never
auto_clear_enabled: true auto_clear_enabled: false
lambda: |-
it.fill(Color(8, 12, 18));
it.printf(
512,
185,
id(font_heading),
Color::WHITE,
TextAlign::CENTER,
"ESPHome Display OK"
);
it.printf(
512,
270,
id(font_normal),
Color(0, 190, 255),
TextAlign::CENTER,
"Touchscreen Test"
);
it.printf(
512,
335,
id(font_small),
Color(180, 180, 180),
TextAlign::CENTER,
"Touch the screen and check the ESPHome logs"
);
it.printf(
512,
390,
id(font_small),
Color(180, 180, 180),
TextAlign::CENTER,
"Expected range: X 0-1023 / Y 0-599"
);
#:########################################################################################:# #:########################################################################################:#
# TOUCHSCREEN: # TOUCHSCREEN:
@@ -345,18 +320,21 @@ touchscreen:
display: main_display display: main_display
i2c_id: touch_i2c i2c_id: touch_i2c
address: 0x5D address: 0x5D
interrupt_pin: interrupt_pin:
number: "${touch_interrupt_pin}" number: "${touch_interrupt_pin}"
mode: mode:
input: true input: true
reset_pin: reset_pin:
number: "${touch_reset_pin}" number: "${touch_reset_pin}"
mode: mode:
output: true output: true
on_touch: on_touch:
then: then:
- lambda: |- - lambda: |-
ESP_LOGI( ESP_LOGD(
"touch", "touch",
"Touch detected: x=%d, y=%d, x_raw=%d, y_raw=%d", "Touch detected: x=%d, y=%d, x_raw=%d, y_raw=%d",
touch.x, touch.x,
@@ -368,7 +346,7 @@ touchscreen:
on_release: on_release:
then: then:
- logger.log: - logger.log:
level: INFO level: DEBUG
format: "Touch released" format: "Touch released"
#:########################################################################################:# #:########################################################################################:#
@@ -378,15 +356,147 @@ touchscreen:
font: font:
- file: "gfonts://Roboto" - file: "gfonts://Roboto"
id: font_heading id: font_heading
size: 64 size: 54
glyphs:
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789"
- " .:-"
- file: "gfonts://Roboto" - file: "gfonts://Roboto"
id: font_normal id: font_normal
size: 34 size: 32
glyphs:
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789"
- " .:-"
- file: "gfonts://Roboto" - file: "gfonts://Roboto"
id: font_small id: font_button
size: 24 size: 42
glyphs:
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789"
- " .:-"
#:########################################################################################:#
# 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: # SENSORS:
@@ -415,9 +525,12 @@ text_sensor:
- platform: wifi_info - platform: wifi_info
ip_address: ip_address:
name: "${friendly_name} IP Address" name: "${friendly_name} IP Address"
ssid: ssid:
name: "${friendly_name} Connected SSID" name: "${friendly_name} Connected SSID"
bssid: bssid:
name: "${friendly_name} Connected BSSID" name: "${friendly_name} Connected BSSID"
mac_address: mac_address:
name: "${friendly_name} MAC Address" name: "${friendly_name} MAC Address"