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
|
#pragma once
|
||||||
#include "esphome/core/defines.h"
|
#include "esphome/core/defines.h"
|
||||||
|
|
||||||
#ifdef USE_LVGL_BINARY_SENSOR
|
#ifdef USE_BINARY_SENSOR
|
||||||
#include "esphome/components/binary_sensor/binary_sensor.h"
|
#include "esphome/components/binary_sensor/binary_sensor.h"
|
||||||
#endif // USE_LVGL_BINARY_SENSOR
|
#endif // USE_BINARY_SENSOR
|
||||||
#ifdef USE_LVGL_ROTARY_ENCODER
|
#ifdef USE_LVGL_ROTARY_ENCODER
|
||||||
#include "esphome/components/rotary_encoder/rotary_encoder.h"
|
#include "esphome/components/rotary_encoder/rotary_encoder.h"
|
||||||
#endif // USE_LVGL_ROTARY_ENCODER
|
#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"""
|
"""Generate a list of C++ statements to apply properties to an lv_obj_t"""
|
||||||
if layout := config.get(CONF_LAYOUT):
|
if layout := config.get(CONF_LAYOUT):
|
||||||
layout_type: str = layout[CONF_TYPE]
|
layout_type: str = layout[CONF_TYPE]
|
||||||
|
add_lv_use(layout_type)
|
||||||
lv_obj.set_layout(w.obj, literal(f"LV_LAYOUT_{layout_type.upper()}"))
|
lv_obj.set_layout(w.obj, literal(f"LV_LAYOUT_{layout_type.upper()}"))
|
||||||
if layout_type == TYPE_GRID:
|
if layout_type == TYPE_GRID:
|
||||||
wid = config[CONF_ID]
|
wid = config[CONF_ID]
|
||||||
@ -334,7 +335,7 @@ async def set_obj_properties(w: Widget, config):
|
|||||||
for key, value in states.items():
|
for key, value in states.items():
|
||||||
if isinstance(value, cv.Lambda):
|
if isinstance(value, cv.Lambda):
|
||||||
lambs[key] = value
|
lambs[key] = value
|
||||||
elif value == "true":
|
elif value:
|
||||||
adds.add(key)
|
adds.add(key)
|
||||||
else:
|
else:
|
||||||
clears.add(key)
|
clears.add(key)
|
||||||
|
Loading…
Reference in New Issue
Block a user