I would like my macros to stop running when I leave the house. I don't have any motion detection hardware at home, but I do have an iPhone that I take with me when I leave. I also have an Apple Watch that I wear all the time. Is there a way, even if it requires a lot of special code, to detect whether my phone or watch are near my house. I think I can achieve it, but my method is a bit kludgy. Can anyone think of a simple, proper way to achieve this?
My tentative method (it seems to work in my preliminary testing) is to have two iCloud accounts. A device at home will be registered to one account, while the devices I carry with me are registered to a second account. It is possible for a KM macro to open a browser window, visit the Apple website to "Find my Friends", wait for the distance to appear for my first account, and it will look something like this:
I can use pattern matching or OCR to see that the above distance is under, say, one mile. That would tell me I'm away from home. This is not too difficult for me to code, but it doesn't feel like the "right" way. It does have one big advantage however: it uses the iCloud services to handle all of the dynamic tracking. So for example I don't need to install an app on my phone to check the GPS and send an email when the location changes. If there's no other solution, I'll use this one.
But maybe there's a simpler way, such as using the WIFI on the iPhone to somehow connect with my Mac. As I write this I notice something called Handoff. When I'm using certain apps on the phone, my Mac's Dock shows a special icon indicating that my phone is nearby. Perhaps I can use KM to monitor the Dock. (Preliminary testing shows that the icon disappears 10 seconds after the iPhone's goes to sleep, so that doesn't help.) I presume Apple's OS detects when the device is "nearby", and I simply want access to that tiny bit of information.
It's worth noting that the iPhone cannot be connected to my computer when I'm at home because I need to be able to walk around with my iPhone around the house during the day, in part to allow KM macros to buzz me when my computer needs attention. (Although now that I think of it, maybe my Watch could handle that part. That may work after all.)
Another possible solution is to make my iPhone into an AirPlay Receiver. Not a sender, but a receiver. That way it would show up in the list of available Airplay devices on my Mac (when it's within WIFI range). And perhaps KM should support AirPlay but giving us an action that lets us use AirPlay from our Mac (I think Peter may like that idea.) But if not I can make it happen using mouse clicks.