I found the sweet spot for IoT to be whether or not my phone's MAC is connected to my router. It's enough to trigger meaningful automations without killing battery life or sending sensitive data all the time.
I had issues with that since my phone's Wifi chip seems to have powersaving in it also, which means if my phone is screen-off in my pocket, it's not necessarily 'connected' to my router as far as the router is concerned. It effectively reconnects sporadically to grab push notifications or when I turn on the screen, but otherwise is mostly sleeping. I wasn't able to come up with a presence detection system more reliable than the one HomeAssistant uses, which is "is $my_phone inside $gps_fence"
What kind of granularity do you need? When I had that running I set the timeout to an hour which seemed to be enough to cover those disconnection periods. Of course, it meant that it takes an hour for Home Assistant to actually notice that my phone is gone but that was OK for my use-case.
I run HomeAssistant as the brains of my IoT. It connects to my Mikrotik router via api and treats every connected device as a presence sensor (this is mostly automatic aside from initial setup).
From there you just treat the presence sensor like any other sensor in your automations.