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

Add trigger condition (#51710)

* Add trigger condition

* Tweaks, add tests
This commit is contained in:
Erik Montnemery
2021-06-11 15:05:57 +02:00
committed by GitHub
parent fa3ae9b83c
commit b01b33c304
5 changed files with 149 additions and 7 deletions

View File

@@ -2829,3 +2829,17 @@ async def test_if_action_after_sunset_no_offset_kotzebue(hass, hass_ws_client, c
"sun",
{"result": True, "wanted_time_after": "2015-07-23T11:22:18.467277+00:00"},
)
async def test_trigger(hass):
"""Test trigger condition."""
test = await condition.async_from_config(
hass,
{"alias": "Trigger Cond", "condition": "trigger", "id": "123456"},
)
assert not test(hass)
assert not test(hass, {})
assert not test(hass, {"other_var": "123456"})
assert not test(hass, {"trigger": {"trigger_id": "123456"}})
assert test(hass, {"trigger": {"id": "123456"}})