mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 12:55:46 +01:00
[lvgl] Fix set state on updates (#7227)
This commit is contained in:
parent
b71c03424e
commit
a47a17d7e7
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_LVGL_BINARY_SENSOR
|
||||
#ifdef USE_BINARY_SENSOR
|
||||
#include "esphome/components/binary_sensor/binary_sensor.h"
|
||||
#endif // USE_LVGL_BINARY_SENSOR
|
||||
#endif // USE_BINARY_SENSOR
|
||||
#ifdef USE_LVGL_ROTARY_ENCODER
|
||||
#include "esphome/components/rotary_encoder/rotary_encoder.h"
|
||||
#endif // USE_LVGL_ROTARY_ENCODER
|
||||
|
@ -271,6 +271,7 @@ async def set_obj_properties(w: Widget, config):
|
||||
"""Generate a list of C++ statements to apply properties to an lv_obj_t"""
|
||||
if layout := config.get(CONF_LAYOUT):
|
||||
layout_type: str = layout[CONF_TYPE]
|
||||
add_lv_use(layout_type)
|
||||
lv_obj.set_layout(w.obj, literal(f"LV_LAYOUT_{layout_type.upper()}"))
|
||||
if layout_type == TYPE_GRID:
|
||||
wid = config[CONF_ID]
|
||||
@ -334,7 +335,7 @@ async def set_obj_properties(w: Widget, config):
|
||||
for key, value in states.items():
|
||||
if isinstance(value, cv.Lambda):
|
||||
lambs[key] = value
|
||||
elif value == "true":
|
||||
elif value:
|
||||
adds.add(key)
|
||||
else:
|
||||
clears.add(key)
|
||||
|
Loading…
Reference in New Issue
Block a user