Like other users, I have experienced very bad presence detetion systems, and finally I was getting a really reliable method that is rather different to all device tracker presence components in HA.
Almost every device tracker in HA are based in polling at fixed scan interval, usually from HA point of view, and all of them has very poor reliable with false positives and negatives. You can see the introduction [Presence] Reliable, Multi-User, Distributed BT Occupancy/Presence Detection of andrewjfreyer method about.
I have prospecting for another point of view: The intelligence of presence is in the mobile (supposed all family components has their own mobile), that publish the presence to HA, only when there are changes, and with the minimum battery ussage.
In my opinion, presence (primary at home) is a primary element for all automation system, and if it fails, all over around dont work as expected.
Currently I am working in a really reliable system that uses Android (sorry about IOS) app called http://automagic4android.com/en/
If you dont know about it, its like other "tasker" apps: like a home assistant automation system inside Android. People with ACD (Automate Compulsive Dissorder like me could find this an amazing world for automation…
I would like to share my flows, as they can be imported/exported as xml files.
The use is as follows:
You define your zones as wifi, or cell, or both. With wifi, you can use level (RSSI) to accurate distance. With cell (gsm) define big zones or proximity to a zone state to increase scan frequency.
When wifi scan detect a defined wifi with a level => you enter in a zone
If the actual_zone is different from last_published_zone => publish new zone, and if all ok, update last_published_zone
Publish a zone is http post to api/services/device_tracker/see (we can publish battery, user activity, etc….). When define cells (gsm) for a zone, acts like a “approximation” to a zone, so force the wifi scan to i.e. 10 seconds… so “entering in home” with gsm cells and rssi wifi level can be almost EXACT (I could open the garage door when I arrive because it is working really fine).
When connected to wifi, stop the scan, and when disconnect, start again.
The battery usage is really unperceptible, and reliability is maximum. You can define as many zones as you want. You don’t need to have wifi on.
The only failure is when have the mobile shutdown entering and outgoing from zones.
- Only Android supported.
- Automagic4android is payed app (2$). There are old free version with 4 limit flows.
From here there are an open world of possibilities:
zones defined in HA and downloaded from android app.
An android app that works like the this scripts in Automagic
Bluetooth scan from mobile, i.e. when connect to BT car => user state is “driving”. Even more accurate possition inside home, or in work (on site).
Publish USER ACTIVITY android state (when you are ONFOOT, RUNNING, DRIVING, IN_BED, etc).
Recently I have discover TERMUX and TERMUX API, and probably could be easy to script same functionality (you can run python in termux in android!!!).