Skip to content

Commit

Permalink
[lvgl] Fix set state on updates (esphome#7227)
Browse files Browse the repository at this point in the history
  • Loading branch information
clydebarrow authored Aug 8, 2024
1 parent b71c034 commit a47a17d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions esphome/components/lvgl/lvgl_esphome.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion esphome/components/lvgl/widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a47a17d

Please sign in to comment.