mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Simplify parallel action validation (#191974)
This commit is contained in:
@@ -2083,10 +2083,12 @@ _SCRIPT_SEQUENCE_SCHEMA = probatio.Schema(
|
||||
|
||||
def _parallel_branch(value: Any) -> dict[str, Any]:
|
||||
"""Validate a parallel branch, wrapping shorthand actions in a sequence."""
|
||||
if isinstance(value, dict):
|
||||
with contextlib.suppress(ValueError):
|
||||
if determine_script_action(value) == SCRIPT_ACTION_SEQUENCE:
|
||||
return cast(dict[str, Any], _SCRIPT_SEQUENCE_SCHEMA(value))
|
||||
if (
|
||||
isinstance(value, dict)
|
||||
and CONF_SEQUENCE in value
|
||||
and determine_script_action(value) == SCRIPT_ACTION_SEQUENCE
|
||||
):
|
||||
return cast(dict[str, Any], _SCRIPT_SEQUENCE_SCHEMA(value))
|
||||
return {CONF_SEQUENCE: SCRIPT_SCHEMA(value)}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user