Hi i am working on my first real LGVL ESPHome project and i am stuck already in the beginning.
so display is working and showing widgets like i should, but i can not get it to display values from homeassistant
my Widget:
lvgl:
pages:
- id: main_page # Default page
widgets:
- label:
id: text_label
align: CENTER
x: 0
y: 0
text: "Label Text"
and here the update code
sensor:
- platform: homeassistant
id: gw2000a_outdoor_temperature
name: "Ambient Temp"
entity_id: sensor.gw2000a_outdoor_temperature
on_value:
- lvgl.label.update:
id: text_label
text:
format: "Outdoor Temp: %.1f°C"
args: [ 'id(gw2000a_outdoor_temperature).state' ]
just a small exampe to show temp, but for some reason it does not update
AndyD
(Andy Dann)
July 6, 2025, 9:34am
2
I have this working fine... in my case I update the color based on temp.. I'm sure there is a simpler way of doing it but this works for me :-)
on_value:
- if:
condition:
lambda: |-
return x > 30;
then:
- lvgl.label.update:
id: lbl_outside_temp
text:
format: "%.0f°c"
args: [ 'x' ]
text_color: 0xFF0000
- if:
condition:
lambda: |-
return x <= 30;
then:
- lvgl.label.update:
id: lbl_outside_temp
text:
format: "%.0f°c"
args: [ 'x' ]
text_color: 0xFF8000
Mantus
July 6, 2025, 10:00am
3
here is my entire config, for some reason i dont get it to work:
esphome:
name: pooltechnik
friendly_name: PoolTechnik
platformio_options:
build_flags: "-DBOARD_HAS_PSRAM"
board_build.esp-idf.memory_type: qio_opi
board_build.flash_mode: dio
on_boot:
then:
- pcf85063.read_time:
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
sdkconfig_options:
CONFIG_FREERTOS_HZ: "1000"
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240: y
CONFIG_SPIRAM_SPEED_120M: y
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
CONFIG_SPIRAM_RODATA: y
CONFIG_ESP32S3_DATA_CACHE_64KB: y
CONFIG_COMPILER_OPTIMIZATION_PERF: y
# Enable logging
logger:
baud_rate: 0
# Enable Home Assistant API
api:
encryption:
key: !secret api_key
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Pooltechnik Fallback Hotspot"
password: !secret fallback_password
captive_portal:
sensor:
- platform: homeassistant
id: gw2000a_outdoor_temperature
name: "Ambient Temp"
entity_id: sensor.gw2000a_outdoor_temperature
on_value:
- lvgl.label.update:
id: text_label
text:
format: "Outdoor Temp: %.1f°C" # Format string (e.g., one decimal place)
args: [ 'id(gw2000a_outdoor_temperature).state' ] # Directly reference the sensor's state
- lvgl.widget.redraw:
lvgl_id: lvgl_1
i2c:
sda: GPIO8
scl: GPIO9
scan: true
id: bus_a
uart:
id: mbuart
tx_pin: GPIO44
rx_pin: GPIO43
baud_rate: 9600
stop_bits: 1
time:
- platform: pcf85063
id: pcf85063_time
address: 0x51
update_interval: never
- platform: homeassistant
on_time_sync:
then:
pcf85063.write_time:
modbus:
id: modbus1
uart_id: mbuart
modbus_controller:
- id: vfdFilter
address: 1
modbus_id: modbus1
update_interval: 1000ms
psram:
mode: octal
speed: 80MHz
touchscreen:
platform: gt911
id: main_touch
interrupt_pin: GPIO4
display:
- platform: rpi_dpi_rgb
id: main_display
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
hsync_back_porch: 30
hsync_front_porch: 210
hsync_pulse_width: 30
vsync_back_porch: 4
vsync_front_porch: 4
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
auto_clear_enabled: false
show_test_card: false
update_interval: never
lvgl:
- id: lvgl_1
displays: main_display
pages:
- id: main_page # Default page
widgets:
- label:
id: text_label
align: CENTER
x: 0
y: 0
text: "Label Text"
zoogara
(Daryl)
July 6, 2025, 10:06am
4
Best practice where you are referencing the value of a sensor within that sensor block is to use ‘x’, like Andy has.
You could also try:
on_value:
- lvgl.label.update:
id: text_label
text:
format: "Outdoor Temp: %.1f°C" # Format string
args: [ 'id(gw2000a_outdoor_temperature).get_state()' ]
I believe this is something to do with the way the printf statement is referenced…
Mantus
July 6, 2025, 10:58am
5
okay thank you, i thought this ‘x’ is just example code not that it is really directly referring to the sensor value.
i change it, but bad news is, still no update still always shows “Label Text”
zoogara
(Daryl)
July 6, 2025, 11:05am
6
Ok - what do the logs say - is the sensor actually getting updated?
Mantus
July 6, 2025, 12:28pm
7
Thanks i was idiotic, i did not activate the API in the settings of the device in homeassistant, i thought its active as soon as i add the api: section into the esphome config
1 Like