I am having an issue getting a script to run when both my wife and I leave the house. The “goodbye” script works when I call it manually or from alexa on the way out the door, but it is not being triggered by the zone change. My automations for zone changes coming home work fine. Is there something wrong in my automation or should I be looking elsewhere? I just updated to the latest version this morning, then started trying to figure this out and I am not getting any errors. My wife isn’t home right now and I am setting my state manually and nothing is triggering, nor does my history show that this script was triggered at anytime that I didn’t do it manually.
#Lock doors and turn out lights when we leave
- alias: 'Goodbye When Not Home'
initial_state: true
trigger:
- platform: zone
entity_id: device_tracker.bret
zone: zone.home
event: leave
- platform: zone
entity_id: device_tracker.jess
zone: zone.home
event: leave
condition:
condition: and
conditions:
- condition: state
entity_id: device_tracker.bret
state: 'not_home'
- condition: state
entity_id: device_tracker.jess
state: 'not_home'
action:
service: script.turn_on
entity_id: script.goodbye
You could also use the “group.presence” detection method. If any person (or device) in the group is at home, the state will be “home”. If nobody is home, the state of the group changes to “not_home”
I think the problem I had was that I have my home radius then I have a larger radius around that for unlocking the doors when I get home and an even larger one for turning the lights on. My all devices group for some reason was unknown so I created a group and changed my automation to just trigger when that group changes to not_home. Seems to work perfect now.
I use automations and zone triggers that are way out of the reach of my wifi. I do see extra battery draw on my phone, but most days its not an issue for me. I have my gps logger update about every 20 seconds. A buddy of mine used proximity and has his update ever 2 minutes. I haven’t had the time to play with method yet.