Proximity of user1 to user 2

Has anyone figured a way to determine if two users, both away from home or any defined zones, are in near proximity to each other. For example, a husband and wife both work in sales in a small city and call on a large number of customers they both service. Husband and wife work for different companies and have seperate routines but want to meet for lunch IF they are both in close proximity (range to be determined by a set value). Yes, I know we could do a Find my Friends kinda thing but that’s not the solution Im looking for. Push notifications to both users is more discrete and way cooler.
I can do proximity to home and zone sensors very well, but I am looking to see when two mobile users are close to each other (not home and may or may not be within a zone). Is it possible to create another proximity sensor for user1 to user2, for example? Reading and calculating GPS Lat/Lon values for each user seems to be a cumbersome method but I don’t see an immediate solution in the Person or Proximity sensor docs.
Anyone have a truly clever solution?

1 Like

Personally I’d go with calculating the distance between the two sets of coordinates.
Computers are good at math :+1:

here travel time will do that for you.

The entity_id’s can be a person…


I have this in a Markdown card:

home = latitude: 50.1234567 longitude: 20.1234567
home <-> person_b = {{ distance( 50.1234567, 20.1234567, 'device_tracker.person_b') }} km
home <-> person_a = {{ distance( 50.1234567, 20.1234567, 'device_tracker.person_a') }} km
person_a <-> person_b = {{ distance('device_tracker.person_a', 'device_tracker.person_b') }} km

time to arrival by car at 130 km/h: {{ ((distance( 50.1234567, 20.1234567,  'device_tracker.person_b'))/130*60) | round(0)  }} minutes
time to arrival by car at 100 km/h: {{ ((distance( 50.1234567, 20.1234567,  'device_tracker.person_b'))/100*60) | round(0)  }} minutes
time to arrival by car at  50 km/h: {{ ((distance( 50.1234567, 20.1234567,  'device_tracker.person_b'))/50*60) | round(0)  }} minutes
time to arrival by bike at 15 km/h: {{ ((distance( 50.1234567, 20.1234567,  'device_tracker.person_b'))/15*60) | round(0)  }} minutes
time to arrive with walking at 5 km/h: {{ ((distance( 50.1234567, 20.1234567,  'device_tracker.person_b'))/5*60) | round(0)  }} minutes

So i always manage to do all the household chores i have given me. :slight_smile:


I’d really like to ditch waze for my travel time home, but their traffic predictions are much appreciated, and I use that to let my wife know when I’ll be home. I may have to take a similar approach to get some sort of approximation. Thank you for the inspiration!

As @pwgdrx shows in his markdown card example you can use the distance function in a template…

{{ distance('device_tracker.1', 'device_tracker.2') }}


{{ distance('person.1', 'person.2') }}

Just FYI: This is the Euclidean distance so it’s not going to be super-accurate, but for the purposes of human-scale “nearness” it should be fine.


@ Didgeridrew
This is exactly what I was searching for. I knew I remembered reading it a while ago but could not find it again. Thank you for an easy and workable solution.