Files
zorruno-homeassistant/esphome/esp-bedside-panel.yaml
T
ESPHome Device Builder e013bab5c9 Edit esp-bedside-panel.yaml
2026-07-14 22:06:30 +12:00

423 lines
14 KiB
YAML

#:########################################################################################:#
# 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.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 / referenced 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 is intended to confirm:
# - MIPI-DSI display remains stable
# - Display test text is rendered
# - Backlight brightness remains adjustable from Home Assistant
# - GT911 touchscreen initialises
# - Touch coordinates appear in ESPHome logs
# - Display remains in native landscape orientation for this test.
# - Touch the screen at several locations and inspect the logs.
# - Expected coordinate range is approximately:
# - X: 0 to 1023
# - Y: 0 to 599
# - Portrait rotation and LVGL will be added after touch is confirmed.
# - This version intentionally does not yet configure:
# - Ethernet
# - LVGL
# - Ambient light sensor
# - RTC
# - Camera
#:########################################################################################:#
# OFFLINE NOTES:
# - Display rendering and touch detection operate locally.
# - Home Assistant is not required for the display or touchscreen to work.
# - Backlight state is restored locally after restart.
#:########################################################################################:#
#:########################################################################################:#
# 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. Display and GT911 touchscreen 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.6" # 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 (Default), VERBOSE, VERY_VERBOSE
update_interval: "60s" # update time for general sensors etc
# Display Settings
backlight_pin: "GPIO23"
backlight_frequency: "1220Hz"
display_update_interval: "5s"
# Touchscreen Settings
touch_sda_pin: "GPIO7"
touch_scl_pin: "GPIO8"
touch_interrupt_pin: "GPIO21"
touch_reset_pin: "GPIO22"
#:########################################################################################:#
# 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"
on_client_disconnected:
then:
- logger.log:
level: WARN
format: "API disconnected: ESP Bedside Panel is offline from Home Assistant"
#:########################################################################################:#
# 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
rotation: 0
hsync_pulse_width: 20
update_interval: "${display_update_interval}"
auto_clear_enabled: true
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:
# 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_LOGI(
"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: INFO
format: "Touch released"
#:########################################################################################:#
# FONTS:
# https://esphome.io/components/font.html
#:########################################################################################:#
font:
- file: "gfonts://Roboto"
id: font_heading
size: 64
- file: "gfonts://Roboto"
id: font_normal
size: 34
- file: "gfonts://Roboto"
id: font_small
size: 24
#:########################################################################################:#
# 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"