Problem with openHAB UniFi Binding

After upgrading UniFi Controller to version 5.12.35 last week, the openHAB binding started having problems with the Online channel. Going from OFF to ON is still detected correctly, but not the other way around. I’m still not sure if this is a problem in the binding, the controller or in my configuration. Only thing I know for sure is that after upgrading the controller image in Docker and the access point firmware at the same time, binding stopped detected our phones disconnecting from the access point.

openHAB is version 2.5.1. I have asked in the openHAB forums, but is still waiting for feedback.

In the meantime I’ve created a work-around using rules. Problem is that once client goes offline, it seems to be excluded from the list fetched by the binding, and channel stops receiving updates. For LastSeen it makes sense, but Online should be updated to OFF, when client is no longer listed. So I used LastSeen to mimic this desired logic in my rule:

var Timer timerUniFiJacob = null

rule "UniFi work-around Jacob"
when
    Item UniFi_OnePlus5_LastSeen changed
then
    if (Jacob_Home.state == OFF)
    {
        Jacob_Home.sendCommand(ON)
    }

    if (timerUniFiJacob === null)
    {
        timerUniFiJacob = createTimer(now.plusSeconds(180), [ |
            Jacob_Home.sendCommand(OFF)
        ])
    }
    else
    {
        timerUniFiJacob.reschedule(now.plusSeconds(180))
    }
end

This rule simply restarts a 3 minute timer on each LastSeen update. When client goes offline, these updates will stop and after three minutes, item Jacob_Home will be set to OFF.