Unifi binding: client goes offline for now apparent reason

Hi
there is this interesting issue I have with the Unifi binding. I am doing presence detection using the online/offline status of a device, i.e. when I leave the house, my smartphone is not longer logged into the Wifi network - therefore the status of the device will be set to “off” and I will receive a notification.

However, randomly the device will show “off” even though it is clearly online and also shows so in the Unifi controller.

Since this has been going on for a while, I thought I try to analyze by setting the debug level of the Unifi binding to debug. However, I still don’t see a reason why this is happening. Here’s the entry for a time when the device was shown as offline:

 - UniFiClient{mac: 'xx:xx:xx:xx:xx:xx', ip: '192.168.xxx', hostname: 'iphone', alias: 'null', wired: false, blocked: false, device: UniFiDevice{mac: 'xxxxx', name: 'AP1', model: 'xxx', site: UniFiSite{name: 'default', desc: 'Default'}}}

And here’s the same device at a time when it was shown as “online”:

- UniFiClient{mac: 'xx:xx:xx:xx:xx:xx', ip: '192.168.xxx', hostname: 'iphone', alias: 'null', wired: false, blocked: false, device: UniFiDevice{mac: 'xxx', name: 'AP2', model: 'xxx', site: UniFiSite{name: 'default', desc: 'Default'}}}

The only difference I see is that the phone is now logged on to a different AP, other than that I don’t see a difference. Has someone had similar experience or can point me in the right direction?

Thanks
Patrick