I’ve tracked my sleep with my Apple Watch for years, but I never really did anything with the data. Every now and then I’d open Apple Health, see I’d only slept six and a half hours, think “I should probably get more sleep,” and then forget about it five minutes later.
Because I already run Home Assistant, I thought it’d be interesting to see what I could do if my sleep data was available there as well.
How I got the sleep data into Home Assistant
I use Health Assistant Link to bring my Apple Health data into Home Assistant. It exposes things like:
- Sleep duration
- Deep sleep
- Light sleep
- Awake time
- Fall asleep time
- Wake up time
Once they’re in Home Assistant, they’re just sensors, so I could use them anywhere.
The first thing I wanted was a way of seeing my sleep every morning without having to open Apple Health. I built a dashboard on an LED display that shows how much sleep I got the night before, and I also have a voice assistant that gives me a quick summary while I’m making breakfast.
Building a few automations
Once I had the data in Home Assistant, I started using it in a couple of automations. If I haven’t had enough sleep, Home Assistant reminds me to go for a walk the next afternoon so I’ll hopefully sleep deeper the next night. And if my fall-asleep time has been getting later, it starts my evening wind-down routine a bit earlier.
They’re both pretty simple, but I’d say they work. Since I started doing this, my average sleep has gone from around 6.5 hours a night to roughly 7 hours.