Derham
(Derham)
March 5, 2025, 10:21am
22
Morning Aaron,
That’s all working fine you just need to turn on the backlight which is off by default. Add this…
# Home Assistant API with encryption and renamed ID
api:
id: ha_api
encryption:
key: !secret api_encryption_key
on_client_connected:
- if:
condition:
lambda: 'return (0 == client_info.find("Home Assistant "));'
then:
- switch.turn_on: lcdbacklight
################################################################################
# Switch
################################################################################
switch:
- platform: gpio
id: lcdbacklight
name: lcdbacklight
pin:
ch422g: ch422g_hub
number: 2
mode:
output: true
inverted: false
restore_mode: ALWAYS_ON
lol thanks. That fixed it lol. I also added a wire so I can control the backlight brightness.
I am using UART2 (GPIO 43 and 44) and have set the toggle switch to UART2. However, even after disabling the log component output or turning off the ESP Console, the sensor still does not work on the UART2 interface. Has anyone been able to get the sensor working on UART2?
I made my own HMI design for this device.
It’s currently mounted on the wall in my garage.
All the code is shared.
Lots of info in the github repo (link in the thread).
For the past couple of weeks, I’ve been cooking up a HMI for my garage. The motivator was to cover the area that was previously occupied by a very old alarm keypad I removed the panel a couple weeks ago. And you know, provide cool features to my home automation setup while doing so!
First attempt at using ESPHome’s LVGL component.
Quick video of it in action:
[ESPHome HMI on Waveshare ESP32-S3-Touch-LCD-7]
So far it’s working OK. A couple of bugs and glitches I hope to get fixed i…
2 Likes
inytar
(Pieter)
May 22, 2025, 8:21pm
26
I wanted to reduce the copy and pasting that needs to be done to use this display, so I created an ESPHome package you can use. Hope it helps someone! GitHub - inytar/waveshare-esp32-s3-touch-lcd-7-esphome: ESPHome package to use with waveshare-esp32-s3-touch-lcd-7
Hi, could someone possibly help me? I have Waveshare 7" and 4.3" displays, and I’m trying to add an XL9535 2-channel relay using the YAML code below.
I’ve tested the code and relays on an ESP32 WROOM using SDA: 21 and SCL: 22, and everything works fine. So I connected it to both my 7" and 4.3" screens, changing to SDA: 8 and SCL: 9. For the most part, it works.
The problem I have is that I cannot control Relay 1 - Relay 2 works. I’ve tried changing the pin number from 0–7 and 10–17, but nothing works. I’ve also tried changing inverted: false to true, but there’s no change.
Any help would be greatly appreciated!
i2c:
sda: GPIO8
scl: GPIO9
frequency: 100kHz
scan: true
xl9535:
- id: xl9535_hub
address: 0x20
switch:
- platform: gpio
name: "Relay 1"
id: relay_door
pin:
xl9535: xl9535_hub
number: 0
mode:
output: true
inverted: false
- platform: gpio
name: "Relay 2"
id: relay_light
pin:
xl9535: xl9535_hub
number: 1
leev
June 16, 2025, 2:21pm
28
Hello Derham, can you please tell me the RS485 pin details in ESP32-S3-Touch-LCD-7? i just need to interface the QR scanner through the RS485 so please guide me the tx and rx then if need rts pin.
Derham
(Derham)
June 17, 2025, 11:14am
29
Hi leev, sorry i haven’t used the RS485 connections yet. Perhaps someone else can chip in with the answer?
Leev, the following has been working for me on the ESP32-S3-Touch-LCD-7.
uart:
id: modbus_uart
tx_pin: GPIO16
rx_pin: GPIO15
baud_rate: 9600
stop_bits: 1
parity: NONE
dir
July 10, 2025, 6:56am
31
I really need som help with my ESP32 S3 Waveshare 7" touch display. It stoped working for a couple of month ago. I tried to reflashed with my latest yaml config but the screen is black. I also bought a new screen and that one is also black no matter what yaml configuration I load up. Now I tried with a configuration that worked before - also black screen but I can se some kind of background light. The code that worked before but now gives me a black screen is this: GitHub - runevad/waveshare-esp32-s3-7inch: ESPHome with Waveshare esp32-s3 7inch tablet
I would be greatful for any idea of what I have missed.
´´´
Arh
July 10, 2025, 7:14am
32
Is the code compiling OK? Because if I remember correctly i needed to add this under esp32:
cpu_frequency: 240MHz
before it wouldn’t compile, then every time it is updated it gives a black screen. I then unplug it and it restarts fine. If I restart using the restart button it doesn’t boot. A quick unplug and plug in and its fine again. I gave up trying to find out why.
dir
July 10, 2025, 8:11am
33
Thanks for your replay. Sorry but that didn’t solve the problem. Hers’s my complete code:
################################################################################
# Substitution Variables
################################################################################
substitutions:
device_internal_name: esp7display
device_wifi_name: esp7display
device_friendly_name: esp7display
device_ip_address: 192.168.1.190
device_sampling_time: 30s
# glyphs
lightbulb_on: "\U000F0335"
lightbulb_off: "\U000F0336"
################################################################################
# Globals
################################################################################
globals: ##to set default reboot behavior
- id: wifi_connection
type: bool
restore_value: no
initial_value: "false"
################################################################################
# Board Configuration
################################################################################
esphome:
name: ${device_internal_name}
friendly_name: ${device_friendly_name}
platformio_options:
build_flags: "-DBOARD_HAS_PSRAM"
board_build.arduino.memory_type: qio_opi
board_build.flash_mode: dio
board_upload.maximum_ram_size: 524288
psram:
mode: quad
speed: 80MHz
esp32:
cpu_frequency: 240MHz
board: esp32s3box
variant: ESP32S3
flash_size: 8MB
framework:
type: esp-idf
platform_version: 6.9.0
version: 5.3.0
sdkconfig_options:
COMPILER_OPTIMIZATION_SIZE: y
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESPTOOLPY_FLASHSIZE_8MB: "y"
CONFIG_FREERTOS_HZ: "1000"
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240: y
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
CONFIG_SPIRAM_RODATA: y
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: y
CONFIG_COMPILER_OPTIMIZATION_PERF: y
################################################################################
# Enable logging
################################################################################
logger:
logs:
component: ERROR
################################################################################
# Enable Home Assistant API
################################################################################
api:
id: ha_api
#encryption:
# key: !secret api_encryption_key
on_client_connected:
- if:
condition:
lambda: 'return (0 == client_info.find("Home Assistant "));'
then:
- switch.turn_on: lcdbacklight
################################################################################
# OTA
################################################################################
ota:
platform: esphome
##password: !secret web_server_password
################################################################################
# WiFi
################################################################################
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
output_power: 13
reboot_timeout: 30min
##manual_ip:
## static_ip: ${device_ip_address}
## gateway: !secret gateway_address
## subnet: !secret subnet_address
ap:
# ssid: ${device_wifi_name}
##password: !secret web_server_password
captive_portal:
################################################################################
# Web Server
################################################################################
web_server:
port: 80
version: 3
include_internal: true
##auth:
## username: !secret web_server_user
## password: !secret web_server_password
local: true
################################################################################
# IO Extender
################################################################################
ch422g:
- id: ch422g_hub
################################################################################
# Switch
################################################################################
switch:
- platform: restart
name: "Restart"
id: device_restart
- platform: safe_mode
name: Use Safe Mode
id: device_safe_mode
- platform: gpio
id: lcdbacklight
name: lcdbacklight
pin:
ch422g: ch422g_hub
number: 2
mode:
output: true
inverted: false
restore_mode: ALWAYS_ON
################################################################################
# Sensors
################################################################################
sensor:
# WiFi
- platform: wifi_signal
name: "WiFi Signal Sensor"
id: ${device_internal_name}_wifi_signal_sensor
update_interval: 10s
################################################################################
# Text Sensors
################################################################################
text_sensor:
- platform: homeassistant
id: remote_light
entity_id: switch.smart_power_strip_socket_2
on_value:
then:
- lvgl.widget.update: # matrix button
id: btn_light
state:
checked: !lambda return (0 == x.compare(std::string{"on"}));
disabled: !lambda return ((0 == x.compare(std::string{"unavailable"})) or (0 == x.compare(std::string{"unknown"})));
- lvgl.label.update:
id: btn_light_icon # the matrix icon
text: !lambda |-
static char buf[10];
std::string icon;
if (0 == x.compare(std::string{"on"})) {
icon = "$lightbulb_on";
} else {
icon = "$lightbulb_off";
}
snprintf(buf, sizeof(buf), "%s", icon.c_str());
return buf;
color:
- id: my_red
red: 100%
green: 0%
blue: 0%
- id: my_pink
red: 100%
green: 10%
blue: 40%
- id: my_yellow
red: 100%
green: 100%
blue: 0%
- id: my_green
red: 0%
green: 100%
blue: 0%
- id: my_blue
red: 0%
green: 0%
blue: 100%
- id: my_gray
red: 50%
green: 50%
blue: 50%
- id: my_white
red: 100%
green: 100%
blue: 100%
- id: my_black
red: 0%
green: 0%
blue: 0%
font:
- file: "fonts/arial.ttf"
id: arial_98
size: 98
- file: "fonts/arial.ttf"
id: arial_96
size: 96
- file: "fonts/arial.ttf"
id: arial_134
size: 134
- file: "fonts/arial.ttf"
id: arial_128
size: 128
- file: "fonts/arial.ttf"
id: arial_48
size: 48
- file: "fonts/arial.ttf"
id: arial_36
size: 36
- file: "fonts/arial.ttf"
id: arial_24
size: 24
- file: "fonts/arial.ttf"
id: arial_18
size: 18
- file: "fonts/arial.ttf"
id: arial_12
size: 12
- file: "gfonts://Roboto"
id: roboto10
size: 10
bpp: 4
- file: "fonts/materialdesignicons-webfont.ttf"
id: mdi_42
size: 42
bpp: 4
glyphs: [
"$lightbulb_on",
"$lightbulb_off",
]
############################################ START OF VLGL
lvgl:
theme:
arc:
scroll_on_focus: true
#group: general
slider:
scroll_on_focus: true
#group: general
label:
text_font: arial_18
button:
scroll_on_focus: true
#group: general
border_width: 2
text_font: arial_24
outline_pad: 6
bg_color: my_blue
bg_grad_color: 0x005782
bg_grad_dir: VER
pressed:
border_color: my_yellow
checked:
border_color: my_blue
bg_color: my_yellow
focused:
border_color: my_white
style_definitions:
- id: header_footer
bg_color: 0x2F8CD8
bg_grad_color: 0x005782
bg_grad_dir: VER
bg_opa: COVER
border_opa: TRANSP
radius: 0
pad_all: 0
pad_row: 0
pad_column: 0
border_color: 0x0077b3
text_color: 0xFFFFFF
width: 100%
height: 30
- id: matrix
bg_color: my_green
bg_grad_color: 0x005782
bg_grad_dir: VER
bg_opa: COVER
border_opa: TRANSP
radius: 0
pad_all: 0
pad_row: 0
pad_column: 0
border_color: 0x0077b3
text_color: 0xFFFFFF
width: 100%
height: 30
top_layer:
widgets:
- line: ######### blue border
points:
- 0, 0
- 799, 0
- 799, 479
- 0, 479
- 0, 0
line_width: 4
line_color: my_blue
line_rounded: true
log_level: INFO
color_depth: 16
buffer_size: 25%
bg_color: my_black
text_font: arial_24
width: 800
height: 480
align: center
pages:
- id: main_page
widgets:
- obj:
align: CENTER
width: 450
height: 420
pad_all: 6
bg_opa: TRANSP
border_opa: TRANSP
layout:
type: GRID
grid_columns: [FR(1), FR(1), FR(1)]
grid_rows: [FR(25), FR(25), FR(25), FR(25)]
widgets:
- button:
grid_cell_column_pos: 0
grid_cell_row_pos: 0
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
grid_cell_column_pos: 0
grid_cell_row_pos: 1
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
id: btn_light
grid_cell_column_pos: 0
grid_cell_row_pos: 2
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
text_font: mdi_42
widgets:
- label:
id: btn_light_icon
align: CENTER
y: -20
text_font: mdi_42
text: "$lightbulb_off" # mdi-lightbulb-outline
- label:
#id: cov_up_east
align: CENTER
y: 20
text: "Light"
text_color: my_white
text_font: arial_18
on_short_click:
- homeassistant.action:
action: switch.toggle
data:
entity_id: switch.smart_power_strip_socket_2
- logger.log:
format: "Light button clicked: %d"
args: [ x ]
- button:
grid_cell_column_pos: 0
grid_cell_row_pos: 3
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
grid_cell_column_pos: 1
grid_cell_row_pos: 0
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
grid_cell_column_pos: 1
grid_cell_row_pos: 1
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
grid_cell_column_pos: 1
grid_cell_row_pos: 2
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
grid_cell_column_pos: 1
grid_cell_row_pos: 3
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
grid_cell_column_pos: 2
grid_cell_row_pos: 0
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
grid_cell_column_pos: 2
grid_cell_row_pos: 1
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
grid_cell_column_pos: 2
grid_cell_row_pos: 2
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
- button:
grid_cell_column_pos: 2
grid_cell_row_pos: 3
grid_cell_x_align: STRETCH
grid_cell_y_align: STRETCH
########################################################### END OF VLGL
i2c:
sda: GPIO08
scl: GPIO09
scan: True
id: bus_a
# Define display
display:
- platform: rpi_dpi_rgb
id: my_display
update_interval: never
auto_clear_enabled: false
color_order: RGB
pclk_frequency: 16MHZ
dimensions:
width: 800
height: 480
de_pin:
number: 5
hsync_pin:
number: 46
ignore_strapping_warning: true
vsync_pin:
number: 3
ignore_strapping_warning: true
pclk_pin: 7
pclk_inverted: true
reset_pin:
ch422g: ch422g_hub
number: 3
hsync_back_porch: 8
hsync_front_porch: 8
hsync_pulse_width: 4
vsync_back_porch: 16
vsync_front_porch: 16
vsync_pulse_width: 4
data_pins:
red:
- 1 #r3
- 2 #r4
- 42 #r5
- 41 #r6
- 40 #r7
blue:
- 14 #b3
- 38 #b4
- 18 #b5
- 17 #b6
- 10 #b7
green:
- 39 #g2
- 0 #g3
- 45 #g4
- 48 #g5
- 47 #g6
- 21 #g7
touchscreen:
platform: gt911
id: my_touch
interrupt_pin: GPIO4
reset_pin:
ch422g: ch422g_hub
number: 1
mode: OUTPUT
on_touch:
- lambda: |-
ESP_LOGI("Touch", "Touch detected at x=%d, y=%d", touch.x, touch.y);
on_update:
- lambda: |-
for (auto touch: touches) {
if (touch.state <= 2) {
ESP_LOGI("Touch points:", "id=%d x=%d, y=%d x.raw=%d, y.raw=%d", touch.id, touch.x, touch.y, touch.x_raw, touch.y_raw);
}
}
Arh
July 10, 2025, 8:47am
34
I have just checked my code which is based on the code you used and the only difference I can see is the 2 lines under type: esp-idf
mine looks like this
esp32:
board: esp32-s3-devkitc-1
variant: ESP32S3
flash_size: 8MB
cpu_frequency: 240MHz
framework:
type: esp-idf
advanced:
enable_idf_experimental_features: true
sdkconfig_options:
COMPILER_OPTIMIZATION_SIZE: y
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESPTOOLPY_FLASHSIZE_8MB: "y"
CONFIG_FREERTOS_HZ: "1000"
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240: "y"
CONFIG_ESPTOOLPY_FLASHMODE_QIO: y
CONFIG_ESPTOOLPY_FLASHFREQ_120M: y
CONFIG_SPIRAM_MODE_OCT: y
CONFIG_IDF_EXPERIMENTAL_FEATURES: y
CONFIG_SPIRAM_SPEED_120M: y
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
CONFIG_SPIRAM_RODATA: y
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: y
CONFIG_COMPILER_OPTIMIZATION_PERF: y
I had changed mine form looking exactly like yours for some reason I can’t remember.
I am no expert in this yaml esphome stuff though so I may be very wrong.
smoga
(Svencillo)
July 11, 2025, 3:10pm
35
Hey, seems that was for the latest update of esphome, I got issues after the update of esphome in home assistant. Comenting out all the sdkconfig_options solved the problem since with the latest esphome update manage this for himself.
dir
July 11, 2025, 5:31pm
36
OK! thanks for the info. I found a configuration that works. I will rebuild my display from that configuration. This is the configuration: inytar
1 Like