I wrote a small MQTT publisher for association / disassociation events from a UniFi controller. This can be used for presence detection in OpenHAB. Examples are included.
There is a (configurable) 3 minute dampener built in to handle phones turning off their WiFi occasionally. This setup works very well for iPhones, have not tested Android.