Ubiquiti Unifi Binding Feature Discussion

I use the same as you (build #29 = lastSuccessfulBuild):

openhab> list -s |grep -i unifi
176 | Active   |  80 | 2.1.0.201706081307     | UniFi Binding                                          | org.openhab.binding.unifi

I downloaded it from:

https://jenkins.otr.mx/job/openhab2-unifi-binding/29/artifact/addons/binding/org.openhab.binding.unifi/target/org.openhab.binding.unifi-2.1.0-SNAPSHOT.jar

My controller is still on 5.4.18 (I will upgrade soon to 5.5.x)

I think that this reminds me of something that I saw in the pastā€¦ I will put the binding in TRACE, look at the logs and report back.

Any update to this binding? *Iā€™m on the 2.1-SNAPSHOT.jar. I was hoping to use it. I notice itā€™s still trying to access https://mycontroller:8443/api/s/null/stat/device

Hello @mgbowman thanks for your work! Is there progress on wrapping up and starting the PR process it would be great to include it.

Hi @martinvw, Iā€™ve been away for the last month now Iā€™m finally back home. I will try and find some free time this coming week. Thereā€™s 2 things I want to do before I squash and rebase:

  1. Look into the **null** issue @psyciknz is experiencing
  2. Change the online channel to a Contact (instead of a Switch as itā€™s read-only)

I will make these changes and post a new build (with a 2.2.0-SNAPSHOT version) to see if we can get this in OH 2.2.

Will keep everybody posted.

4 Likes

Iā€™m interested in testing this. How do I proceed?

Download the latest *.jar file from: https://jenkins.otr.mx/job/openhab2-unifi-binding/
Place it in your $OPENHAB_RUNTIME/addons folder (in Linux apt: /usr/share/openhab2/addons/)
Use discovery in PaperUI or manually define your things and items (see this thread for example configs)

edit: forgot the link to the UniFi Binding Readme for config info :slight_smile:

4 Likes

Thanks for the quick response. Iā€™ll be on it tonight!

1 Like

Just got this setup and it is working for me with openhab 2.1.0 stable and unifi controller 5.4.9

Thanks for creating this binding!

Installed, though manually, got it working. Binding works like a charm.

My next goal is to use the Things in the Experimental Rule engine in Paper UI. Can someone pass me a sample or a link to a sample.

1 Like

Just installed and configured this binding - so far so good. Thanks Matthew for putting it together!

What needs to be done to include this in a 2.2 or 2.3 release?

Really just a rebase and squash which should result in a clean PR.

Iā€™ll try to do this today.

I was about to open a PR and I remembered the two outstanding issuesā€¦

  1. @psyciknz did you ever sort out your issue or are you still getting **null** in the calls to your controller? Do you have a site parameter defined on the UniFi Controller bridge?

  2. Is the consensus to change the online channel to a Contact? It makes sense to me as itā€™s read-only.

Iā€™m going to wait for your feedback before I open the PR. Hopefully we can do this quick enough to get it into the 2.2 release.

2 Likes

sounds good to me

Where is the site parameter set?

I have a Things, Unifi Controller, but it only has a name as and location (or should I set location to be the name of the network?

Iā€™ve tried removing my controller and found the binding in resolved state to gave it a restart. Then I was able to see the binding config - couldnā€™t see a site in there, so tried adding the controller again. Now I see to be in some sort of mess where i canā€™t see the binding config anywhere.

So still not sure where I add the site.

EDIT. Just moved to the 2.2.0-SNAPSHOT and now I can get it to work.

I use a things file:

root@homer:~# more /etc/openhab2/things/Unifi.things 
Bridge	unifi:controller:Unifi_HomeR	"Unifi Controller: HomeR" @ "Unifi" [host="172.16.13.100", username="angelos", password="whatever", port=8443, refresh=10]
{
	Thing	client	Angelos_S6	"Angelos_S6" @ "Unifi"	[mac="ec:1f:72:17:xx:xx", site="default"]
	Thing	client	Simona_I6	"Simona_I6" @ "Unifi"	[mac="a8:66:7f:e3:xx:xx", site="default"]
}

Site is defined at the thing level (not the Bridge). I havenā€™t changed the ā€œdefaultā€ name of the site in the Unifi Controller to test if it will work (but it should).

In PaperUI, the site option appears under the thingā€™s configuration parameters

and here are my items (I only link to the main 2 channels)

root@homer:~# more /etc/openhab2/items/Unifi.items 
/* Unifi Items */

Switch	Angelos_S6_PRES	"Angelos S6 Presence"	<present>	(gUnifi)	{channel="unifi:client:Unifi_HomeR:Angelos_S6:online"}
Number	Angelos_S6_RSSI	"Angelos S6 RSSI [%s]"	<signal>	(gUnifi)	{channel="unifi:client:Unifi_HomeR:Angelos_S6:rssi"}

Switch	Simona_I6_PRES	"Simonas I6 Presence"	<present>	(gUnifi)	{channel="unifi:client:Unifi_HomeR:Simona_I6:online"}
Number	Simona_I6_RSSI	"Simonas I6 RSSI [%s]"	<signal>	(gUnifi)	{channel="unifi:client:Unifi_HomeR:Simona_I6:rssi"}

Yeah I could only see it there when setting up an item. Where it sounded
like I was supposed to be seeing it in the controller.

Youā€™ll notice that after updating to 2.2 snapshot it started working for me.

1 Like

I am currently running:
openHAB 2.2.0 Snapshot Build #1028 on a Debian Jessie with Oracleā€™s JVM 8u144 with 2.1.0.201706081307 org.openhab.binding.unifi and Unifi Controller version 5.5.19 (need to up to 5.5.20)

the binding works fine on this latest release. I never had problems with it since I started using it.

@psyciknz: what is your opinion on changing the channel type for the Online channel from Switch to Contact? (I am in favor since it is a ā€œread onlyā€ setting)

Iā€™ve never used a contact item. But if its read only as you say (and I assume interacting with it on the UI is disabled?) then Iā€™d be for it.

1 Like