Add id to automation triggers (#48464)
This commit is contained in:
parent
450f3740cd
commit
b26779a27a
40 changed files with 168 additions and 56 deletions
|
@ -16,7 +16,10 @@ async def test_if_fires_on_hass_start(hass):
|
|||
automation.DOMAIN: {
|
||||
"alias": "hello",
|
||||
"trigger": {"platform": "homeassistant", "event": "start"},
|
||||
"action": {"service": "test.automation"},
|
||||
"action": {
|
||||
"service": "test.automation",
|
||||
"data_template": {"id": "{{ trigger.id}}"},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +42,7 @@ async def test_if_fires_on_hass_start(hass):
|
|||
|
||||
assert automation.is_on(hass, "automation.hello")
|
||||
assert len(calls) == 1
|
||||
assert calls[0].data["id"] == 0
|
||||
|
||||
|
||||
async def test_if_fires_on_hass_shutdown(hass):
|
||||
|
@ -53,7 +57,10 @@ async def test_if_fires_on_hass_shutdown(hass):
|
|||
automation.DOMAIN: {
|
||||
"alias": "hello",
|
||||
"trigger": {"platform": "homeassistant", "event": "shutdown"},
|
||||
"action": {"service": "test.automation"},
|
||||
"action": {
|
||||
"service": "test.automation",
|
||||
"data_template": {"id": "{{ trigger.id}}"},
|
||||
},
|
||||
}
|
||||
},
|
||||
)
|
||||
|
@ -68,3 +75,4 @@ async def test_if_fires_on_hass_shutdown(hass):
|
|||
with patch.object(hass.loop, "stop"):
|
||||
await hass.async_stop()
|
||||
assert len(calls) == 1
|
||||
assert calls[0].data["id"] == 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue