Fix using execute on the notify_leaving_zone (#43858)

This commit is contained in:
Paulus Schoutsen 2020-12-02 16:21:00 +01:00 committed by GitHub
parent 55edc9f858
commit ff4897a09e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View file

@ -27,6 +27,8 @@ trigger:
variables:
zone_entity: !input zone_entity
zone_state: "{{ states[zone_entity].name }}"
person_entity: !input person_entity
person_name: "{{ states[person_entity].name }}"
condition:
condition: template
@ -36,4 +38,4 @@ action:
domain: mobile_app
type: notify
device_id: !input notify_device
message: "{{ trigger.to_state.name }} has left {{ zone_state }}"
message: "{{ person_name }} has left {{ zone_state }}"

View file

@ -115,6 +115,15 @@ async def test_notify_leaving_zone(hass):
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):
"""Test motion light blueprint."""
@ -192,3 +201,13 @@ async def test_motion_light(hass):
assert len(turn_on_calls) == 3
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