From bb27eaaf1e58316c6124f2d16a1fba6b0a033141 Mon Sep 17 00:00:00 2001 From: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:25:29 +1100 Subject: [PATCH] [lvgl] Add `on_change` event (#7939) --- esphome/components/lvgl/defines.py | 1 + tests/components/lvgl/lvgl-package.yaml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/esphome/components/lvgl/defines.py b/esphome/components/lvgl/defines.py index 5371f110a6..02323f9655 100644 --- a/esphome/components/lvgl/defines.py +++ b/esphome/components/lvgl/defines.py @@ -168,6 +168,7 @@ LV_EVENT_MAP = { "READY": "READY", "CANCEL": "CANCEL", "ALL_EVENTS": "ALL", + "CHANGE": "VALUE_CHANGED", } LV_EVENT_TRIGGERS = tuple(f"on_{x.lower()}" for x in LV_EVENT_MAP) diff --git a/tests/components/lvgl/lvgl-package.yaml b/tests/components/lvgl/lvgl-package.yaml index 556ce105ee..b1b89adfe0 100644 --- a/tests/components/lvgl/lvgl-package.yaml +++ b/tests/components/lvgl/lvgl-package.yaml @@ -165,6 +165,11 @@ lvgl: - Nov - Dec selected_index: 1 + on_change: + then: + - logger.log: + format: "Roller changed = %d: %s" + args: [x, text.c_str()] on_value: then: - logger.log: