[lvgl] light schema should require widget: not led: (Bugfix) (#7649)

This commit is contained in:
Clyde Stubbs 2024-10-22 14:03:32 +11:00 committed by GitHub
parent 40cdb778f5
commit 8bb4316956
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -2,9 +2,9 @@ import esphome.codegen as cg
from esphome.components import light from esphome.components import light
from esphome.components.light import LightOutput from esphome.components.light import LightOutput
import esphome.config_validation as cv import esphome.config_validation as cv
from esphome.const import CONF_GAMMA_CORRECT, CONF_LED, CONF_OUTPUT_ID from esphome.const import CONF_GAMMA_CORRECT, CONF_OUTPUT_ID
from ..defines import CONF_LVGL_ID from ..defines import CONF_LVGL_ID, CONF_WIDGET
from ..lvcode import LvContext from ..lvcode import LvContext
from ..schemas import LVGL_SCHEMA from ..schemas import LVGL_SCHEMA
from ..types import LvType, lvgl_ns from ..types import LvType, lvgl_ns
@ -15,7 +15,7 @@ LVLight = lvgl_ns.class_("LVLight", LightOutput)
CONFIG_SCHEMA = light.RGB_LIGHT_SCHEMA.extend( CONFIG_SCHEMA = light.RGB_LIGHT_SCHEMA.extend(
{ {
cv.Optional(CONF_GAMMA_CORRECT, default=0.0): cv.positive_float, cv.Optional(CONF_GAMMA_CORRECT, default=0.0): cv.positive_float,
cv.Required(CONF_LED): cv.use_id(lv_led_t), cv.Required(CONF_WIDGET): cv.use_id(lv_led_t),
cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(LVLight), cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(LVLight),
} }
).extend(LVGL_SCHEMA) ).extend(LVGL_SCHEMA)
@ -26,7 +26,7 @@ async def to_code(config):
await light.register_light(var, config) await light.register_light(var, config)
paren = await cg.get_variable(config[CONF_LVGL_ID]) paren = await cg.get_variable(config[CONF_LVGL_ID])
widget = await get_widgets(config, CONF_LED) widget = await get_widgets(config, CONF_WIDGET)
widget = widget[0] widget = widget[0]
await wait_for_widgets() await wait_for_widgets()
async with LvContext(paren) as ctx: async with LvContext(paren) as ctx:

View File

@ -93,7 +93,7 @@ light:
- platform: lvgl - platform: lvgl
name: LVGL LED name: LVGL LED
id: lv_light id: lv_light
led: lv_led widget: lv_led
binary_sensor: binary_sensor:
- platform: lvgl - platform: lvgl