Sleep Widget
Analyze last night's sleep in a widget
Description
I have been using this shortcut as a supplemental tool to track and analyze my sleep. It works well enough and is kind of fun so I decided to share it.
The Charty app is not required but functionality is very limited without it.
- Install Charty
- Run the shortcut
- Create a Charty widget with the new chart
- Configure the new widget to launch the "Sleep Widget" shortcut
Let me know if you run into problems.
Additional sleep charts are available with the Sleep Charts shortcut.
And check out my Heart Widget and Daily Dashboard shortcuts for Charty.
Notes:
- Requires Apple Health-compatible sleep tracker
- Works with multiple sleep sources
- Tested with Apple Watch, Oura ring and AutoSleep app
- The legend is not supported. Do not enable it.
- Set your widget to use a dark background for the best experience.
- Icons by MenuBox
Automation
You can automate this shortcut with two actions: a Dictionary action and a Run Shortcut action.
- The Dictionary action should have a "ReportDate" value with the date you want to analyze.
- Use the dictionary as input for a Run Shortcut action that runs "Sleep Widget."
See the example below.
Running this shortcut will update the chart in the background.
Optional Input
In addition to ReportDate, the following input values are supported.
Enter a value of 1 to enable or 0 to disable.
- Notifications -- Enable or disable notifications
- ShowReport -- Bypass or view the report screen
- Charty -- Enable or disable Charty updates
- Springboard -- Enable or disable returning to Springboard
- Background -- Enable or disable blue chart background
Output
The Sleep Widget shortcut will also return a dictionary with the following values.
- Image -- Base64 encoded chart image.
- Markdown -- Base64 encoded sleep report in markdown format
- HTML -- Base64 encoded report in HTML format (with chart)
- SleepBegin -- Time which sleep began
- SleepEnd -- Time which sleep ended
- SleepMinutes -- Total sleep in minutes
- AwakeMinutes -- Time awake during the primary sleep session
- RestlessMinutes -- Duration of restless sleep during the primary sleep session.
- LightMinutes -- Duration of light sleep during the primary sleep session.
- RestfulMinutes -- Duration of restful sleep during the primary sleep session.
- NapMinutes -- Total nap time in minutes
- HeartAvg -- Average heart rate for the primary sleep session
- HeartMin -- Minimum heart rate for the primary sleep session
- HeartMax -- Maximum heart rate for the primary sleep session
- NoiseAvg -- Average decibels for the primary sleep session
- NoiseMin -- Minimum decibels for the primary sleep session
- NoiseMax -- Maximum decibels for the primary sleep session
- SleepCount -- Number of sleep segments total
- AwakeCount -- Number of awake segments in the primary sleep session
- NapCount -- Number of naps
Use Cases
You can use the data returned from Sleep Widget to build your own shortcuts.
For example, I have a shortcut that runs Sleep Widget and then saves the results to my DayOne journal every morning.
I have another shortcut which calls SleepWidget and then uses the results to create a WidgetPack widget like the one below.
Latest Release Notes
0.6.4 - March 24, 2021, 2:49 p.m.
*Fixed*
- Minor fixes for infrequent error conditions
Version history
Feedback
Log in or sign up to leave feedback.
· 1 year, 4 months ago
· 1 year, 4 months ago
· 1 year, 4 months ago
· 1 year, 3 months ago
· 1 year, 3 months ago
· 1 year, 3 months ago
· 1 year, 3 months ago
· 1 year, 3 months ago
· 1 year ago
· 1 year ago
· 1 year ago
· 11 months, 3 weeks ago
· 11 months, 3 weeks ago
· 8 months, 1 week ago
· 7 months, 1 week ago