Ubiquiti Unifi Binding Feature Discussion

ubiquiti
unifi
Tags: #<Tag:0x00007f0147a64998> #<Tag:0x00007f0147a64808>

(Psyciknz) #424

My thing for the controller uses site=“default” and same with the things (they have no site defined). THis had been working.

But not sure if there’s a combination here I need to change.


(Mark) #425

Here’s mine.

2018-10-18 16:35:57.829 [DEBUG] [org.openhab.binding.unifi.internal.UniFiController] -   UniFiClient{mac: 'xx:xx:xx:xx:3b:97', hostname: 'null', wired: false, device: UniFiDevice{mac: 'xx:xx:xx:xx:39:5f', name: 'ap1-md (Kitchen)', model: 'U7LR', site: Site{name: 'MD House', path: '2dkemqdw'}}}

(Mark) #426

Since my controller spans multiple sites, I use the site names in the client Thing config.

Edit: But I don’t see where this would matter.


(Mark) #427

Have you tried restarting your Controller?


(Mark) #428

Wait! There is no site config parameter on the controller Thing; it’s only on the client Things.


(Psyciknz) #429

Just tried. No difference. Still reporting stuff in the binding as wored

REmoved that, no difference


(Psyciknz) #430
Bridge unifi:controller:nazgul "Unifi Controller: Home" @ "Nazgul" [ host="unifi", username="admin", password="supersecretpassword", port=8443, refreshInterval=10]
{

        Thing client unifi_xiaomi   "Unifi: Xiaomi" @ "Nazgul" [  mac="xx:xx:xx:xx:xx:23",site="Nazgul" ]
}

I’ve tried the thing with and without the site.


(Mark) #431

My Things are defined in PaperUI. I don’t use a .things file.

But, the only diff I see between your config and mine is that you don’t specify the Consider Home Interval in your client Thing config. But, I think there’s a default for that, and it shouldn’t have any bearing on the problem you’re having…


(Psyciknz) #432

No I’ve been running this config for a while…but I have switched to a docker for unifi and a docker for openhab. But I can’t see how that can change things. I think the controller is reporting it correctly as I’ve got access ot the full api, and I can see for that device it’s definitely is_wired: False

{u'latest_assoc_time': 1539892219, u'tx_bytes': 4021, u'bssid': u'xx:xx:xx:xx:xx:6b', u'ip': u'192.168.10.21', u'site_id': u'5812b812e4b02d20789c9fb7', u'oui': u'XiaomiEl', u'rx_rate': 72109, u'ap_mac': u'xx:xx:xx:xx:xx:6b', u'radio': u'ng', u'anomalies': 0, u'first_seen': 1537000371, u'usergroup_id': u'', u'qos_policy_applied': True, u'uptime': 4826, u'is_11r': False, u'user_id': u'5b9cc3b36662b806258a5b31', u'fixed_ip': u'192.168.10.21', u'hostname': u'lumi-gateway-v3_miio87296016', u'tx_bytes-r': 0, u'authorized': True, u'powersave_enabled': False, u'tx_packets': 22, u'assoc_time': 1539892219, u'channel': 11, u'radio_proto': u'ng', u'rx_packets': 573, u'noise': -106, **u'is_wired': False**, u'radio_name': u'wifi0', u'rx_bytes-r': 104, u'mac': u'xx:xx:xx:xx:xx:23', u'dhcpend_time': 2400, u'rssi': 40, u'_uptime_by_uap': 4826, u'tx_rate': 65000, u'name': u'Xiaomi-Hub', u'satisfaction': 85, u'_is_guest_by_uap': False, u'rx_bytes': 86361, u'network_id': u'5812b816e4b02d20789c9fbc', u'idletime': 1, u'signal': -56, u'ccq': 991, u'use_fixedip': True, u'_last_seen_by_uap': 1539897045, u'vlan': 0, u'essid': u'NazgulNetwork', u'tx_power': 40, u'bytes-r': 104, u'is_guest': False, u'_id': u'5b9cc3b36662b806258a5b31', u'noted': True, u'last_seen': 1539897045}

