Wouldn't that affect battery drain?
Yes, but a ping every few second shouldn't make much difference. The problem is that phones go into power saving mode.
When using whatsapp from the website, that requires (required? Haven't used it in a while) the phone to be online, I occasionally had to wake up the phone.
I can't remember the details, but I had mobile detection reliably working using arp on my router.
I made a software to do actions when devices appear/disappear from the LAN.
https://github.com/ltworf/lapdog
It sends pings and uses the mac addresses.
Although I will say it is sometimes frustratingly slow to first connect to wifi, as if it is only scanning every 30 seconds or more when not connected to a network.
[0]For lighting and ambient music to come on when I get home from work.