Unifi AP -- noob question

I am a total beginner at this, with no coding experience, though learning as I go.

Want to use the Unifi AP integration to detect when my phone is within my home wi-fi range. I have two Unifi APs. Reading the HASS page here

it has an example of an entry I need to make to the configuration.yaml file:

# Example configuration.yaml entry
device_tracker:
  - platform: unifi_direct
    host: YOUR_AP_IP_ADDRESS
    username: YOUR_USERNAME
    password: YOUR_PASSWORD

However, this only mentions ONE AP host, what if I have 2 or more ? do I enter multiple “deivce tracker” sections, one for each AP ? or can I enter the multiple IPs for the different AP’s in the one line, separated by commas ?

You would just repeat the last 4 lines to set up a second connection, but I guess this device tracking is done by looking up the ARP tables and ARP tables are compiled based on broadcast packets, that should be received by all network devices, so one connection should be enough.

@WallyR

Many Thanks for the note Wally !

I know this has been solved already, but most people with more than a single AP use some type of WLAN controller like a cloud key or a UDMP or even the unifi controller software.

If you are using one of those, there’s an integration you can point directly at that instead of messing with this AP nonsense.

1 Like

Can you explain what you mean?

I run an UDM SE but I had to implement the AP tracking to get it work.
If I’m right you are saying I dont need the AP tracking but I can use an integration straight out of the box?

What is the additional point of using Unifi integration based device tracking on top of pinging a static ip based one? Ping is universal and as long as your device is not going to sleep and disconnecting wifi, it is much more straightforward.

I found this didn’t work with a phone (iPhone). The phone wifi goes into power saving mode and ping packets are not reliably returned.

1 Like

Just know that network tracking is a bit tricky, because there is no warning when a device suddenly disconnects. It is just gone.
ARP tables logs a seen device to its table and if it is not seen for some time, then it is removed/set as stale. This timeout might be configured in your network gear, but 900 seconds (15 minutes) or more is not unseen for ARP table timeouts.
This means that ARP tables are useful for detecting devices connecting to the network, because the data sent will trigger a logging to the ARP tables, but APT tables are not that suited to detecting devices disconnecting from the network, unless you can lower the ARP table timeouts to an acceptable value in your network gear for your use case.

1 Like

@DotNet2Web - that’s correct. The Unifi Network integration will do that for you. When you set up the integration, just check the box for “Track network clients”, then select which SSIDs you want to track wireless clients on (it only tracks wired clients by default).

Due to a change in HA, you’ll also need to enable uptime sensors for network clients, otherwise the device trackers are all created in the default state - which is disabled (unless something has changed - again - which is entirely possible. This information is ~ a year old?).

Additionally, ignore Wally and all his ARP table nonsense. I’m guessing he’s used to working with less-intelligent gear. In the interest of setting him straight though, the default on Cisco IOS gear is 14400 seconds - or 4 hours, nevermind 15 minutes and Cisco does not recommend changing it. :wink:

Unifi gear (and Cisco gear as well, using WLAN controllers like the 98xx series and the 55xx series before that) will immediately notice when a client has dropped, though in the interest of not having your device trackers “flap”, you can configure via the HA integration how long Ubiquiti needs to show them away before the HA device tracker also updates them as away. IIRC, mine are set to 120 seconds maybe? I used to have them set WAY shorter - like 5 seconds, but there was some change made a while back that gave me a headache (my apologies, I don’t recall what - or when - that was).

@anon63427907 - the advantages are MANY. What if the device you want a status on doesn’t respond to ping? What if it’s on a different subnet that you can’t communicate with? Those aside - why generate all that extra nonsense traffic on your network when the information is already available? Why (manually?!) reinvent the wheel? It’s already built into the integration automagically. If you’d rather go and create a few dozen ping sensors by hand in your config file, have at it.

Lastly, though, and perhaps the most important one - is that Unifi will automagically create device trackers for every single entity on your network without you having to go and do anything. This means that I can keep track of the number of devices connected to my guest wifi, and I can fire automations - or more importantly, NOT fire automations - based on if there are guests at my house. See:

