First off, apologies if a) I’ve posted in the wrong spot and b) this has been answered (I did search and couldn’t find anything).
What I’m trying to do is create an automation where if my wife is returning home and I’m already home, I will be notified and vice versa. If she is returning home and I’m not home, then I won’t be notified.
I have this working ok but we both went out today and arrived home at the exact time together. We both got notified that each other was arriving home. This is what I’m trying to avoid.
Yaml is as follows:
alias: Adam arriving home
description: ''
trigger:
- platform: zone
entity_id: device_tracker.pixel_6
zone: zone.home
event: enter
condition:
- condition: zone
entity_id: device_tracker.hotspot
zone: zone.home
action:
- device_id: e5abcedb4ace29ed1bd332ff94b4ea30
domain: mobile_app
type: notify
message: Adam arriving home
title: Notification
mode: single
As a first thought you could use a “for” parameter in your condition like so:
alias: Adam arriving home
description: ''
trigger:
- platform: zone
entity_id: device_tracker.pixel_6
zone: zone.home
event: enter
condition:
- condition: zone
entity_id: device_tracker.hotspot
zone: zone.home
for:
hours: 0
minutes: 10
seconds: 0
action:
- device_id: e5abcedb4ace29ed1bd332ff94b4ea30
domain: mobile_app
type: notify
message: Adam arriving home
title: Notification
mode: single
This way, person 1 should already be home for 10 minutes, for example, before person 2 arrives, in order to eliminate issues when arriving home at the same time.
Looks like I jumped the gun on this.
It apparently is not working.
I have been home all day and my wife just arrived home and the notification did not trigger. When I look at the debug info I see the following:
“Stopped because a condition failed at February 21, 2022, 4:06:55 PM”
Executed: February 21, 2022, 4:06:55 PM
Result:
result: false
entity_id/0
Executed: February 21, 2022, 4:06:55 PM
Result:
result: false
state: home
duration: '2022-02-21T04:56:55.099700+00:00'
step config is:
condition: state
entity_id: device_tracker.pixel_6
state: home
for:
hours: 0
minutes: 10
seconds: 0