diff --git a/esphome/components/lvgl/lvgl_esphome.h b/esphome/components/lvgl/lvgl_esphome.h index 45841b99d919..1497e1004a3c 100644 --- a/esphome/components/lvgl/lvgl_esphome.h +++ b/esphome/components/lvgl/lvgl_esphome.h @@ -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 diff --git a/esphome/components/lvgl/widgets/__init__.py b/esphome/components/lvgl/widgets/__init__.py index f1946015bc4f..603de6aa3ed3 100644 --- a/esphome/components/lvgl/widgets/__init__.py +++ b/esphome/components/lvgl/widgets/__init__.py @@ -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)