Hi guys,
I want to receive a notification when a device_tracker was for X minutes in any zone (but home and opvang) and leaves it.
Notification should contain something like this:
Hi Leon, person Y is leaving zone Z and is probably coming home.
(person Y was thus at least for X minutes in zone Z).
I’ve got this now, but testing is hard and is this the right way?
alias: Location | Person Y verlaat zone Z
description: ''
trigger:
- platform: state
entity_id:
- device_tracker.other_phone
to: not_home
condition:
- condition: not
conditions:
- condition: zone
entity_id: person.Y
zone: zone.home
- condition: zone
entity_id: person.Y
zone: zone.opvang
- condition: not
conditions:
- condition: state
entity_id: device_tracker.other_phone
state: home
for:
hours: 0
minutes: 5
seconds: 0
- condition: state
entity_id: device_tracker.other_phone
state: not_home
for:
hours: 0
minutes: 5
seconds: 0
action:
- service: notify.mobile_app_phone
data:
message: X vertrekt van {{ trigger.from_state.state }}
title: X onderweg
data:
group: home-assistant-notification
priority: high
ttl: 0
mode: single