A simple solution for robust Wifi based presence sensing (if you have a Microtik router) that has minimal load on the hub.
Create a virtual presence sensor
Use the Maker API app to setup URLs to trigger "away" and "present"
Setup your router to assign a fixed IP address to the phone you want to detect presence on.
Install a script on your Mikrotik router that pings the device (I do it every 5 seconds) and hits the "present" or "away" URL depending on the result. This is my little script:
[UPDATED] iPhone WiFi Presence Sensor is a community app that works on most phones and bypasses the need for rules altogether. Give your phone a fixed IP address and add it to the virtual device that is created by the app.
It works on most Android phones too as indicated in the thread. The general idea is still the same. The app creates a virtual device. On the router you set an IP reservation for the phone. In the virtual device's preferences, you put in the reserved IP address of the phone. The virtual device pings the phone and sets presence based on whether the phone gets pinged.
It's only called iPhone because that is what the creator had for testing. Others have verified it works on Android phones too.