Ubiquiti Unifi Binding Feature Discussion

Hi Micha,

Anyway I (we) could get a copy of that version? I’ve tried these 2 versions below from the posts above and neither work; same results. I used the date in your version to try to get close to it.

March 7th:
org.openhab.binding.unifi-2.5.0-SNAPSHOT.jar

March 9th
org.openhab.binding.unifi-2.5.0-SNAPSHOT.jar

I even looked for your version mentioned above on jfrog and it’s not on there; others versions are though.

Best, Jay

Hi
hope this is the right discussion.
What I have issues with: I have the Unifi Binding installed, the Controller is online, and I’ve added some wireless clients - which show online, but are not, apparently, receiving any data.
Example: I have the item
String PatricksMacAdr "Patrick iPhone Mac [%s]" (Lichter_EG, PatrickZuhause) { channel="u unifi:wirelessClient:abe64366:macAddress" }
And in the corresponding sitemap, it doesn’t show anything.

I do have an issue in the log:

2019-04-19 13:40:08.945 [WARN ] [.handler.UniFiControllerThingHandler] - Unhandled exception while refreshing the UniFi Controller unifi:controller:a21fe124 - Unknown HTTP status code 503 returned by the controller
org.eclipse.smarthome.model.item.BindingConfigParseException: ID segment 'u unifi' contains invalid characters. Each segment of the ID must match the pattern [A-Za-z0-9_-]*.
2019-04-19 14:40:05.056 [WARN ] [.handler.UniFiControllerThingHandler] - Unhandled exception while refreshing the UniFi Controller unifi:controller:a21fe124 - Unknown HTTP status code 503 returned by the controller
2019-04-19 15:40:05.423 [WARN ] [.handler.UniFiControllerThingHandler] - Unhandled exception while refreshing the UniFi Controller unifi:controller:a21fe124 - Unknown HTTP status code 503 returned by the controller

Here’s my setup:
I’ve just upgraded to 2.5. M1 for both OH and Unifi, running on ubuntu, Unifi Controller Version is atag_5.6.26_10236

I had the unifi binding up and running before, since the upgrade I’ve also noticed that the “client” was replaced with “wirelessClient”.

Any ideas?
Thanks
Patrick

Hi Jay,

I have uploaded the binding to my google drive:

Regards,
Micha

1 Like

Thank you SO MUCH Micha, it worked!

2019-04-19 10:27:54.576 [DEBUG] [i.internal.api.model.UniFiController] - Found 53 UniFi Client(s):

Your posting will help a lot of others running OH 2.4 against the Unifi controller 5.10.21.

Best, Jay

That is build #92

Looking through my commit logs, that was right before I added wiredClient and site support. If I can find some free time today, I will try and figure out what exactly is causing the latest binding code to throw an error in 2.4 and try and provide a work around.

If you look at those 2 URLs you posted, you’ll notice they both have ‘…/lastSuccessfulBuild/…’ in them which means you were downloading the latest build. You can always access the complete build history on my Jenkins server located at https://jenkins.otr.mx/job/openhab2-unifi-binding/

There you can see that build #92 was on March 7th.

Hi Patrick,

It looks like you have an error in your binding configuration:

String PatricksMacAdr "Patrick iPhone Mac [%s]" (Lichter_EG, PatrickZuhause) { channel="u unifi:wirelessClient:abe64366:macAddress" }

You’re using a channel identifier of u unifi:... (a u, followed by a space, followed by unifi:) - that’s an invalid binding config. Please remove the u and space before unifi: and report back.

org.eclipse.smarthome.model.item.BindingConfigParseException: ID segment 'u unifi' contains invalid characters. Each segment of the ID must match the pattern [A-Za-z0-9_-]*.

If you’re running OH 2.5M1, I would suggest upgrading to the build #101 (the latest as of this post)

openhab> bundle:list | grep -i unifi
234 | Installed |  80 | 2.5.0.201903210720     | UniFi Binding

That is my setup with the latest UniFi Controller:

openHAB 2.5.0 M1
UniFi Binding 2.5.0.201903210720
UniFi Controller 5.10.21

Hi Matthew,

I hope you can figure it out. i really would like to usr the latest build that would be compatible with OH 2.4.
Thank you for all the effort you put in it.

