AutoSleep. 
About the Apple Shortcuts app. 


What is it?

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.


How do I get it?

You can get it for free by clicking this link. 



Want to 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. 



Highly recommended! 



AutoSleep Dictionaries

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. 

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.  

Readiness shortcut

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. 


How do I use AutoSleep dictionaries in the shortcuts app?

It's actually quite easy! 

Step 1: 
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 Time Asleep Shortcut

Step 2: 
Add Get Clipboard. 

Get clipboard

Step 3: 
In the Scripting option, add Get Dictionary From Input. 

Get dictionary from input

Step 4: 
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. 

Show notification

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. 

Notification

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. 

Dictionary key entry

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.

Notification body.

Now lets press the Play button to test our shortcut. 

Play shortcut


Here's the result. Just like that. A notification of how many hours we slept. 

Notification


Now let's give this shortcut a name and decide how we want to run it. We do this by touching the icon below. 

Name it


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. 

Name the shortcut