mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 04:20:17 +00:00
Add id to automation triggers (#48464)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user