There are a few integrations around for combining multiple device trackers and presence sensors to come up with a single authoritative person location, for example the Person integration. I have tried a few, but I have not been entirely satisfied with the results when they try to pick the “right” source. Likewise, there are several different device trackers that do some kind of reverse geocoding, like the mobile app, iCloud, and iCloud3. It makes sense to me to standardize all that geocoding stuff after the combined location is determined.
What I have tried to do is perfect an integration that handles presence detection the way that seems best for me. My original experiments were done in a python script that was called whenever the source device trackers were updated. I took some Covid home-time and built this integration to encapsulate what I learned, hopefully in way that could be useful for others to use. It works for me, but your mileage could vary.
Home Assistant Person Location Custom Integration
Combine the status of multiple device trackers
This custom integration will look at all device trackers for a particular person and combine them into a single person location sensor, sensor.<name>_location. Device tracker state change events are monitored rather than being polled, making a composite, averaging the states, or calculating a probability.
Make presence detection not so binary
When a person is detected as moving between Home and Away, instead of going straight to Home or Away, this will temporarily set the person’s location state to Just Arrived or Just Left so that automations can be triggered appropriately.
Reverse geocode the location and make distance calculations
When the person location sensor changes it can be reverse geocoded using Open Street Map, Google Maps, or MapQuest and the distance from home (miles and minutes) calculated with WazeRouteCalculator.
great idea!
I’m getting the below error log. What could go wrong?
Error during setup of component person_location
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 248, in _async_setup_component
result = await task
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/person_location/__init__.py", line 41, in setup
pli = PERSON_LOCATION_INTEGRATION(API_STATE_OBJECT, hass, config)
File "/config/custom_components/person_location/const.py", line 270, in __init__
for x in self.config[DOMAIN].get(CONF_CREATE_SENSORS, []).split(",")
AttributeError: 'list' object has no attribute 'split'
@rodpayne Currently I have geocoded but I tried it with several different variations, other sensor types and multiple sensors, separated by comma.
Also tried to create it via the GUI and via configuration.yaml, with same result.
am also getting this error. it would appear the Waze Travel time integration has been deprecated in favour of a UI version (as per breaking changes in the latest release). I’m assuming this has something to do with it
This shift to the UI config has happened quite some time ago already. But something may certainly have changed with the Waze Travel Time integration.
As a temoprary workaround, I disabled the ‘REGIONS’ import process in the const.py file of the Person Location component (lines 260-267):
# if self.configuration[CONF_WAZE_REGION] in WAZE_REGIONS:
self.configuration[CONF_USE_WAZE] = True
# else:
# self.configuration[CONF_USE_WAZE] = False
# _LOGGER.warning(
# "Configured Waze region (%s) is not valid",
# self.configuration[CONF_WAZE_REGION],
# )
Hello @rodpayne
I am looking for a full configuration.yaml example because i cannot figure out why some things are not working ?
When i add the integration and add some infos sensor.personname_location is generated, but i am never able to get the maps nor from google or osm or mapbox ?
Is there a way to customize the nice name to show the current address or just use the keys for that in a template sensor ?
Maybe you can post a full config or add it to the git ?