Unifi Binding - some trickery because unifi is stupid....no offline for wireless

Tags: #<Tag:0x00007f617bfdc3a0>

Anyone notices lately that Unifi wireless devices when they leave the wireless don’t go offline?

They seem to drop to the wired lan and stay connected.
@mgbowman

1 Like

Here’s what i see with the wireless turned off (and just rebooted the phone)

2020-06-30 13:19:14.720 [vent.ItemStateChangedEvent] - unifi_ugluk_accesspoint changed from AP-Cupboard to AP-Roof

And it’ll sit there until it comes back on the wireless.
Roof is a UAP where Cupboard is a UAP-AC-Lite

Yes I have had this problem. I renamed my things file and it started working. I need to look if it is still working after 2 weeks. I have not setup rules yet so I have to look manually.

Just tested and it is broken again after about 10days. It worked for some time after renaming my things file but is not currently working.

Is it’s like we need something, would be annoying to have to have a proxy switch, that if device is wireless = false, and we know that’s not possible, the proxy switch it set to off.

Not sure if we can get a is_wired attribute of a client.

You sort of can, at least using that latest snapshot binding: https://github.com/mgbowman/openhab-addons/blob/unifi-binding/bundles/org.openhab.binding.unifi/README.md

Not quite an attribute though. It would effectively be a proxy, which isn’t what you’re after!

What types of devices are causing the problems? I’ve been using this binding for a long while very reliably now (touch wood). All our phones are android.

iPhone and iPad I’m noticing it on. I do have an Android before, but it’s on guest network so might give different results. But I’ll try.

Unifi controller is 5.12.xx

Yeah, just verified, I’m on 5.12.35, so that’s the same. If i remember correctly, the main forum thread for the unifi binding had some discussion about this issue but it seemed specific to apple products. Might be worth checking there:

Is there a way of determining if a client is wired or wireless? I’ve mine defined as wirelessClient things.

I think I’ll do the proxy item, but need to work out what network a device is on.

I don’t think so.

I presume the way to do this is to create two items for the same device: one for when it’s wireless (as you already have), and one for when it’s wired. Then perform rules depending on each state, I guess.

Yeah just trying that now. Unsure if I can have two “things” with the same mac address. Then will look to see if anything changes (essid/ap) when it goes off line.

At the moment, the 2nd thing isn’t existing.

The priority essentially means the binding attempts to lookup by MAC address, then by IP address, then by hostname and finally by alias. Once it finds a matching client, it short circuits and stops searching. Most of the time, you will simply use the MAC address.

This is probably what’s causing me a problem

Hmm when did wiredClient exist from? If I do a scan for new unifi items, I don’t see a wiredClient as a thing to look for.

So that’s why the wired version isn’t showing up

So a quick look at home assistant, it can’t figure out it’s gone wireless to wired either…but on wireless a device has a few more attributes available:
image

The qos, radio and radio proto/vlan all go away when I turn off the wireless. So I could make home assistant tell openhab it’s off the wireless.

Ok so if you leave it long enough it does go off…like 10-15 mins.

My trouble devices are all iphone. I will add an android tablet as a thing and see what happen ns.

I found it can take about 15 mins for it to figure out offline

Any reason not to use the network binding instead?

I use the Unifi binding to see if anyone is connected to the guest network to change the house mode, but use the network binding to ping the devices. This is mainly because I was using the network binding already…

Of course, the desire to use a single binding instead of splitting functionality over two is legitimate!

Well it just seemed logical to use a dedicated binding for my network system, as it did work. Unfortunately I think ubiquiti broke it. So I might look at switching to generic network binding.

As long as you can specify an item by mac address, as a bunch of my devices do roam, and so the unifi binding does have that capability

Incidentally I could be working again? Just in testing yesterday it didn’t seem to be

2020-07-02 08:29:37.349 [vent.ItemStateChangedEvent] - unifi_yumyum_online changed from ON to OFF
2020-07-02 09:06:39.536 [vent.ItemStateChangedEvent] - unifi_yumyum_online changed from OFF to ON

Need to check some of the other devices, but it might be intermittant.