The Shortcuts app lets you create your own shortcuts with multiple steps that you can use with AutoSleep and many other apps and system services. You can use scripting so that the shortcut you create does different things based on your sleep data. This can includes all sorts of things, from playing selected music to setting a reminder to sending you a tailored notification. There's a good introduction to Shortcuts here.
Learn More about Shortcuts
There are some fantastic resources about shortcuts on the web. We think the best you will find is from Federico Vittici & his team at MacStories.
They also provide an in depth coverage of new apps with Shortcuts support and lots of Shortcuts news.
Each of the four main AutoSleep Siri shortcuts allows you to write a dictionary of key metrics to the clipboard.
The Shortcuts app can then read the dictionary and you can use these metrics in your shortcut scripts.
Time Asleep Shortcut
The Time Asleep shortcut includes the following:
"Recharge%": This is the percentage of your sleep goal that you met last night.
"Credit %": This is your sleep credit percentage according to your 7 day sleep bank.
"Debt %": Your sleep debt percentage according to your 7 day sleep bank.
"Sleep": The number of hours sleep that you had. This is in hours. So 7.75 = 7 hours and 45 minutes.
"Balance": The balance in hours of your 7 day sleep bank weighted average. This is also in hours. So 8.25 is 8 hours and 15 minutes.
"Start": The start time of your main sleep session.
"Until": The end time of your main sleep session.
Latest Bedtime Shortcut
The Latest Bedtime shortcut includes the following:
"LatestBedtime": This is the latest time you can go to bed and maintain a sleep bank credit. It is a formatted time string value. e.g. "10:30 pm". This format can be used to create reminders.
"Waketime": This is the estimated time that you most commonly wake up on the given day. This is also a formatted time string.
"TimeUntilBed": This is the number of hours until the latest bedtime. So 8.5 = 8 hours and 30 minutes.
"RequiredHours": This is the forecast number of hours sleep that you require in order to be in sleep bank credit. So 8.25 = 8 hours and 15 minutes.
Sleep Rings Shortcut
The Sleep Rings shortcut is based on the 4 AutoSleep rings and includes the following:
"Sleep%": The percentage that you have filled your sleep rings.
"Quality%": The percentage that you have filled your quality ring.
"Deep%": The percentage that you have filled your deep sleep ring.
"bpm%": The percentage that you have filled your bpm ring. 75% or higher indicates that your heart rate achieved a good quality nocturnal dip in sleeping heart rate versus your daytime non active, non sleeping average.
"Sleep": The number of hours sleep. This is in hours. So 7.75 = 7 hours and 45 minutes.
"Quality": The number of hours of quality sleep.
"Deep": The number of hours of deep sleep.
"bpm": Your average sleeping heart rate.
"SleepRating": The AutoSleep Sleep Rating that is displayed in the sleep ring section.
The Readiness shortcut is based on the daily readiness star rating, which considers waking HRV and waking pulse:
"Stars": The readiness star rating as a number to one decimal place.
"HRV": Your waking HRV reading in ms.
"bpm": Your waking pulse in bpm.
"BaselineHRV": Your 28 day average waking HRV in ms.
"BaselineWakingBPM": Your 28 day average waking pulse in bpm.
Using AutoSleep Dictionaries in the Shortcuts app
It's actually quite easy!
Create a new shortcut and add your chosen AutoSleep shortcut. In this example we will use Time Asleep. Turn off the show when run switch if you do not want the sleep graphics to display.
Add Get Clipboard.
In the Scripting option, add Get Dictionary From Input.
Now do something with the dictionary. In this example, lets display a local notification. So we will add Show Notification. When you touch the body of the notification, this will display your keyboard. Just above this is a row of things that you can select. You will notice one called Dictionary. Oddly enough, this lets you select and include values from the dictionary.
Let's type a message for our notification and include a value from the dictionary. So, in this case we typed "Today I slept" and then pressed the Dictionary button.
Now we just need to touch the Get Value for Key option. So lets enter the "Sleep" key. From above you'll remember that's the number of hours we slept last night.
Once we press OK you can see that the dictionary value has been placed in the notification. Let's add the word "hours" to round out the body of our notification message. Now we just need to press Done.
Now lets press the Play button to test our shortcut.
Here's the result. Just like that. A notification of how many hours we slept.
Now let's give this shortcut a name and decide how we want to run it. We do this by touching the icon below.
Here we can give our shortcut a name, change it's icon add it to Siri, show it in the Today View widget and much more.
Shortcuts with the Apple Sleep app
You can use AutoSleep with the Apple Sleep app, we have an entire page answering all the common questions on this here, so be sure to review this first. If using both AutoSleep and Apple Sleep, shortcuts can help with making AutoSleep available on the lock screen or showing your sleep stats at wake time.
Add AutoSleep to Lock Screen at Wind Down
When you set a sleep schedule in the Health app, you can run shortcuts from the Lock Screen of your device as you prepare for bed, which is handy if the Wind Down mode has been enabled. For example, we can setup AutoSleep as a shortcut to easily open the app when it's time for lights out.
Open the Health app on your iPhone.
Tap the Browse tab, then select Sleep.
Under "Your Schedule," tap Full Schedule & Options.
Under "Additional Details," tap Wind Down Shortcuts and then tap Add a Shortcut.
Scroll to the bottom and tap on 'Select an App From Your Library". Select AutoSleep from the list, then Open AutoSleep. You should see the image below once setup correctly.
When Sleep Mode is next active, you'll see a Shortcuts button in the centre of your Lock screen. Tapping this will allow AutoSleep to easily be open.
Add Existing AutoSleep Shortcuts to Lock Screen in Sleep Mode
When your device is in a scheduled sleep mode using the Apple Sleep app, you can setup any AutoSleep shortcuts to show on the lock screen. See below some existing AutoSleep shortcuts already setup. So when the Apple sleep mode locks my iPhone, I can still use 'Lights Off' to trigger AutoSleep from the locked screen, or when I wake up I can easily access 'Sleep Rings' to see how I slept.
Heres how to add them to show while in sleep mode:
Open the Shortcuts app
In My Shortcuts, find the AutoSleep shortcut already created and tap the little button with 3 dots (...) in the top right hand corner.
Tap a similar button blue button with 3 dots (...) also in the top right hand corner.
4. You will now see the option to enable 'Show in Sleep Mode' (see below the example for latest bedtime shortcut). Apply to this any of your AutoSleep shortcuts