Six Colors
Six Colors

by Jason Snell & Dan Moren

This Week's Sponsor

Save 20% on the award-winning Audio Hijack with coupon code 6C20AH!

By Dan Moren

Simple sleep tracking with Shortcuts

Note: This story has not been updated since 2020.

Sleep Timer

I found myself curious recently as to whether I was getting enough sleep. There are, of course, a bunch of different ways to track sleep on your devices, including many third-party apps. Apple itself has even added a Bedtime feature that lets you remind yourself when it’s time for bed, and set an alarm for when to get up, then logs the time in the Health app.

Having tried that for a while, there were a few things that frustrated me about the approach. The goal of the Bedtime feature is to have you go to bed and get up at the same time, and that’s not something that I can always control. It’s very inflexible and prescriptive in a way that I found annoying, to the point that I eventually just stopped using it.

What I really wanted was for iOS to be a bit more intelligent. For example, it could realize that when I turn off my bedside light (which is a HomeKit-compatible Philips Hue bulb) I’m going to bed. And then, when I pick up my phone in the morning it could log that I’m awake, and store the resulting information in the Health app.

Alas, that functionality doesn’t exist. So I made it myself using a pair of Shortcuts.

The Bedtime shortcut, which can be triggered via the Shortcuts widget or Siri, sets the Good Night scene, turning off my bedroom lights, and then stores the current time in a text file in iCloud Drive.

The I’m Up shortcut, which I manually trigger when I wake up in the morning, reads the bedtime from that text file, gets the current time, and logs both into the Health app, along with calculating the difference between the two and providing a notification about how long I slept.1 (Although the Get Time Between Dates action in Shortcuts sadly only lets you choose hours or minutes, and, in the former case, rounds it off.)

These Shortcuts are pretty simple, but they get the job done. On the off chance that other people are looking for something similar, I’ve included links above. The only alterations you’ll have to make are the HomeKit scene you want to set for Bedtime, if any. (You can also change the location or name for the bedtime text file; just remember to change it in both Shortcuts.)

Sleep well!


  1. When you log Sleep Analysis, it lets you choose whether this should be recorded as “Awake”, “In Bed,” or “Asleep.” Given that I can’t detect my sleep state, I went with the middle option. 

[Dan Moren is the East Coast Bureau Chief of Six Colors. You can find him on Mastodon at @dmoren@zeppelin.flights or reach him by email at dan@sixcolors.com. His latest novel, the supernatural detective story All Souls Lost, is out now.]

If you appreciate articles like this one, support us by becoming a Six Colors subscriber. Subscribers get access to an exclusive podcast, members-only stories, and a special community.


Search Six Colors