I have the following automation that sends a notification to my wife when I leave work:
- alias: "Notify Pieter Going Home from Work in XXX"
- condition: time
- service: script.turn_on
This works well, except that my office location is right next to a highway (the one I normally take home) and there has been cases where I/we drive past the office on that same highway (e.g. on holiday and going to the city for the day), which will cause it to trigger.
What is my best resort? Creating a helper sensor that e.g. turns true if I’m at work for a certain time? But if this helper uses the same zone information, then that sensor will also change state at the same time the automation’s trigger will fire (which would be the same as incorrectly using a zone condition in the automation, because it will then never fire/be true), unless I use a delay in the helper to only change state a few seconds later.
Would it work? If I understand it correctly the for will only check that the zone has changed from work to not home, and then has stayed as not home for a certain amount of time. The time check needs to be moved up to the from. As in, when the state changes from work to not home, check if the person was at work for more than a set amount of time.
You’re right. I didn’t note that it’s for leaving, not entering.
How often is your wife with you during these false triggers? If you have location tracking on her phone, and you’re often together when these false triggers happen, you could add a template condition that checks that you are not together (that is, not closer than say a quarter mile of each other).
Something similar would probably work pretty well, I’m just unsure if this is the best execution. Unless tracking work hours is the goal, is there a point to making it a history stat? Also, tracking the last state change time instead and ensuring it wasnt too recent would be usable for any zone change, rather than just work.