mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 10:18:11 +02:00
Teach validate_config to validate lists of conditions (#95380)
* Teach validate_config to validate lists of conditions * Update test
This commit is contained in:
@ -725,14 +725,14 @@ async def handle_validate_config(
|
||||
|
||||
for key, schema, validator in (
|
||||
("trigger", cv.TRIGGER_SCHEMA, trigger.async_validate_trigger_config),
|
||||
("condition", cv.CONDITION_SCHEMA, condition.async_validate_condition_config),
|
||||
("condition", cv.CONDITIONS_SCHEMA, condition.async_validate_conditions_config),
|
||||
("action", cv.SCRIPT_SCHEMA, script.async_validate_actions_config),
|
||||
):
|
||||
if key not in msg:
|
||||
continue
|
||||
|
||||
try:
|
||||
await validator(hass, schema(msg[key])) # type: ignore[operator]
|
||||
await validator(hass, schema(msg[key]))
|
||||
except vol.Invalid as err:
|
||||
result[key] = {"valid": False, "error": str(err)}
|
||||
else:
|
||||
|
Reference in New Issue
Block a user