1

Situation: I wrote an alarm clock app that runs on a MacMini. (No, I have never found any commercial app that works like I want it to.) But sometimes I spend the night away from home, and I don’t always remember to turn the alarm off, which means my poor housemates have to go into my room the next morning to turn off my alarm.

If my alarm app could detect when I wasn’t home, it could programmatically suppress the alarm. That would be sweet. I am looking for suggestions/recommendations for how to do that.

Option 1a: Using the “Find My” network to detect when my iPhone (or the AirTag in my wallet) is not at home. It might be possible to use the OpenHaystack library for this, but I’m a recreational programmer, and deploying that code looks pretty challenging. My skill set is mostly command line scripting, AppleScript, and Ruby. No Objective-C or Swift. (The alarm clock uses the RubyCocoa bridge that Apple has since abandoned.)

Option 1b: Scraping the iCloud web interface might work, if I can figure out how to authenticate against it with code. The login looks like there’s a lot of JavaScript folderol in the way.

Option 2: Detecting the iPhone’s proximity via BlueTooth.

Option 3: Some kind of pressure/weight detector on the bed frame?

Option 4: Something I haven’t thought of yet.

Thanks.

1

1 Answer 1

1

Update: It seems that there is also a way using the Shortcuts's "People Leave/People Arrive" trigger. docs: https://support.apple.com/en-bh/guide/shortcuts/apdb450f6291/ios


BetterTouchTool app has some suitable Bluetooth triggers that have worked great for me in the past (under "Automations & Named & Other Triggers"), and also USB Device Connect / Disconnect Trigger

enter image description here

enter image description here

I don't know how your app works, but BTT can run AppleScript or a shell script, which changes the app's defaults, etc. (BTT have a free 45-day trial)

https://folivora.ai/downloads

1
  • 1
    I'll need to dig into this a bit more deeply, but it looks like the "Shortcuts" option only runs on iPhone/iPad. If there isn't an equivalent that runs on MacOS, that might not be that useful. Research! On the upside, my app is designed to be driven primarily through its scripting interface. Downside: it's running on 10.6, and migrating it to newer OSs is likely to fail. I cannot compile it as a 64-bit app (I think) because Apple dropped support for RubyCocoa before XCode would compile to 64-bit Intel targets. Or maybe not. BetterTouchTool certainly sounds promising...
    – Snarke
    Commented May 22 at 0:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .