Hi there. I like the new Person component, but it is a bit “unreliable” as a person tracker still for me to replace my own template sensor used for the purpose.
Maybe this can be to inspiration to further develop or maybe for others as inspiration
My ideas started from this guide:
Making Home Assistant’s Presence Detection not so Binary
But I found a template sensor to be more reliable than a automation to switch states
My current sensor has these states: Just Arrived / Home / Just Left / Away / Extended Away / Sleeping
From all (both persons) statuses I have a separate similar sensor for the whole house with the states:
Just Arrived / Home / Just Left / Away / Extended Away / Silent / Sleeping
Each person has these sensors:
binary_sensor.person_occupancy
A template sensor created off device_trackers (bluetooth, wifi and GPS)
BT/Wifi has priority and decides occupancy is ON unless GPS leaves a zone around the house.
The zone alone is not enough to decide “Home” on its own as the zone is set fairly large (250m)
input_binary.person_awake
Contolled by bedside switch, google home routine + automation to set person to “sleeping” if person is home and a “awake detection” template sensor for the whole house is not active and it is “nighttime”
binary_sensor.awake_detection
Awake detection is a template sensor created off motion sensors outside the bedroom, devices that will indicate someone is awake like the coffee-brewer, bathroom humidity delta (humidity in bathroom vs whole house) is rising (someone is showering), chromecast starts streaming, TV turns on etc.
If there is only one person home, the “awake detecton” will switch that persons input_binary-person_awake to ON, which will then cause the persons “status”-sensor to switch from “Sleeping” to “Home”
Some extra info/useful automations:
- Person can only be “Sleeping” if Home/Just Arrived
- If neither BT or WiFi is tracking the person for 5 minutes the person is first set to “Just Left” and changes to “Away” after 15 minutes. This defaults a person to “Just Left” if HA is restarted until BT/WiFi detects the phone.
- If all occupants are Away it will turn off TV, stop media players, turn off coffee machine if it is on (power >5W for the plug)
- If Away for more than 24 hours -> Extended Away
- If all occupants is Extended Away the house will also be “Extended Away” which will lower temperature setpoints in the house/disable cooling in the summer.
Something I want to add possibly:
- If the entry door has not changed status, no person should be set away
This also brings up the template sensor I have for the door combining the lock and the door magnet:
States: Locked / Unlocked / Open / Jammed
Uses status from the Danalock to tell if it is Locked / Unlocked and a door magnet to indicate Open / Closed
- Door is closed and locked = LOCKED
- Door is closed and unlocked = UNLOCKED
- Door is open and unlocked = OPEN
- Door is open and locked = JAMMED
If the house status is Home/Just Arrived it will unlock the door if the door is locked in a “open” state.
The door will not change status if all occupants are sleeping or nobody is home.