If you had to create the device trackers by hand and wanted to do this, it’d be a big pain in the ass “oh, wait - you’ve never connected to my network before. Let me go and find your IP address and create a device tracker. Honey - wait, I need like 10 minutes before we can leave to go to dinner, I have to create a device tracker for the new babysitter’s phone”.

Sort of takes the “automation” our of “home automation”…

@exx ,I understand what are getting with Unifi on top of device trackers, but given sheer amount of device and entities it will create, it is a hard pass for me. I can just create couple of device trackers manually (and it is really no big fuss of work, easy) and will make my home assistant state machine relaxed.

Moreover, are you really worried about network traffic coming out of ping sensor? I would not personally and as you already called out, unifi is doing very much than ping, you should worry about that one.

Lastly, OP is asking just device tracking nothing more, for me, less is better.

Some data around ping impact: assuming you are pinging every 10 seconds and default ping packet size is 84 bytes, throughout the day, this ends up in;
8640 times x 84 bytes = 725.76 kilobytes = 0.7 ish megabytes per day

Understood thanks

If you only have 5 devices on your network, more power to you. Some of us have hundreds or thousands.

Further, I didn’t “call anything out”. You should re-read what I said. Unifi doesn’t use something as nonsense as ping monitors. LOL

I don’t think you fully understand what I wrote. I get the impression there is a bit of a language barrier here as well. I mean - don’t get me wrong, your English is MUCH better than my anything that isn’t English, but still…

If you’re happy with not tracking all your devices, then that’s cool. You do you. But the point is that your suggestion, in this case, doesn’t fit the ask. OP is asking about automated device trackers using a Unifi integration.

@exx and others

…so my intent with the question was to find how to implement tracking of my phone (iPhone) so that my Alarmo integration arms and/or disarms the alarm automatically as I leave or return home, based on my phone being within wi-fi reach and within the radius of my “home” zone ?

From the discussion above, I take it the best way would be to just add the Unifi Network integration ? and use the appropriate entity to control Alarmo ?

note – I only have two Unifi APs, nothing else Unif/Ubiquity, pfSense is my gateway/firewall

Cheers!

You could set up SNMP on the pfsense and pull the ARP table through there.
It is what I do and because SNMP is a general standard, then you can do it on all your gear.
I pull network info from both Ubiquiti and Cisco, as well as info from my printers and computers.

You have two APs but no LAN controller? So how do devices roam between them?

In any event, no, you cannot use the Ubiquiti Network integration without a Unifi controller. You should get one though - you can run the software version as a VM or a container. This would allow you to control the APs, make it easier for roaming, as well as provide you with greater reporting/detail than you get straight out of the APs themselves.

Maybe they roam like old days, which means the devices decide the signal is weak and switch to one of the stronger ones.
A WLAN controller is only really needed with more than 3 APs.
3 APs can be evenly distributed in the frequency band by manually assigning them channels, like 1,6 and 11 (or 1,7 and 13 if all your devices support channel 12 and 13).

The forum really needs a laugh react like social media has.

Thank you for the replies. I do use the Unifi Network cotroller software (not a piece of hardware), but devices conenct to whatever AP they chose, unless I have set them up (via the Unifi network cotroller) to onliy attach to a give AP. This is all in my home, so I do not have hundreds of devices, I have about 30 so far. When you say I should get a 'Unifi Controller" is that hardware or the network software I am already using ?

…I am hardly an expeert on any of this, so sorry if my questions my seem trivial LOL !

So… The APs are not the only thing on your network.

Yes, the software you are using is what I’m talking about.

Point the unifi network integration at that and you’ll be all set.

@WallyR @exx MANY Thanks to both for the replies !

OK, one last question ?..

I run HASS on a HASS-Blue, and I run the Unifi controller on a PC on same network. Will the HASS Unifi Network integration guide me how to find the Unifi Network contrroller app on my PC ? I guess, am not sure how I can “point the HASS Unifi integration” to the Unifi Network controller running on my PC…