Ubiquiti Unifi Binding Feature Discussion

Party TIME !!!
Bravo Matthew! You Rock! :+1:

Keep Calm

2 Likes
@roryd Could you share the certificate with us (maybe a private message to me or @mgbowman)

Iā€™ll resurrect the cloud key tonight and get the cert off it. I had already done a factory reset on the key, but the cert remained the same. For reference, this was a Gen1 Cloud Key.

Iā€™m pretty sure itā€™s the same issue as @hakan - thereā€™s no CN (common name) attribute. No big deal for now as me and @martinvw have come up with a better implementation that will work around this in 2.5.

1 Like

Installed today, running last 4 hours without errors.
Operating system: Raspbian GNU/Linux 9 (stretch)
Java: Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)
openHAB2: 2.4.0 Snapshot Build #1454
Unifi Ctrl: v 5.9.29
binding.unifi: 2.4.0.201812081314

Thanks!!!

PS: RSSI units? I am getting 16 in OH and 22% (-82 dBm) in Unifi Controoller. :disappointed_relieved:

This is expected. The plan is to fix this in the next release once we figure out exactly how the controller is computing the dBm.

See the comment on the pull request for some background information:

Upgraded to build 86 and OpenHAB 2.4 M8 today, and the SSL handshake failure which has bitten me for some months is now gone. Thanks!

The binding works perfectly! :slight_smile:
next part is <offtopic> :stuck_out_tongue:

an alternative to this, is this:

