Ubiquiti Unifi Binding Feature Discussion

Things in PaperUI doesn’t show any Unifi things

I’ve just added the controller manually through PaperUI and it claims to be online. Maybe I’ll have to go through the UI rather than config?

I just created a .things file. It saves with no errors, but there are no things. Hmm…

Ok, that was my fault. I didn’t have the binding installed. Once installed, the things loaded correctly. :roll_eyes:

I just moved my config (copied and pasted) into a new .things file and it works. :man_shrugging:

Glad you got it sorted out. Sort of.

Some things just can’t be explained (pun intended). LOL

1 Like

Be careful with upgrading to latest controller version 5.10.12 from 5.9.29 - my log is full with this:

[WARN ] [.handler.UniFiControllerThingHandler] - Unhandled exception while refreshing the UniFi Controller unifi:controller:home - Unknown HTTP status code 404 returned by the controller

Data is not uploaded to OH…
Trying to find the fix…

Did you try putting the binding in DEBUG mode? That might show the request that getting the 404 response from the controller.

There are special instructions about this upgrade - you have to update Java to latest version first and I found this in hard way…
Here is discussion about this case https://community.ubnt.com/t5/UniFi-Routing-Switching/Step-By-Step-Tutorial-Guide-Raspberry-Pi-with-UniFi-controller/m-p/2668717

So, now I will try to install old version back and then upgrade one more time…

Looks like Home Assistant might have the same issue.

Changing log level to debug do not give any real info:

2019-02-09 14:53:56.565 [DEBUG] [.handler.UniFiControllerThingHandler] - Refreshing the UniFi Controller unifi:controller:home

2019-02-09 14:53:56.583 [WARN ] [.handler.UniFiControllerThingHandler] - Unhandled exception while refreshing the UniFi Controller unifi:controller:home - Unknown HTTP status code 404 returned by the controller

Don’t the update notes say the API has changed??? Will try and dig out the email.

Edit: This is the note I was thinking of from - UniFi Network Controller 5.10.12 Stable has been released;

For people who are migrating from v3, there’re many changes to APIs and it’s not backward compatible. You may need to update the shell library (unifi_sh_api) and/or your customized portal/external portal code.

Although I’m not sure what the v3 is referring to, the API version???

I read that, too, and thought they were referring to some very old controller versions. Not sure though…

Based on that, my guess is that it’s the login call that’s causing the problem. That’s also consistent with what I read in the Home Assistant issue.

1 Like

But I did not change login credentials.
Now trying to reinstall 5.9.29 and will wait for future updates

I’m sure that’s the case. I guess what I’m saying is that something changed in the controller API that breaks the login call from the binding.

Same note was in the notes for 5.9.29 so maybe it is the controller version, but quickly comparing (and a lot of guessing) …

https://dl.ubnt.com/unifi/5.10.12/unifi_sh_api

against

https://dl.ubnt.com/unifi/5.9.29/unifi_sh_api

they have added \ everywhere… no idea if that is relevant

e.g.

unifi_login() {
    # authenticate against unifi controller
    ${curl_cmd} --data "{'username':'$username', 'password':'$password'}" $baseurl/api/login
}

is now;

unifi_login() {
    # authenticate against unifi controller
    ${curl_cmd} --data "{\"username\":\"$username\", \"password\":\"$password\"}" $baseurl/api/login
}

They replaced the single quote with a double quote in the JSON. The double quote needs to be escaped, hence the backslash.

I wonder if the binding is sending single quotes, and that may no longer work…

@mgbowman Any thoughts on what’s going on?

ah yes I see… the world of JSON continues to be a mystery to me!!! One day I’ll find the time to understand.

Mark,

If you wouldn’t mind while your fixing the single/double quote issue; could you look into allowing 2 bridge entries also? I believe this isn’t working; it uses the first bridge listed in the thing file.

Best, Jay