Ubiquiti Unifi Binding Feature Discussion

ubiquiti
unifi
Tags: #<Tag:0x00007f51e4524738> #<Tag:0x00007f51e45245d0>

(Rob Pope) #726

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?


(Mark) #727

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


(Mark) #728

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


(Rob Pope) #729

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


(Mark) #730

Glad you got it sorted out. Sort of.

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


(Igor) #731

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…


(Mark) #732

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


(Igor) #733

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


(Igor) #734

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


(Mark) #735

Looks like Home Assistant might have the same issue.


(Igor) #736

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

(jmccoy555) #737

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???


(Mark) #738

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


(Mark) #739

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.


(Igor) #740

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


(Mark) #741

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.


(jmccoy555) #742

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
}

(Mark) #743

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?


(jmccoy555) #744

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


(Mr. Wiseman) #745

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