1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 00:31:58 +00:00

[lvgl] Fix setting empty text (#13494)

This commit is contained in:
Clyde Stubbs
2026-01-24 11:44:34 +11:00
committed by GitHub
parent 5f2203b915
commit 069db2e128
2 changed files with 4 additions and 1 deletions

View File

@@ -32,7 +32,7 @@ class LabelType(WidgetType):
async def to_code(self, w: Widget, config): async def to_code(self, w: Widget, config):
"""For a text object, create and set text""" """For a text object, create and set text"""
if value := config.get(CONF_TEXT): if (value := config.get(CONF_TEXT)) is not None:
await w.set_property(CONF_TEXT, await lv_text.process(value)) await w.set_property(CONF_TEXT, await lv_text.process(value))
await w.set_property(CONF_LONG_MODE, config) await w.set_property(CONF_LONG_MODE, config)
await w.set_property(CONF_RECOLOR, config) await w.set_property(CONF_RECOLOR, config)

View File

@@ -197,6 +197,9 @@ lvgl:
- lvgl.label.update: - lvgl.label.update:
id: msgbox_label id: msgbox_label
text: Unloaded text: Unloaded
- lvgl.label.update:
id: msgbox_label
text: "" # Empty text
on_all_events: on_all_events:
logger.log: logger.log:
format: "Event %s" format: "Event %s"