mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Fix using execute on the notify_leaving_zone (#43858)
This commit is contained in:
parent
55edc9f858
commit
ff4897a09e
@ -27,6 +27,8 @@ trigger:
|
|||||||
variables:
|
variables:
|
||||||
zone_entity: !input zone_entity
|
zone_entity: !input zone_entity
|
||||||
zone_state: "{{ states[zone_entity].name }}"
|
zone_state: "{{ states[zone_entity].name }}"
|
||||||
|
person_entity: !input person_entity
|
||||||
|
person_name: "{{ states[person_entity].name }}"
|
||||||
|
|
||||||
condition:
|
condition:
|
||||||
condition: template
|
condition: template
|
||||||
@ -36,4 +38,4 @@ action:
|
|||||||
domain: mobile_app
|
domain: mobile_app
|
||||||
type: notify
|
type: notify
|
||||||
device_id: !input notify_device
|
device_id: !input notify_device
|
||||||
message: "{{ trigger.to_state.name }} has left {{ zone_state }}"
|
message: "{{ person_name }} has left {{ zone_state }}"
|
||||||
|
@ -115,6 +115,15 @@ async def test_notify_leaving_zone(hass):
|
|||||||
|
|
||||||
assert len(mock_call_action.mock_calls) == 2
|
assert len(mock_call_action.mock_calls) == 2
|
||||||
|
|
||||||
|
# Verify trigger works
|
||||||
|
await hass.services.async_call(
|
||||||
|
"automation",
|
||||||
|
"trigger",
|
||||||
|
{"entity_id": "automation.automation_0"},
|
||||||
|
blocking=True,
|
||||||
|
)
|
||||||
|
assert len(mock_call_action.mock_calls) == 3
|
||||||
|
|
||||||
|
|
||||||
async def test_motion_light(hass):
|
async def test_motion_light(hass):
|
||||||
"""Test motion light blueprint."""
|
"""Test motion light blueprint."""
|
||||||
@ -192,3 +201,13 @@ async def test_motion_light(hass):
|
|||||||
|
|
||||||
assert len(turn_on_calls) == 3
|
assert len(turn_on_calls) == 3
|
||||||
assert len(turn_off_calls) == 1
|
assert len(turn_off_calls) == 1
|
||||||
|
|
||||||
|
# Verify trigger works
|
||||||
|
await hass.services.async_call(
|
||||||
|
"automation",
|
||||||
|
"trigger",
|
||||||
|
{"entity_id": "automation.automation_0"},
|
||||||
|
)
|
||||||
|
for _ in range(25):
|
||||||
|
await asyncio.sleep(0)
|
||||||
|
assert len(turn_on_calls) == 4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user