What your Apple Watch sleep looks like in Home Assistant
This is the level of detail you get for every night: total sleep, when you fell asleep and woke up, time in each sleep stage, and a stage-by-stage sleep chart, all from your Apple Watch and all inside your Home Assistant dashboard.
3h 05m restorative sleep — a strong foundation for today.
The Sleep and Sleep Details tiles, shown with example data. Get the tiles →
Home Assistant sleep sensors from your Apple Watch
Once sleep metrics are turned on in Health Assistant Link, each night becomes a set of Home Assistant sensors you can use anywhere:
sensor.sleep_duration_yourname: total time asleep, in hourssensor.sleep_deep_hours_yourname,sensor.sleep_core_hours_yournameandsensor.sleep_rem_hours_yourname: time in each sleep stagesensor.sleep_awake_hours_yourname: time awake during the nightsensor.asleep_time_yournameandsensor.wake_time_yourname: when you fell asleep and woke upsensor.sleep_details_yourname: a stage-by-stage history used to draw a sleep chart (hypnogram)
Fall-asleep and wake-up sensors also include a formatted clock time and seconds since midnight, which make templates and bedtime comparisons easy. See the documentation for every attribute.
Set up Apple Watch sleep tracking in Home Assistant
- Step 1: Install the free Health Bridge integration in Home Assistant through HACS.
- Step 2: Install Health Assistant Link on your iPhone and connect it to Home Assistant.
- Step 3: Turn on the sleep metrics you want and allow Apple Health access.
- Step 4: Install the Apple Watch app and add its moon complication to the watch face you wear to bed.
Sleep syncs as Apple Health records it, and the full night is complete once you wake up. The Watch app and complication keep heart rate and sleep flowing overnight while your iPhone is locked. See best results for the recommended settings.
Build a Home Assistant sleep dashboard
Health Bridge includes its own Sleep and Sleep Details cards. Find them in Home Assistant’s card picker; they detect your user automatically and need no HACS add-ons. Sleep Details draws last night’s stages as a sleep chart, just like the Health app.
type: custom:health-bridge-sleep-details-card
For more designs, copy the sleep tiles from the dashboard tiles page.
Home Assistant sleep automations
A morning sleep summary is a good first automation. It runs when a new wake-up time arrives:
automation:
- alias: Morning sleep summary
triggers:
- trigger: state
entity_id: sensor.wake_time_yourname
conditions:
- condition: template
value_template: "{{ trigger.to_state.state not in ['unknown', 'unavailable'] }}"
# Only once per morning, even if the wake-up time is refined later
- condition: template
value_template: "{{ this.attributes.last_triggered is none or this.attributes.last_triggered < today_at() }}"
actions:
- action: notify.mobile_app_your_iphone
data:
message: >
You slept {{ states('sensor.sleep_duration_yourname') | float(0) | round(1) }} hours,
with {{ states('sensor.sleep_deep_hours_yourname') | float(0) | round(1) }} hours of deep sleep.
Replace yourname with your user ID and the notify action with your own device. More ideas:
- Short-night reminder: if you slept under 6.5 hours, get a nudge to go for an afternoon walk.
- Bedtime drift: if your fall-asleep time keeps getting later, start your evening wind-down routine earlier.
- Morning briefing: have a voice assistant read last night’s sleep while you make breakfast.
- Lights-off at bedtime: for an instant trigger when you go to bed, use the Home Assistant app’s Focus sensor with your Sleep Focus, and use Health Assistant Link for what happened overnight.
My story: from 6.5 to 7 hours of sleep
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 wanted my sleep there too. The first thing I built was a way of seeing my sleep every morning without opening Apple Health: a dashboard on an LED display that shows how much I slept, and a voice assistant that gives me a quick summary while I’m making breakfast.
Then I added two simple 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 they work. Since I started, my average sleep has gone from around 6.5 hours a night to roughly 7 hours.
New to this? Start with the Apple Health to Home Assistant guide.