Hi all, I hope this is the right forum for this. I’m trying to find a way to determine when a user is out of town. I’d like to send certain messages to certain housemates depending on their locations. Everyone in the house travels for work, I’m as little as 10%, another as much as 90%. I’ve always felt like the ones who are out of town at a given time don’t need to know about certain events at home when there’s still one who is local so I’d like to use an “out of town” condition in my automation to send notifications.
I was thinking of using zones. Perhaps a passive zone. A very rudimentary way of accomplishing this, I think, would be to just trigger an input boolean when a user enters/leaves the overall passive zone (we’re in Atlanta and if we’re more than two hours outside of the city, it means we’re on a work trip). If the boolean is true when the notification is triggered, it doesn’t send to that user. That should work, if that’s how the passive zones work. However, I think it would be great if I could change the status of the person that shows up on my badges. The only way I could think that would work is with overlapping zones but I don’t see anywhere where anyone has gotten that to work. And even then I would have “Home”, our various "Office"s, an “Away” zone that is our metropolitan area, and the rest of the planet would be “Out Of Town”. Ideally that would be best I think.
Any ideas how I could accomplish this more gracefully than what I’ve come up with? Thanks in advance!
Create the proximity sensor for each device and you’ll have a sensor that updates the distance and direction relative to each zone. Set up automations that trigger when > X km from a zone, moving away or towards a zone, etc.
I see. So would you suggest just creating an input boolean that’s triggered when > x km from home and use that boolean as a condition in my notification automation? What about possibly changing text of the person state from “away” to “out of town”?
No need. You’ll get a sensor for each zone/device pair you add in the config with the state being set to the distance between said pair.
proximity:
person1_home:
# Which zone to keep track of distance from. If none
# specified, defaults to 'home'.
zone: home
# Don't calculate distance from home while in these zones.
ignored_zones:
- work
devices:
- person.person1
tolerance: 50
unit_of_measurement: mi
person2_home:
# Don't calculate distance from home while in these zones.
ignored_zones:
- work2
devices:
- device_tracker.person2
tolerance: 50
unit_of_measurement: mi
name_of_sensor_3:
....
Now just use these sensors like normal triggers
automation:
trigger:
platform: numeric_state
entity_id: proximity.person1_home, proximity.person2_home, proximity.name_of_sensor_3
# Triggers when they go > 120 miles from home.
# Wont trigger again until they are closer than 120 miles, then
# leave again.
above: 120
# For deboucning gps fluctuations when near the border, require it to be true
# for a few minutes.
for: "00:05:00"
action:
service: notify.notify
data_template:
# If friendly_name is defined for the object, use that. Else, defaults to entity_id.
title: "{{trigger.to_state.name}} Travel Notification"
message: "See ya space cowboy"
So each “gps device tracker” will get a proximity sensor and I can just define in my notification automation that if a tracker is say “> 100 mi” don’t send a message to that tracker? What is the most elegant way of doing that? I really don’t want to have to make 3 automations for each notification I want to make.
Thanks again for your help! I’m going to get started on setting up the proximity integration now!