I recently purchased the Apple iPhone 15 Pro and Apple Watch Series 2 Ultra, both of which have “Action Buttons.” Since I hadn’t explored Apple shortcuts much before, I decided to dive deep into Apple automation. This post focuses on my Apple Watch Ultra action button shortcut. You don’t need the Ultra; you can easily set up a complication on any watch series to launch the same shortcut.
The interesting thing about this shortcut is that it has location and time-dependent conditions. For example, Menu #1 is displayed when you’re at home, while Menu #2 is shown when you’re away. Additionally, the action button performs a different function at bedtime compared to the rest of the day. It’s pretty cool.
I use Home Assistant for smart home automations. This shortcut triggers a couple of Home Assistant automations for my good night and wake-up routines. If you’re not using Home Assistant, you can substitute Apple Home scenes/shortcuts. The purpose of this post is to demonstrate what’s possible rather than assuming you need the exact same functionality.
In a follow-up post, I’ll discuss how I’ve configured the action button shortcut for the iPhone 15 Pro. I’ll share some cool features, such as different actions based on the phone’s orientation or the focus mode you’re in. It’s really powerful.
Action Button Shortcut Overview
My Apple Watch shortcut has three main branches, that are both location and time aware. Click on the diagram below to open a larger version. The basic workflow is as follows:
- If my location is “Home” then I run one of two shortcuts depending on the time of day. If it’s between 8PM and Midnight it shows a menu where I can select the “Sleep Toggle” shortcut. This toggles the Sleep focus mode, and calls one of two Home Assistant automations that control lights and window shades. Plus it starts an AutoSleep session to track my sleep.
- If my location is “Home” but outside of bedtime hours, then I have two menu options to control focus mode or choose a Home Scene.
- If my location is NOT “Home”, then I get a different menu that let’s turn on the climate control in my Tesla, or sets a focus mode of my choice. The not home menu is not time dependent.
While most of the shortcut is nothing to write home about, I think the location aware factor is cool and the Home Assistant automation warrants a detailed discussion. You could extend the same concept to multiple locations, like home, work, gym, etc. regardless of any focus mode being active. This shortcut has been tested on iOS 17 and WatchOS 10.
The location feature of the Shortcut is “global” in nature, meaning that any number of shortcuts can access your home or away state. And it’s also fully automated, so when you arrive or depart from your house, the status (stored in iCloud) is updated within seconds without user confirmation.
P.S. If you are wondering what app I used to create the workflow diagram, it’s the xmind app for Mac.
The following iOS apps are needed for the full functionality of my shortcut. Install them before you import the shortcuts, or they will be broken.
- Data Jar: A free app that stores shortcut data, such as variables, in iCloud.
- Home Assistant companion app: Enables Shortcut support for Home Assistant. Optional.
- If you have a Tesla, make sure you are running the latest iOS app version that includes a number of native Shortcuts.
- The “Sleep Toggle” Shortcut uses the the AutoSleep app for one of the actions. If you don’t use that app, just remove the missing step in the Shortcut.
Data Jar Configuration
Setting up Data Jar is super easy. I configured a jar for ‘dictionary’ content, in case at some future time I want to store more data about the “Home” state, such as when the status was last updated. But for now, I’m keeping it simple with one key entry called “state” in a data jar named “isHome“.
Here’s how to setup Data Jar:
- Install Data Jar on iOS.
- Launch it and tap through the intro screens.
- In the upper left tap the + symbol.
- Change the type to Dictionary. (Swipe left on the top row)
- For Key enter isHome. Tap Save.
- Tap on isHome and tap Add Value.
- Tap Boolean.
- Enter state as the Key. Tap Save.
iCloud Shortcut Import
You can click on the iCloud links below and directly import the Shortcuts. Only do this after you’ve installed and configured Data Jar. Do this on your iPhone, not Mac.
- HA Good Night (Home Assistant)
- HA Good Morning (Home Assistant)
- Sleep Toggle (Sets focus mode, calls AutoSleep, calls Home Assistant automations)
- Leave Home (Uses Data Jar, Triggered by a Personal Automation)
- Arrive Home (Uses Data Jar, Triggered by a Person Automation)
- AB Launcher Watch (Link to your Watch Action Button or Complication)
iOS Personal Automation Configuration
Relatively new to iOS is the ability to automatically run Shortcuts WITHOUT confirmation when arriving or departing a location. We will use that to automate the Data Jar “isHome” state tracking. Let’s setup Home arrival and departure automations:
- On iOS open the Shortcuts app and at the bottom tap on Automation.
- Tap on the + in the upper right.
- Tap Arrive. Next to Location tap Choose. If you are at home, tap Current Location. Tap Done.
- Tap Run Immediately. Tap Next.
- Locate the Arrive Home shortcut and tap it.
- Repeat the process, but select Leave and the Leave Home shortcut.
Home Assistant Configuration
Although I do use Apple Home on occasion, 99% of my home automation is done with Home Assistant. I setup two automations in Home Assistant, one called Master Bedroom – Good Night and Master Bedroom – Good Morning. I have the Shortcut calling a HA automation vs. just a HA scene. Why? I wanted the HA automation to only run if I was at home. So the automation condition tests if I’m home, and if I am, it then sets a HA scene to adjust the lights and blinds.
I also setup another Personal Automation in the Shortcuts app for Home Assistant. I setup an automation that is triggered when my wake-up alarm goes off. It calls the Sleep Toggle shortcut. This will run my HA Good Morning automation, which opens the window blinds and turns the lights on. Pretty cool!
Now that you’ve setup Data Jar and imported the Shortcuts, now it’s time to setup WatchOS to use the shortcut. As previously mentioned, if you have Apple Watch Ultra you can set the action button to call the AB Launcher Watch shortcut. Or, you can also setup a watch complication that launches the AB Launcher Watch shortcut as well, if you don’t have an Ultra watch. To set this up for the Apple Watch Ultra:
- Launch the Watch app on iOS.
- Tap on Action Button.
- Select the Shortcut action.
- Select the AB Launcher Watch shortcut.
- Tap Back.
If you want to use a complication instead, follow this procedure:
- Launch the Watch app on iOS.
- Select the watch face you want to modify.
- Locate a complication slot you want to use and tap on it.
- Scroll down to SHORTCUTS and select the AB Launcher Watch shortcut.
- Tap the back arrow in the top left.
Now when you tap the Apple Watch action button, or the complication, it will launch the Shortcut. Shortcuts are pretty slow on the watch (even Ultra 2), as I understand Apple relies on your iPhone for running the code and doesn’t process it locally on the watch. Sad, but ok. Takes 2-3 seconds for the menu to appear for me.
Troubleshooting Tip: If for some reason the Shortcut isn’t showing up on the watch, you can go into the iOS Shortcuts app, long press on the shortcut, tap Details, then toggle Show on Apple Watch.
Below are the three different menus that the shortcut will present, depending on the time of day and your location. The left one is when I’m away from the house, the middle one is at bed time, and the right one is when I’m home but not at bedtime.
I’m a tad OCD when it comes to organizing my Shortcuts. I would suggest the following Shortcut folder structure:
- Home Assistant – HA Good Night and HA Good Morning
- Action Button – Sleep Toggle and AB Launcher Watch
- Data Jar – isHome True and isHome False
- Location Based – Leave Home and Arrive Home.
If you want a bit more information about the details of the Shortcuts, keep reading. I’ll focus on Data Jar and Home Assistant details. For Data Jar, the Shortcut Arrive Home is a good example of how to set a Data Jar value.
The shortcut Arrive Home uses the Shortcut dictionary feature to set the key ‘state’ to the value of ‘true’ when arriving home. The Leave Home shortcut does the opposite, setting the value to ‘false’. The Data Jar function ‘set value’ is used to change the value in iCloud.
In the main watch shortcut it queries the isHome Data Jar, and if the state boolean value is set to true, then it will return a dictionary value of Yes. So my If statement tests if isHome is true, it then will run the portion of the shortcut that looks at the current time. If the time is between 20:00 and 24:00, then my bedtime menu will appear. If it’s outside of these hours another (non-bedtime) menu will be shown.
Apple Shortcuts can be a bit of a pain to work with, and when executing on the Watch, are pretty slow. However, they are very powerful with free shortcut addons such as Data Jar. Data Jar lets you permanently store Shortcut data in iCloud, which can be used across multiple shortcuts. It’s great for maintaining state data.
The Apple Watch Ultra has an action button, which you can link to a shortcut. In my shortcut example, it’s both location and time aware and conditionally shows different menus based on that data. This shortcut example should give you some ideas on how you can control what actions happen based on time, location, or both. Happy shortcutting!