Hi Matthew

thanks for the quick reply.
I have now upgraded the Unifi controller to 5.10.21 as well and upgraded to build 101 for the binding:

openhab> bundle:list |  grep -i Unifi
269 │ Active   │  80 │ 2.5.0.201903210720     │ UniFi Binding

Now the MAC address are shown - but those clients which I set up as contacts, do not show a status in the sitemap. Here’s the example item:

Contact PatricksPhone “Patrick iPhone [%s]” (Lichter_EG, PatrickZuhause) { channel=“unifi:wirelessClient:abe64366:online” }

Best, Patrick

That item should be a Switch not a Contact :wink:

Edit: Please see the latest README

Thanks, Matthew, that did it!

I figured it out!

For all of you stuck on 2.4, you can run the latest binding code (minus the 2.5 specific “trust” bits) by installing build #10 of the 2.4 specific branch.

openhab> bundle:list |  grep -i unifi
235 | Active   |  80 | 2.5.0.201904201456     | UniFi Binding

Don’t worry that the file name and binding version contain 2.5.0 - I’ve successfully tested this in a clean instance of 2.4.

Edit: see my post below

1 Like

Hey Matthew,
I get this error on 2.4 on syno with build #10:

2019-04-21 09:22:10.842 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/volume1/public/openHAB/addons/org.openhab.binding.unifi-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.unifi [282]
  Another singleton bundle selected: osgi.identity; type="osgi.bundle"; version:Version="2.4.0"; osgi.identity="org.openhab.binding.unifi"; singleton:="true"

	at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [10:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [10:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [10:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [10:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [10:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [10:org.apache.felix.fileinstall:3.6.4]

I seem to recall that this means there’s already a binding installed. Are you certain you uninstalled the one that was running? You can confirm if there’s already one installed by running this in the console.

list -s | grep unifi

Ok guys so I did a little reorganization on the commit history to help make maintaining two branches easier.

Now I have two builds setup in Jenkins:

openhab2-unifi-binding          - compatible with 2.4.0+
openhab2-unifi-binding-2.5      - compatible with 2.5.0.M1+

The 2.5 branch uses the OH2 internal HttpClientFactory and ExtensibleTrustManager to communicate with the UniFi controller. @Kai requested this some time ago and this will be the default after 2.5 is released.

Moving forward, I will work on the 2.4 branch and do a rebase of the 2.5 branch each time I push a new build (effectively creating two builds for each commit).

Additionally, I force incremented the build number on the 2.5 build in Jenkins so the build numbers are synchronized.

Take the last build #102 for example:

2.4.0+ (openhab2-unifi-binding in Jenkins)
org.openhab.binding.unifi-2.5.0-SNAPSHOT.jar

2.5.0.M1+ (openhab2-unifi-binding-2.5 in Jenkins)
org.openhab.binding.unifi-2.5.0-SNAPSHOT.jar

If you’re running 2.5.0.M1+, please use the 2.5 specific version to help discover any potential issues with using the OH2 internal bits for communication.

Cheers!

1 Like

Thanks Matthew!

Can the binding also handle/display the wired UnifiDevices? the Unifi Switches?
I tried to put them under wiredClient, and they do not show up

Unfortunately not yet. It’s a “device” and not a “client” as far as the controller is concerned. I’m about to setup my new UniFi network at home and will be adding support for switches soon!

2 Likes

Is there a way to detect current and “available” firmware versions? I have just logged in into my unifi web page and got the notification there that the cloud key has minor updates to its firmware.

If we have this information, I could integrate that into the nightly “please update systems X, Y and Z” notification that I send from my openHAB instance…

Hi Matt

Does your binding work on a USG Pro 4?

Cheers
Kris

Hi, I found this binding and want to use it to block and unblock clients.
But It is not working I only see the blocked and reconnect via the openhab android app
and in the log I see:

2019-04-14 21:49:10.688 [ome.event.ItemCommandEvent] - Item ‘MatthewsPhoneBlocked’ received command ON
2019-04-14 21:49:10.691 [nt.ItemStatePredictedEvent] - MatthewsPhoneBlocked predicted to become NULL

Unifi controller is version 5.10.20

Hi Nick! Welcome to the community!

What version of the binding are you running?