1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Correct validation of conditions in scripts and automations (#60890)

* Correct validation of conditions in scripts and automations

* Fix test
This commit is contained in:
Erik Montnemery
2021-12-03 18:08:28 +01:00
committed by GitHub
parent f57d42a9e8
commit 17dc609363
3 changed files with 237 additions and 6 deletions

View File

@@ -270,6 +270,16 @@ async def async_validate_action_config(
)
elif action_type == cv.SCRIPT_ACTION_REPEAT:
if CONF_UNTIL in config[CONF_REPEAT]:
conditions = await condition.async_validate_conditions_config(
hass, config[CONF_REPEAT][CONF_UNTIL]
)
config[CONF_REPEAT][CONF_UNTIL] = conditions
if CONF_WHILE in config[CONF_REPEAT]:
conditions = await condition.async_validate_conditions_config(
hass, config[CONF_REPEAT][CONF_WHILE]
)
config[CONF_REPEAT][CONF_WHILE] = conditions
config[CONF_REPEAT][CONF_SEQUENCE] = await async_validate_actions_config(
hass, config[CONF_REPEAT][CONF_SEQUENCE]
)
@@ -281,6 +291,10 @@ async def async_validate_action_config(
)
for choose_conf in config[CONF_CHOOSE]:
conditions = await condition.async_validate_conditions_config(
hass, choose_conf[CONF_CONDITIONS]
)
choose_conf[CONF_CONDITIONS] = conditions
choose_conf[CONF_SEQUENCE] = await async_validate_actions_config(
hass, choose_conf[CONF_SEQUENCE]
)