#:########################################################################################:# # TITLE: ESP BEDSIDE PANEL # zorruno.com layout v1.1 2026 #:########################################################################################:# # REPO: # https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-bedside-panel.yaml #:########################################################################################:# # 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.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.3 2026-07-14 Added backlight control and first MIPI display text test # V0.2 2026-07-14 Added ESP32 hosted WiFi via ESP32-C6 co-processor # V0.1 2026-07-14 Initial ESPHome bring-up for Guition JC1060P470C_I_W_Y ESP32-P4 panel #:########################################################################################:# # HARDWARE: # - Guition JC1060P470C_I_W_Y # - 7 inch 1024x600 capacitive touch display # - ESP32-P4 main processor # - ESP32-C6 wireless co-processor # - 16MB flash # - 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 # - Display interface: MIPI-DSI # - Display reset: GPIO5 # - Display backlight PWM: GPIO23 # - Touch controller: GT911 # - Touch I2C SDA: GPIO7 # - Touch I2C SCL: GPIO8 # - Touch interrupt: GPIO21 # - Touch reset: GPIO22 # - 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 #:########################################################################################:# # 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. #:########################################################################################:# #:########################################################################################:# # SUBSTITUTIONS: # Specific device variable substitutions # If NOT using a secrets file, just replace these with the passwords etc (in quotes) #:########################################################################################:# 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. # 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 # 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 # 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 # Display Settings backlight_pin: "GPIO23" backlight_frequency: "1220Hz" # Touchscreen Settings touch_sda_pin: "GPIO7" touch_scl_pin: "GPIO8" touch_interrupt_pin: "GPIO21" touch_reset_pin: "GPIO22" # Home Assistant Test Entity test_helper_entity: "input_boolean.test_touchscreen_button" #:########################################################################################:# # PACKAGES: # Included Common Packages # https://esphome.io/components/packages.html #:########################################################################################:# 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) #### common_api: !include file: common/api_common.yaml #file: common/api_common_noencryption.yaml vars: local_api_key: "${api_key}" #### MQTT #### #common_mqtt: !include # file: common/mqtt_common.yaml # vars: # local_device_name: "${device_name}" #### WEB PORTAL #### #common_webportal: !include common/webportal_common_nopass.yaml #### SNTP (Only use if you want/need accurate timeclocks) #### #common_sntp: !include common/sntp_common.yaml #### DIAGNOSTICS Sensors #### #diag_basic: !include common/include_basic_diag_sensors.yaml #diag_more: !include common/include_more_diag_sensors.yaml #diag_debug: !include common/include_debug_diag_sensors.yaml #diag_resetcount: !include common/include_resetcount_diag_sensors.yaml #:########################################################################################:# # ESPHOME: # https://esphome.io/components/esphome.html #:########################################################################################:# esphome: name: "${device_name}" friendly_name: "${friendly_name}" comment: "${description_comment}" # Appears on the ESPHome page in HA area: "${device_area}" project: name: "${project_name}" version: "${project_version}" #:########################################################################################:# # ESP PLATFORM AND FRAMEWORK: # https://esphome.io/components/esp32.html #:########################################################################################:# esp32: variant: ESP32P4 engineering_sample: true cpu_frequency: 360MHz flash_size: 16MB framework: type: esp-idf advanced: enable_idf_experimental_features: true disable_vfs_support_termios: false disable_vfs_support_select: false disable_vfs_support_dir: false sdkconfig_options: CONFIG_SPIRAM_XIP_FROM_PSRAM: "y" CONFIG_SDMMC_HOST_DEFAULT: "y" #:########################################################################################:# # PSRAM: # https://esphome.io/components/psram.html #:########################################################################################:# psram: mode: hex speed: 200MHz #:########################################################################################:# # ESP32 HOSTED WIFI COPROCESSOR: # https://esphome.io/components/esp32_hosted.html #:########################################################################################:# esp32_hosted: variant: ESP32C6 reset_pin: GPIO54 cmd_pin: GPIO19 clk_pin: GPIO18 d0_pin: GPIO14 d1_pin: GPIO15 d2_pin: GPIO16 d3_pin: GPIO17 active_high: true #:########################################################################################:# # ESP LDO: # Supplies the ESP32-P4 MIPI-DSI PHY #:########################################################################################:# esp_ldo: - channel: 3 id: dsi_phy_enable voltage: 2.5V adjustable: true #:########################################################################################:# # LOGGER: # https://esphome.io/components/logger.html #:########################################################################################:# logger: level: "${log_level}" # INFO Level suggested, or DEBUG for testing baud_rate: 115200 hardware_uart: USB_SERIAL_JTAG #tx_buffer_size: 64 #:########################################################################################:# # HOME ASSISTANT API: #:########################################################################################:# api: on_client_connected: then: - logger.log: level: INFO 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: then: - logger.log: level: WARN 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: # https://esphome.io/components/ota/esphome.html #:########################################################################################:# ota: - platform: esphome password: "${ota_pass}" #:########################################################################################:# # TIME: # https://esphome.io/components/time/homeassistant.html #:########################################################################################:# time: - platform: homeassistant id: ha_time #:########################################################################################:# # I2C: # https://esphome.io/components/i2c.html #:########################################################################################:# i2c: - id: touch_i2c sda: "${touch_sda_pin}" scl: "${touch_scl_pin}" frequency: 400kHz scan: true #:########################################################################################:# # OUTPUT: # https://esphome.io/components/output/ledc.html #:########################################################################################:# output: - platform: ledc pin: "${backlight_pin}" id: backlight_output frequency: "${backlight_frequency}" #:########################################################################################:# # LIGHT: # https://esphome.io/components/light/monochromatic.html #:########################################################################################:# light: - platform: monochromatic output: backlight_output name: "Backlight" id: display_backlight icon: "mdi:brightness-6" restore_mode: RESTORE_DEFAULT_ON default_transition_length: 0s gamma_correct: 1.0 #:########################################################################################:# # DISPLAY: # https://esphome.io/components/display/mipi_dsi.html #:########################################################################################:# display: - platform: mipi_dsi model: JC1060P470 id: main_display color_order: RGB reset_pin: number: GPIO5 hsync_pulse_width: 20 update_interval: never auto_clear_enabled: false #:########################################################################################:# # TOUCHSCREEN: # https://esphome.io/components/touchscreen/gt911.html #:########################################################################################:# touchscreen: - platform: gt911 id: main_touchscreen display: main_display i2c_id: touch_i2c address: 0x5D interrupt_pin: number: "${touch_interrupt_pin}" mode: input: true reset_pin: number: "${touch_reset_pin}" 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 glyphs: - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789" - " .:-" - file: "gfonts://Roboto" id: font_normal size: 32 glyphs: - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789" - " .:-" - file: "gfonts://Roboto" id: font_button 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: # https://esphome.io/components/sensor/ #:########################################################################################:# sensor: - platform: uptime name: "${friendly_name} Uptime" id: uptime_sensor update_interval: "${update_interval}" - platform: wifi_signal name: "${friendly_name} WiFi Signal" id: wifi_signal_sensor update_interval: "${update_interval}" #:########################################################################################:# # TEXT SENSOR COMPONENT: # https://esphome.io/components/text_sensor/ #:########################################################################################:# text_sensor: - platform: version name: "${friendly_name} ESPHome Version" hide_timestamp: true - platform: wifi_info ip_address: name: "${friendly_name} IP Address" ssid: name: "${friendly_name} Connected SSID" bssid: name: "${friendly_name} Connected BSSID" mac_address: name: "${friendly_name} MAC Address"