Reliable presence detection with UniFi and the Companion app
Who is home? Combine Wi-Fi detection through UniFi with GPS from the Companion app for presence that is both fast and reliable.
- Published
- Reading time
- 3 min read
- Level
- Intermediate
- Tested on HA
- 2026.10
Almost every automation in your house starts with the same question: is anyone home? Getting that answer right is harder than it looks, because no single source manages it alone. GPS is slow and knows nothing indoors, while Wi-Fi detection loses you the moment your phone falls asleep. Put them side by side and they cover each other's weak spot exactly.
Source 1: UniFi Network
The UniFi Network integration creates a device_tracker for every Wi-Fi device. Here is how to wire it up:
- Create a local user for Home Assistant in the UniFi console. Read-only is enough for presence; if you also want to block clients or switch PoE ports, that user needs admin rights.
- Connect through the gateway IP in the VLAN where Home Assistant runs, because that avoids routing problems.
- In the integration options, enable only the devices you actually want to track. Skip that and you will have hundreds of trackers within a minute.
Phones that invent a random MAC address per network do hold on to that address per SSID. So it works fine. It only breaks when you forget the home network on your phone and reconnect, because then it invents a new address and your tracker has become a stranger.
Source 2: the Companion app
The Companion app supplies a GPS tracker and knows when you enter or leave your home zone. Set Location: Always in the app. On "while in use" you only get updates when the app is open, which is precisely not the moment you need them.
Combining them in a person
A person bundles several trackers into one answer. You can manage people in the UI, or in YAML if you want them in version control:
person:
- name: Bewoner
id: bewoner
device_trackers:
- device_tracker.telefoon_bewoner_unifi
- device_tracker.telefoon_bewoner_app
Home Assistant gives priority to stationary trackers, such as your router, the moment they report "home". If Wi-Fi says you are home, you are home, even if GPS still has you somewhere on the motorway. When you are out, GPS decides where exactly.
Set consider_home for your router trackers as low as you dare. Your person then reports as departed sooner, which lets GPS take over earlier.
Pitfalls
- After a restart, UniFi does not know all its clients for the first few minutes, so everyone briefly looks away. Hold back automations that react to "everyone out" until that settles. A short delay after startup keeps your house from locking itself while you are sitting on the sofa.
- Visitors do not count. A babysitter or guest has no tracker, so let in-house presence sensors weigh in before you arm an alarm automatically.
- Clean up old trackers. If you move to a different method, remove the integration and the leftover trackers from your people. One forgotten tracker that never reports "home" again will keep your person away indefinitely.
Frequently asked questions
Do I need a UniFi network? No. Any router with a Home Assistant integration works the same way, such as a FRITZ!Box or an Nmap scan. UniFi is simply among the most reliable options.
Why does Home Assistant say I am away when I am home? Usually because your phone's Wi-Fi has dozed off. As long as the Companion app sees you in the home zone you stay home, so check that location is set to "Always" first.
What do I do about guests? Guests have no tracker. Let presence sensors weigh in before you switch off the heating or arm an alarm. How that works is covered in the article on the Aqara FP300 and in heating after arriving home.