[RELEASE] Unifi Wifi Presence

Hey Mike,

Are you able to change the presence for the Unifi parent device, so that it records as present, not "not present". I'm now testing for presence as a check that these devices (Tasmota, Xiaomi devices) are on and connected. The Unifi parent is showing as "not present".

Driver is working great, by the way. Thanks!

Came here to say thank you @mike10, your drivers are working very well for my use case, which is presence sensor and block the kids devices with a single automation. I a had VM already running Unifi Controller on Ubuntu 18.4.4 and your drivers are working very very well so far. My Unifi runs on 5.13.29, Kernel 4.15.0-108. Now wife freaks out every time Alexa starts announcing that there is a friend "John is at the front door" for example. I am running the presence at every 30 seconds, about 12 MAC are being queried at the same time, had not seen any impact on the hub, nor the controller.

1 Like

Anyone get this working on a UDM Pro yet?

1 Like

Any answer? I dont have one, but am thinking of getting one.

Not yet. I can install the rubber but I receive no logs and it does nothing.

Wanted to note something - I had trouble with this updating my device status. I made a change to my unifi controller under Settings/Controller/Real-time Updates in Web Browser . Once I changed it from Automatically adapt rates of real-time updates to Always use real-time updates, my device status updated correctly every time hubitat checked the server. Without doing that, it was sporadic.

Not sure if it matters, but I also have Enable Debug Logging on and each child in hubitat is set to check every 30 seconds, the parent is still set to check ever 600 seconds for the cookie. Also, would like to note, although my site is called "Default", if I changed it on the parent device to "Default" as opposed to "default" (capitalization!), it couldn't find the site correctly.

I must be missing something in the setup. I have all the devices installed and I have a valid Cookie.
I created a child device, through the parent, using the MAC for my phone which I copy/pasted direct from my Unifi controller. For the life of me I cannot get my phone's presence to read 'Present'. I've tried all the combinations of the 'site', default, Default, and my specific site's name; I also tried mark's suggestion. I've tried the MAC with and without colons all to no avail. I'm running version 5.13.32.0 of the controller. Since everyone else seems to be working I must be doing something stupid but I can't seem to pinpoint where. Any ideas?

I also want to mention that I'm running the controller software on a dedicated PC running Ubuntu 20.04 if that matters.

Same for me

@wecoyote5 Have you looked at the logs? I am running mine on Ubuntu 18.04.4 LTS.

Hi Mike,
Thanks for the reply. I've backburnered this for the time being while I'm working on other setups. I don't recall any issues in the logs but when I get back to this I'll dig in a little deeper.

Thanks again!

Wow this works perfect! thanks for this - i was thinking about making a reliable presence sensor which didnt require extra apps on whatever device!

i've set the discovery to 10 seconds, any problems with that frequent checking?

I do pretty much the same query out of node red at that frequency and haven't seen any negative effects.

Really looking forward to playing with this. Thanks for putting it together.

I am having trouble troubles with initial setup. Installed the device drivers from the habitat package manager. Then I created the virtual device and entered the login information. it seems like I'm unable to get connected because after I top the login button on the device page, if I then tap check credentials, I scroll down and it still says invalid credential.Just to be sure I used the same credentials to log into directly my unified Controller, and that works fine. It runs on a RPI4, in a docker container. I used the site name directly out of the unified controller, so I'm pretty sure that's right too.

Any suggestions? I'm going to go back and check and We check again that I have the right credentials and other than for correct. But just wondering if there's anything else I may have missed.

UPDATE: Figured it out, I believe. Hubitat and all IoT are on segregated IoT VLAN, only established/related connections are permitted to the main VLAN. Unify controller is on the main VLAN, so the Unify controller login from the Hubitat app is (intentionally) blocked.

Anyone have this working On a UDMP?

@mike10 we could strike gold if one could even see which AP the user whas connected to...
i know it is possible from the API, but is it possible to fetch this information for use in rules / webcore... maan this would be freaking awesome.

Anybody have a UDMPro to test this out on?

according to the API here products:software:unifi-controller:api [Ubiquiti Community Wiki]
it looks like the auth url is different.

"

NOTE: There are two critical differences between Unifi controllers and the UDM Pro's API:

  • The login endpoint is /api/auth/login

  • All API endpoints need to be prefixed with /proxy/network

"

Looks like this would change from

def Login() {

def wxURI2 = "https://${ip_addr}:${url_port}/api/login"

To

def Login() {

def wxURI2 = "https://${ip_addr}:${url_port}/api/auth/login"

If that works I can put in an option to enable UDMPro

@diondp I have added some other information that I have not posted yet such as ssid, hostname, network and radio_proto. I do not see the associated AP do you have a link to were you saw the AP information?

its called ap_mac, from there it is just to join the AP mac to device names.. I can give some more detail Tomorrow from my own php script which fetches this info...

@diondp finally found it and it is in the latest version now.

Cool - i have updated both drivers, do i need to remove and add the clients for it to work? i dont see any new info on the child devices...