Is there a way to automatically set a person to ‘away’ if the person identity has not been updated for a period of time?
I want to be able to set my automations to run when there is at least one person at home but at the moment that number is stuck at one and is never at 0.
For context, I have a secondary user who does not live with me and who has the companion app but no remote access. I want to identify when they are in my ‘home’ zone but I do not want to track their location outside of this. For this reason, I do not want to set up remote access in the app (I’m aware they can limit location tracking to zones but I don’t want to do this either).
I have looked into an automation that runs everyday to check when the last time the sensor was updated which could then run a script to set the person’s state using a python script. Is this the best way?
You could use a Template trigger based on the last_reported property.
Instead of the python script overwriting the existing device tracker, you can use an automation that calls the device_tracker.see service. Calling the service with an unknown dev_id will create a new device_tracker entity that can be added to your person.
No, you would have both device trackers attached to the person. The mobile app’s tracker would supply the value when the person is in the home zone and the custom tracker handles when they have left.
In this case it’s lastest update, but in others it also depends on the tracker type. There is a breakdown in the docs for Person that explains which tracker gets precedence.
What I would do is set up a tracker that is not relying on the companion to send data, but that allows HA to actively check. So if the person has a static ip when connected to your home, you could use a ping sensor. Or you could use a router based device tracker that checks if the person is connected to the network, or a bluetooth based tracker. Then link that as the only device tracker to the person. This way they even do not need to have the companion app.
I do have ESPresence set up in one room but I have found it quite unreliable and difficult to get the settings right so I don’t really want to rely on that.
This person has an iPhone which as I understand it randomises their MAC address, it also seems to have an issue at the moment where it doesn’t automatically connect to my wifi. So I would still need to have some sort of logic as to whether the device has been seen in the past X hours to determine whether it is home or not.
I think for now using the companion app and this workaround is enough for my needs but I do appreciate the other options are there, just not that suitable for my situation.
Setting the ip address fixed in the router and using a ping sensor would be 100% reliable. Random mac addrresses can be turned off per SSID in wifi settings of the phone, so it would be quite safe to do that.