Tracking devices on Guest network

Using a Ubiquiti setup, I’ve set up two SSIDs - Primary (192.168.7.x) and Guest (10.0.0.x) - and with the Ubiquiti integration for HA, I have device tracking and the ability to trigger automations using known devices connected to my Primary network.
For example, if the last persons phone leaves, the lights go off, etc.

I’m now trying to set up automations for Guests, such as if my parents pop round while we’re out; they know the Guest WiFi code, but I don’t know their mac address or device names. I do know they’ll pick up from a DHCP pool and the range of ips (which is different to the Primary pool).
I’m just not sure how to set a trigger: “IF devices connected to Primary AND Guest drops from one to zero, switch off lights.”?

1 Like

I can’t think of an easy way to do this without setting up tracking for each individual guest.

Since you did give them the Wi-Fi guest password you should be able to see their default device name in the Unifi Controller Client Devices when they are connected to your guest network. You can also assign a different/meaningful device name in Unifi for the device when connected to the network. Then there should be a way for the Unifi integration to pickup the new device and create a unique entity in HA. And then you should be able to do what you want (like put those entities into a guest group, template, etc.

I’ve been meaning to do something similar so you’ve inspired me to take a closer look at this.

“you should be able to see their default device name in the Unifi Controller Client Devices when they are connected to your guest network”

All true, and that’s the difference I’m trying to achieve between setting up static devices on my Primary network and the unknown devices on my Guest network. Yes, I could retroactively add their devices from the log - practically, they’re not going to change every time they visit - and each time they have a different phone or other device, ect, add them to known devices, it was whether Home Assistant could use ip address connection - regardless of device - as triggers.

Make an IP reservation in your DHCP server and ping the IP (assuming you get their MAC’s)
Not sure if that works on the latest OS versions; they use random mac addresses nowaday :confused:

I tried that with NMAP, which works for the network Home Assistant is on, but not for the other network.
Also tried connecting the Pi to the Guest WiFi, but it wouldn’t ping that network.

Darn. I would think the Nmap Tracker Integration would work if on the same subnet.

I use a pfSense router and the pfSense Integration looks like it has potential. The documentation says it can do device tracking based on the pfSense arp table.

This thread might be of use, but note the last comment as well – you’ll want to make sure you’re tracking those devices.

Author of the pfSense integration here. Indeed it does do device tracking using the arp table, however you explicitly setup the devices you wish to monitor and doesn’t make much sense to the original use-case on this thread. I do report DHCP leases counts. I don’t recall if I do that per-pool however. If not it’s likely something that would be quite feasible.

Thanks very much Travis.

So, “per-pool” would be getting counts per interface (interface name and # of leases in use)?

Wouldn’t we also need to know the status of each lease in the pool (online, offline) since the DHCP lease default is 86400 seconds (1day) and can have a status of offline?

I do have separate numbers for total and online, still don’t recall if it’s per interface as well.

Hello!

PR is up to add sensor reporting amount of clients connected to a specific WLAN. Add WLAN clients reporting to UniFi Sensor platform by Kane610 · Pull Request #97234 · home-assistant/core · GitHub

1 Like