Any ideas what the code is looking for to device is wired or not? I’d assume the same field.


(Mark) #433

What version of the binding are you running? I’m on this one.

189 │ Active   │  80 │ 2.3.0.201804122004     │ org.openhab.binding.unifi

(Psyciknz) #434

not that one.,… :grinning:

The latest I see is from here https://github.com/mgbowman/openhab2-addons/releases is 2.2

Has it been incorporated into the offical repository?

So I currently have org.openhab.binding.unifi-2.2.0-SNAPSHOT.jar on my addons folder.


(Angelos) #435

latest build is here: https://jenkins.otr.mx/job/openhab2-unifi-binding-v2/

I am running

openhab> bundle:list -s |grep unifi
190 x Active   x  80 x 2.3.0.201804221805     x org.openhab.binding.unifi

but I still use 5.6.40 Controller because of my AP-AC Outdoor (it goes EoL after 5.6.x)

no :frowning:


(Mark) #436

Not yet. But the version I’m running is from the Pull Request.

Important: The online channel changed from a Contact to a Switch. If you install this version, you’ll need to update your items, as well as change any rules that check for OPEN/CLOSED to OFF/ON.


(Mark) #437

Ugh. I thought I had the latest. :frowning:


(Psyciknz) #438

BOOM!!


(Psyciknz) #439

Oh, so which one is it now, a switch or contact? Though mine seems to be happy with a contact item.


(Mark) #440

As part of the review process of the PR, Kai asked Matt to change it from a Contact to a Switch. So, in the lastest versions it’s a Switch.


(Psyciknz) #441

Ok, and that’s the one in the PR…but that’s not the same version as from jenkins?


(Mark) #442

Here.


(Angelos) #443

Use a Switch

Here are my items:

/* Unifi Items */

Switch		S8_PRES	"S8 Presence [MAP(Unifi.map):%s]"	<switch>		(gUnifi)	{channel="unifi:client:Unifi_HomeR:S8:online"}
String		S8_AP	"S8 AP [%s]"				<qualityofservice>	(gUnifi)	{channel="unifi:client:Unifi_HomeR:S8:ap"}
Number		S8_RSSI	"S8 RSSI [%s]"				<qualityofservice>	(gUnifi)	{channel="unifi:client:Unifi_HomeR:S8:rssi"}
Number		S8_UPTM	"S8 Uptime [%d]"			<time>			(gUnifi)	{channel="unifi:client:Unifi_HomeR:S8:uptime"}
String		S8_UPTF	"S8 Uptime F [%s]"			<time>			(gUnifi)
DateTime	S8_TIME	"S8 Last Seen [%1$tH:%1$tM:%1$tS]"	<time>			(gUnifi)	{channel="unifi:client:Unifi_HomeR:S8:lastSeen"}

Unifi.map:

ON=Home
OFF=Away
NULL=Unknown

nice trick to display properly the uptime:

Unifi.rules

rule "Format S8 Uptime Display"
when
	Item S8_UPTM changed
then	
	var int days = ((S8_UPTM.state as DecimalType).intValue / (86400))
	var int hours = (((S8_UPTM.state as DecimalType).intValue / 3600) - (24 * days))
	var int minutes = (((S8_UPTM.state as DecimalType).intValue / 60) - ((1440 * days) + (60 * hours)))
	var int seconds = (((S8_UPTM.state as DecimalType).intValue) - ((86400 * days) + (3600 * hours) + (60 * minutes)))
	var String result = ""
	if (days > 0) { result = result + days + "d, " }
	if (hours > 0) { result = result + hours + "h, " }
	if (minutes > 0) { result = result + minutes + "m, " }
	if (seconds > 0) { result = result + seconds + "s" }		
	S8_UPTF.postUpdate(result)
end

then put the formatted item (S8_UPTF) on your sitemap


Network UPS Tools (nut) setup issues