Hi, I’ve created an automation that sends a notification to all Family members mobile devices when they Enter / Exit a zone.
The problem is during my commute I pass though 2 different zones ( Moms House & The store ) triggering an Enter / Exit notification for each zone.
I believe a fix would be for the automation to only complete the action if the device is inside of the zone for a set amount of time (eg. 1 minute) as that would allow me to pass though without triggering the action.
How could I do this? Or is there another way to achieve the same result, I’d appreciate any help.
alias: Zone Notification
trigger:
- entity_id: device_tracker.regan
event: enter
platform: zone
zone: zone.home
- entity_id: device_tracker.regan
event: leave
platform: zone
zone: zone.home
- entity_id: device_tracker.regan
event: enter
platform: zone
zone: zone.work
- entity_id: device_tracker.regan
event: leave
platform: zone
zone: zone.work
- entity_id: device_tracker.regan
event: enter
platform: zone
zone: zone.fred_meyer
- entity_id: device_tracker.regan
event: leave
platform: zone
zone: zone.fred_meyer
- entity_id: device_tracker.regan
event: enter
platform: zone
zone: zone.mom_s_house
- entity_id: device_tracker.regan
event: leave
platform: zone
zone: zone.mom_s_house
action:
- data:
message: |
{% if trigger.event == "leave" %}
{{ trigger.from_state.attributes.friendly_name }} left {{ trigger.zone.attributes.friendly_name }}
{% else %}
{{ trigger.from_state.attributes.friendly_name }} arrived at {{ trigger.zone.attributes.friendly_name }}
{% endif %}
service: notify.all_users
mode: queued
max: 10