1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-26 07:02:21 +01:00

fix: update to_code function in DynamicLamp to handle missing available_outputs gracefully

This commit is contained in:
Oliver Kleinecke
2025-02-15 11:23:43 +01:00
parent 224c68f1f5
commit dd065a12f5

View File

@@ -18,7 +18,7 @@ CONFIG_SCHEMA = cv.Schema({
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)
for outputPointer in config.get(config[CONF_AVAILABLE_OUTPUTS]):
for outputPointer in config.get(CONF_AVAILABLE_OUTPUTS, []):
output_ = await cg.get_variable(outputPointer)
cg.add(var.add_available_output(output_))
cg.add(var.set_save_mode(config[CONF_SAVE_MODE]))