use pattern from sensor filters

This commit is contained in:
J. Nick Koston
2026-02-02 02:40:30 +01:00
parent cfc3b3336f
commit 48e6efb6aa

View File

@@ -66,9 +66,11 @@ CONFIG_SCHEMA = cv.All(
async def to_code(config):
# Use subclass with trigger only when set_action is configured
select_id = config[CONF_ID]
if CONF_SET_ACTION in config:
config[CONF_ID].type = TemplateSelectWithSetAction
var = cg.new_Pvariable(config[CONF_ID])
select_id = select_id.copy()
select_id.type = TemplateSelectWithSetAction
var = cg.new_Pvariable(select_id)
await cg.register_component(var, config)
await select.register_select(var, config, options=config[CONF_OPTIONS])