Recently I've been trying to be more consistent about wearing my Apple Watch to bed each night so I can track my sleep over time. The one challenge has been remembering to charge my watch during the day such that it has a good enough charge to get me through the night and to get me through my morning dog walk.
Previously, I had not spent much time playing around with Shortcuts on the Mac, but this little problem provided just the motivation I needed to dig into the app a bit more and see if I could create a useful shortcut to remind me to charge my watch.
For my solution, I didn't simply want a calendar reminder or a recurring task in Things each day as I felt that it would be hard to schedule the reminder for an opportune time and thus, too easy to ignore. Instead, I wanted the shortcut to consider the relevant context, specifically the current battery level on my watch and if I was currently using one of my desktop Macs (where I have watch chargers conveniently available).
With that background, I came up with this problem statement:
When I'm using either my home iMac or work Mac Studio, if my watch's battery level is below 60% (and it's not currently charging), remind me to charge my watch. Additionally, if the watch is charging and has reached a full battery level, remind me to put it back on.
There’s no need to remind me to charge my watch if it has a nearly full charge or if it’s already connected to a charging cable. And I don’t want to forget about it and leave it connected to the charger all day, so it should let me know when it’s done so I can put it back on.
To create such a Shortcut, I needed to figure out solutions to three problems:
- How do I know when I'm using one of my two Mac computers (so I can be reminded when I’m near a charging cable)?
- How do I get the watch's current battery level?
- How do I know if the watch is currently charging?
For the first problem, I really just need to know if I'm logged into either of the computers. But that isn't an “event” I could use to trigger a shortcut.1 However, I do unlock the Mac regularly throughout the day (I have my Mac set to lock the screen after 15 minutes). So the act of unlocking my Mac would provide a suitable trigger to run the shortcut. Unfortunately, the Shortcuts app on macOS today only supports running shortcuts via a user action such as a keyboard shortcut, the Menu Bar, the Services menu, or a Finder Quick Action. Fortunately, Keyboard Maestro supports many kinds of triggering events, including "when the Mac is unlocked", and Keyboard Maestro also supports running a shortcut through its “Execute Shortcut” action.
The second two problems are closely related, but again, Shortcuts does not include actions that can help here. But the excellent AirBuddy 2 added a number of great Shortcut actions in a recent update and solves both of these problems nicely. It provides a few sample shortcuts, one of which–“Check AirPods Battery”–is very close to what we need here.
The shortcut is pretty simple and is a pretty direct translation of the problem statement. It leverages two AirBuddy actions:
Get Device State and
Get Device Battery Information to get the watch's current battery state. The
If statements just check the current
Charging State and
Level of the battery to decide if a notification should be displayed.
Finally, Keyboard Maestro uses the “When the Mac is unlocked” trigger to run the shortcut.
While this was a good experience to learn the Shortcuts tool through a simple example, it also demonstrates some of the real limitations of Shortcuts today. First, to provide a useful automation–especially one that reminds me of something I tend to forget–I don't want to have to remember to run the shortcut throughout the day. But Shortcuts is limited in how a shortcut can be triggered (at least on the Mac). I had to use a third-party app to solve this. Additionally, while there are some applications and services with good support for Shortcuts, the coverage is spotty and inconsistent. It seems to me that getting the current battery charge level of my Apple Watch on my Apple Mac using Apple's Shortcuts app should be easy to do. Again, I had to solve this with a third-party app.
That does say something positive about the state of the Mac software ecosystem, however. There are lots of great apps out there to help bridge the gap between the promise of a tool like Shortcuts and its actual out-of-the-box capabilities.
- Whether or not I'm logged into the computer is a state and for triggering a shortcut we want a state change. While I could have a shortcut run repeatedly and check if I'm currently logged in, my preference was to avoid a polling solution. ↩︎