Number		Angelos_S8_UPTM	"Angelos S8 Uptime [JS(duration_from_seconds.js):%s]"	<time>		(gUnifi)	{channel="unifi:wirelessClient:Unifi_HomeR:Angelos_S
8:uptime"}

/etc/openhab2/transform/duration_from_seconds.js (thanx to @Mihai_Badea from here)

// computes nicely formatted duration from given seconds
(function(i){
	var date = new Date(null);
	date.setSeconds(parseInt(i)); // specify value for SECONDS here
	return date.toISOString().substr(11, 8);
})(input)

I donā€™t know which is more ā€œexpensiveā€ā€¦ the JS xform or the rule calculationsā€¦ I would go with JS being better/lighter. No need for a second dummy Item and the state of the original Item keeps the seconds as value. The xform is done only for display purposes.

1 Like

Neat!

Iā€™ve already implemented the UoM support locally, but as I said in my previous post, it does ā€œbankerā€™s roundingā€ and when converting to a whole decimal %d.

I wonder if we can combine a JS xform with a UoM conversionā€¦

Using uptime = 3661 try to go from:

Number:Time uptimeSeconds "Uptime [%d s]"     => 3661 (1 hour + 1 minute + 1 second)
Number:Time uptimeMinutes "Uptime [%d min]"   => 61   (1 hour + 1 minute)
Number:Time uptimeHours   "Uptime [%d h]"     => 1

would become

Number:Time uptimeSeconds "Uptime [JS(round_and_mod_s.js):%d s]"       => 1
Number:Time uptimeMinutes "Uptime [JS(round_and_mod_min.js):%d min]"   => 1
Number:Time uptimeHours   "Uptime [JS(round_and_mod_h.js):%d h]"       => 1

Then if there was some sort of Concat (String) type where we could have something like

Concat uptimeFormat "Uptime [%s h, %s min, %s s]"  { channel="uptimeHours,uptimeMinutes,uptimeSeconds" }

Just thinking out loud here.

1 Like

Thanks for all the work and the update to version 2.4.0.

I deleted old items and things, stopped openHAB (2.4.0), deleted the old 2.3.0-20181110 jar from addons, started openHAB and installed unifi 2.4.0. But then I also had to delete cache and tmp, otherwise 2.4.0 of the binding could not be activated, because it still found traces of 2.3.0.

Fresh install got this working for me last night. However, the one issue I have is that the channel online returns a dash (-) only. All other properties return correct values for my device, i just donā€™t have the easy access to it being online or not.

I updated today to the latest version. Iā€™m running OH 2.3.001 on a Synology and Unifi mgmt. console is running on a Windows 2012 Server.

So far NO issues . . .

Thanks again!

Best, Jay

Free Cloud Unifi Inferface

Has anybody gotten the cloud interface to work with the latest binding?

Iā€™m not sure how to implement the bridge when there is a captcha window prompt? Maybe itā€™s not possible?

https://account.ubnt.com/login?redirect=https%3A%2F%2Funifi.ubnt.com%2F

Best, Jay

Can anybody see what Iā€™m doing wrong below? Iā€™m running OH 2.3 on a Synology. Iā€™m running Unifi Controller 5.9.29 on Windows Servers at both locations.

The 1st bridge works perfectly and has for many weeks now; I added the 2nd bridge this morning and it does not.

The 1st bridge connects locally; 2nd bridge connects over the Internet to another location.

I looked at the firewall logs where the 2nd bridge connects and there is NO traffic coming from OH at all to it.

I can get to the 2nd controller location via a browser w/o any issues and I see the traffic on the firewall also hitting port 8443.

Bridge unifi:controller:home "UniFi Home Controller" [ host="192.168.0.20", port=8443, username="ubnt", password="password", refresh=10 ] {
	Thing wirelessClient TriciaiPhoneUnifi 				"Tricias iPhone XR"			[ cid="e4:b2:fb:d6:XX:XX", site="default", considerHome=60 ]
	Thing wirelessClient JayAndriodUnifi 				"Jays Note9"				[ cid="44:91:60:c1:XX:XX", site="default", considerHome=60 ]
	Thing wirelessClient ParkeriPhoneUnifi 				"Parkers iPhone XR"			[ cid="f8:2d:7c:22:XX:XX", site="default", considerHome=60 ]
	Thing wirelessClient RyaniPhoneUnifi 				"Ryans iPhone XR"			[ cid="fc:18:3c:6c:XX:XX", site="default", considerHome=60 ]
	Thing wirelessClient MainFloorControlUnifi 			"Main Floor Tablet"			[ cid="68:5a:cf:4c:XX:XX", site="default", considerHome=60 ]
	Thing wirelessClient UpStairsControlUnifi 			"Up Stairs Tablet"			[ cid="68:5a:cf:22:XX:XX", site="default", considerHome=60 ]
	Thing wirelessClient BasementControlUnifi 			"Basement Tablet"			[ cid="68:5a:cf:22:XX:XX", site="default", considerHome=60 ]
}

Bridge unifi:controller:work "UniFi Work Controller" [ host="x.x.x.x", port=8443, username="ubnt", password="password", refresh=10 ] {
	Thing wirelessClient PamiPhoneUnifiRIS 				"Pams iPhone"				[ cid="48:d7:05:6e:XX:XX", site="default", considerHome=60 ]
	Thing wirelessClient JayAndriodUnifiRIS 			"Jays Note9"				[ cid="44:91:60:c1:XX:XX", site="default", considerHome=60 ]
	Thing wirelessClient JayEchoDotUnifiRIS 			"Jays Echo Dot"				[ cid="fc:65:de:16:XX:XX", site="default", considerHome=60 ]
}

The same MAC address exists in the both bridges (not sure if that matters?)

JayAndriodUnifi & JayAndriodUnifiRIS = same MAC but 2 different bridges

Best, Jay

Jay,

have you tried only with the 2nd controller, the remote one? I think it is possible that the binding only supports one controller. If the remote works when its the only one you have your answer.

Kr

Han

Next time I cycle OH; I will change the order of the bridges and let folks know the result. I suspect you are right; the binding ONLY handles 1 bridge. I was even thinking it may be a port thing being the same on the bridges?

Best, Jay

Apologies, but where can I download the latest jar for the unifi binding for my 2.3 openhab?

Hi Matthew,

So, are you already working in the wired client support? I want to be able to detect my laptop on the docking station :smile:

I got mine from the daily OH builds.

https://ci.openhab.org/job/openHAB2-Bundles/lastStableBuild/org.openhab.binding$org.openhab.binding.unifi/

Best, Jay

Iā€™m on a ski holiday and will only be back end of next week. Iā€™ve still got a lot to do on my house after I get back so I donā€™t know how much time Iā€™ll have to work on the binding but Iā€™ll do my best.

1 Like