1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Add trigger selector for blueprint (#103050)

This commit is contained in:
Paul Bottein
2023-11-03 09:11:49 +01:00
committed by GitHub
parent f5cc4dcf3e
commit 89a9e6c6e8
2 changed files with 46 additions and 1 deletions

View File

@@ -459,7 +459,7 @@ class ColorTempSelector(Selector[ColorTempSelectorConfig]):
class ConditionSelectorConfig(TypedDict):
"""Class to represent an action selector config."""
"""Class to represent an condition selector config."""
@SELECTORS.register("condition")
@@ -1280,6 +1280,27 @@ class TimeSelector(Selector[TimeSelectorConfig]):
return cast(str, data)
class TriggerSelectorConfig(TypedDict):
"""Class to represent an trigger selector config."""
@SELECTORS.register("trigger")
class TriggerSelector(Selector[TriggerSelectorConfig]):
"""Selector of a trigger sequence (script syntax)."""
selector_type = "trigger"
CONFIG_SCHEMA = vol.Schema({})
def __init__(self, config: TriggerSelectorConfig | None = None) -> None:
"""Instantiate a selector."""
super().__init__(config)
def __call__(self, data: Any) -> Any:
"""Validate the passed selection."""
return vol.Schema(cv.TRIGGER_SCHEMA)(data)
class FileSelectorConfig(TypedDict):
"""Class to represent a file selector config."""