I implemented an automation that will lock my door when the house is empty for more than 5 minutes, and unlock it as soon as someone is “home”.
The automation itself is correctly triggered (back and forth) but the presence is a bit wonky.
My family had the Android Companion App installed, and I manually assigned a phone to a Person. This means that there are several criteria for presence:
being attached to the Wi-Fi
being in the “Home” Area
Due to the GPS fluctuations, it looks like, sometimes, people are seen as away despite bing at home. They however still are connected to the Wi-Fi.
Question 1: is the by default calculation of the presence generally OK? (→ I would need to decide to either enlarge the “Home” Area, or rely on the Wi-Fi exclusively)
Question 2: has anyone developed their own presence algorithm, taking into account specificities of the place they live in? If so what did you based it on? (state changes of devices, calculation of the topological distance based on the GPS coordinates, …)
Question 3: how does the presence works when someone has the Companion App and the phone is assigned to that person additionally (via Settings)
Question 4: how to debug this? Is there an existing solution that would show why the presence of somebody changes (Wi-Fi lost, a state is unavailable (as opposed to changed between clean states), …)
Just purely for security reasons I would not want my door locking to rely on presence alone. I would be happy for presence to be a backup if you forget to lock the door. But anything can fail, like forgetting to take your phone with you when you leave. It may be just me thinking this, and you can choose to ignore it if you wish.
I get what you are saying. In my case when the door is slammed shut you cannot open it from the outside. This is how I leave it because I live in a super safe place and breaking in would be very noisy.
The “locking” are actually extra bolts going into the wall - if someone was trying to force the door open by pushing on it. I suppose that the wall would give earlier so this si more a psychological thing. And my automation is about that second part of “locking”.
The fact that when you slam the door closed and cannot open it from the outside is the main reason for me having a smart lock – as a backup (I have children…).
And also a way to not give to children keys because they will lose it.
And before concerns about having children locked when i cannot access them from the outside - they are 19 and 22 yo…
You might have a look at the Bermuda integration, which provides a simple home/away sensor as well as room-level presence detection.
Alteratively you might look at the Bayesian integration which will allow you to take into account other sensors - is the TV on, is there movement in the house, time of day (11am and you’re probably at work) and so on.
I use a combination of both to work out which room I’m in - works really well.
Edit: For the benefit of Home Assistant, you understand. I do know which room I’m in…
I have a slightly more complex presence calculation based on three factors:
The companion app
The phone’s Wi-Fi presence
Detection of the bluetooth tag on the keys
These three elements are taken into account to determine whether a person is theoretically present or not.
In addition, for each person, there is an “actual” presence template. This template takes into account the theoretical presence, as well as whether two Boolean values are set:
Forced presence
Forced absence
A Boolean variable groups together all “actual presence” Booleans. It determines whether the “at home” status is active or not (alarm, specific automation, etc.).
99.99% of the time, the theoretical presence works just fine. But if someone has left their phone at home and/or their keys (the kids don’t have phones) or at the office, I set the appropriate Boolean sensor.
Visually, this is how it appears on my dashboard :