You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Add a Hypnogram to the sleep insights #1419
It would be a great addition to have a hypnogram to view your sleep stages.
The data allready comes through some integrations. For others it could be saved with the batch API Endpoint.
Its also a great way for deep insights and correlations for other data (Room Temperature, HRV, HR, Breathing)
Proposed solution
Add a Hypnogram on the sleep insights Page
Alternatives considered
No response
Affected surface
Web (PWA)
Additional context
No response
Pre-flight checks
I confirmed this is not a duplicate of an existing feature request.
I'm proposing a feature, not asking a usage question (those go to Discussions or the docs).
@kruemelro Good idea. The data is already there: the night endpoint returns the stage segments, the sleep page just only draws them as a stacked bar. A hypnogram is a UI change on top, so it's a candidate for the next minor rather than the patch. I'll keep this open for it.
@kruemelro The hypnogram is on the branch for 1.49.0 and ships with that release. The sleep page opens with a night timeline: each stage drawn over the clock, Awake on top and Deep at the bottom, and you can step back through the nights. WHOOP and Polar only report stage totals, so for their nights the page says so instead of drawing an order it would have to make up. Once 1.49.0 is merged, the :edge image has it too.
The sleep page opens with the night timeline, each stage drawn over the clock, and you can step back through earlier nights. For WHOOP and Polar, which only report stage totals, the page says so instead of drawing an order it would have to make up. Does it look right with your nights?
@MBombeck Thank you very much for your great work!
I deployed 1.49.0 and tested the new feature. There is a little Bug in it. The Hypnogram renders even there is no data available which gives a little confusing view.
In my example i have 1 data sources with 2 ways into healthlog. I use the garmin integration of healthlog directly and i connected garmin with apple health and this with healthlog.
The way with apple health is slower (its not dependend to healthlog, its the connection between garmin and apple health). Cause Apple health getting the real sleep phases from garmin and the garmin integration only gets the total sleep values, i've got a good comparison.
The first screenshot shows the data of the garmin integration. It gets the lenght of each phase, but no details:
The second screenshot shows the same night after the apple health sync has been run:
In Addition it would be great to have a possiblity to show other sleep related metrics as a layer over the hypnogram. I'm thinking about pulse, hrv, respiration rate, room temperature, etc, shown as a line chart.
This is how garmin connect shows it to get a idea what i mean:
@kruemelro Thanks for testing it so quickly, and for the side-by-side screenshots. Having the same Garmin night once as totals and once with real phases made the cause easy to see.
The page only knew that WHOOP and Polar report stage totals, so a Garmin night from the direct integration was drawn as if its totals were a timeline. It now decides from the data itself whether a night has ordered phases, for every source. A totals-only night shows the totals and no made-up order, and when the same night also arrives through Apple Health with real phases, that version is the one drawn. The fix is on main and in the :edge image now, and it ships with 1.50.0 on Saturday, 5 December.
The overlay idea (pulse, HRV, breathing rate and room temperature as lines over the hypnogram) is a good one. It needs some care to line the readings up with the phases, so it won't make 1.50.0, but I've written it down for a following release.
@kruemelro Good news, and a correction to what I wrote on Tuesday: the overlay made 1.50.0 after all. It ships on Saturday, 5 December.
Under the night timeline there is a toggle for each metric recorded that night: pulse, HRV, breathing rate, SpO2, skin temperature and room temperature. Up to two of them are drawn as lines over the stages, and pointing at or tapping the chart shows the stage and each line's reading at that moment. A metric that only comes as one value per night, like HRV from the Garmin integration, is listed as a number under the chart instead of a curve. Lines only join readings that are close in time, so something measured about once an hour shows as points rather than a line across hours nobody measured. The lines you pick are saved with your account.
A night of stage totals has no times to lay the lines against, so it shows none. In your setup that means the nights that come through Apple Health with real phases are the ones to look at.
If you want to try it before the 5th, the :nightly image is built from the 1.50 branch: set HEALTHLOG_IMAGE_REF=:nightly, details in docs/self-hosting/channels.md. Please use a test instance or take a dump first, because there is no way back from a nightly to 1.49 without restoring one.
One more date fix: the totals-only hypnogram fix from my last comment is on main and comes earlier than I said, in 1.49.1 on Saturday, 28 November.
It has the fix for what you spotted: the night timeline is only drawn for a night whose stages were recorded in order, so a Garmin night that arrives as one total per stage no longer gets a made-up timeline. The overlay toggles follow in 1.50.0 next Saturday. Refs #1419
@MBombeck I just tested 1.49.1 and can confirm it works!
Looking forward to 1.50.0. If i find the time, i will duplicate my instance with the :edge image :-)
Thanks for checking, @kruemelro, good to hear the Garmin nights look right now. One small pointer if you do spin up a copy: the overlay toggles live on the :nightly image, not :edge. :edge only carries the fixes between releases, while :nightly is what's lined up for Saturday. Either way I'll ping you here once it's out.
@MBombeck i spinned up a complete dev environment with a full copy of my data. and the :nightly image
The overlay technical works, but i've have some minor findings.
The Overlay also renders values which doesn't have data for the full range of the sleep. I think thats ok, but a little hint would be usefull
Cause Garmin only provides the daily totals and my HomeAssistant automation gets only single values (as you can see in the screenshot above), i created a little importer for the full range of data.
What i'm missing here is the scala of the overlay graphs. My suggestion here is to display max 2 scales on the right side, each in the color of the graph. This would improve the readability of the lines
P.S. I really like the new theme and design changes! <3
@kruemelro thanks for running a full copy against :nightly, that's the best test I could ask for, and the importer for the full range is a nice touch.
On the sparse values: I'd rather let the chart show it than add a hint. A line only connects readings that are close together, so a value that only exists at a few moments of the night shows as separate points with gaps in between. That's what your first screenshot shows: the lone dot is a single SpO2 reading, and the short stroke joins two readings about a quarter of an hour apart. Nothing gets drawn across the stretches nobody measured, so you can see at a glance how thin it is.
The scales are in: each overlay line now gets its own scale on the right, in the line's colour, with the unit on the top value. Two at most, the same as the overlay limit. That ships with the next release, most likely on Saturday.
Thanks again, this is exactly the kind of detail that only shows up with real data.
Activity
MBombeck commentedon Nov 19, 2026
@kruemelro Good idea. The data is already there: the night endpoint returns the stage segments, the sleep page just only draws them as a stacked bar. A hypnogram is a UI change on top, so it's a candidate for the next minor rather than the patch. I'll keep this open for it.
MBombeck commentedon Nov 22, 2026
@kruemelro The hypnogram is on the branch for 1.49.0 and ships with that release. The sleep page opens with a night timeline: each stage drawn over the clock, Awake on top and Deep at the bottom, and you can step back through the nights. WHOOP and Polar only report stage totals, so for their nights the page says so instead of drawing an order it would have to make up. Once 1.49.0 is merged, the
:edgeimage has it too.MBombeck commentedon Nov 23, 2026
@kruemelro The hypnogram is in 1.49.0, out tonight: https://github.com/MBombeck/HealthLog/releases/tag/v1.49.0
The sleep page opens with the night timeline, each stage drawn over the clock, and you can step back through earlier nights. For WHOOP and Polar, which only report stage totals, the page says so instead of drawing an order it would have to make up. Does it look right with your nights?
kruemelro commentedon Nov 24, 2026
@MBombeck Thank you very much for your great work!
I deployed 1.49.0 and tested the new feature. There is a little Bug in it. The Hypnogram renders even there is no data available which gives a little confusing view.
In my example i have 1 data sources with 2 ways into healthlog. I use the garmin integration of healthlog directly and i connected garmin with apple health and this with healthlog.
The way with apple health is slower (its not dependend to healthlog, its the connection between garmin and apple health). Cause Apple health getting the real sleep phases from garmin and the garmin integration only gets the total sleep values, i've got a good comparison.
The first screenshot shows the data of the garmin integration. It gets the lenght of each phase, but no details:

The second screenshot shows the same night after the apple health sync has been run:

In Addition it would be great to have a possiblity to show other sleep related metrics as a layer over the hypnogram. I'm thinking about pulse, hrv, respiration rate, room temperature, etc, shown as a line chart.

This is how garmin connect shows it to get a idea what i mean:
fix(sleep): draw the night timeline only for a recorded stage order
MBombeck commentedon Nov 24, 2026
@kruemelro Thanks for testing it so quickly, and for the side-by-side screenshots. Having the same Garmin night once as totals and once with real phases made the cause easy to see.
The page only knew that WHOOP and Polar report stage totals, so a Garmin night from the direct integration was drawn as if its totals were a timeline. It now decides from the data itself whether a night has ordered phases, for every source. A totals-only night shows the totals and no made-up order, and when the same night also arrives through Apple Health with real phases, that version is the one drawn. The fix is on
mainand in the:edgeimage now, and it ships with 1.50.0 on Saturday, 5 December.The overlay idea (pulse, HRV, breathing rate and room temperature as lines over the hypnogram) is a good one. It needs some care to line the readings up with the phases, so it won't make 1.50.0, but I've written it down for a following release.
MBombeck commentedon Nov 26, 2026
@kruemelro Good news, and a correction to what I wrote on Tuesday: the overlay made 1.50.0 after all. It ships on Saturday, 5 December.
Under the night timeline there is a toggle for each metric recorded that night: pulse, HRV, breathing rate, SpO2, skin temperature and room temperature. Up to two of them are drawn as lines over the stages, and pointing at or tapping the chart shows the stage and each line's reading at that moment. A metric that only comes as one value per night, like HRV from the Garmin integration, is listed as a number under the chart instead of a curve. Lines only join readings that are close in time, so something measured about once an hour shows as points rather than a line across hours nobody measured. The lines you pick are saved with your account.
A night of stage totals has no times to lay the lines against, so it shows none. In your setup that means the nights that come through Apple Health with real phases are the ones to look at.
If you want to try it before the 5th, the
:nightlyimage is built from the 1.50 branch: setHEALTHLOG_IMAGE_REF=:nightly, details in docs/self-hosting/channels.md. Please use a test instance or take a dump first, because there is no way back from a nightly to 1.49 without restoring one.One more date fix: the totals-only hypnogram fix from my last comment is on
mainand comes earlier than I said, in 1.49.1 on Saturday, 28 November.feat(sleep): draw the night's stage timeline on the sleep page
test(day): list the night timeline among charts that open no day
MBombeck commentedon Nov 28, 2026
@kruemelro 1.49.1 is out: https://github.com/MBombeck/HealthLog/releases/tag/v1.49.1
It has the fix for what you spotted: the night timeline is only drawn for a night whose stages were recorded in order, so a Garmin night that arrives as one total per stage no longer gets a made-up timeline. The overlay toggles follow in 1.50.0 next Saturday. Refs #1419
kruemelro commentedon Nov 30, 2026
@MBombeck I just tested 1.49.1 and can confirm it works!
Looking forward to 1.50.0. If i find the time, i will duplicate my instance with the :edge image :-)
MBombeck commentedon Nov 30, 2026
Thanks for checking, @kruemelro, good to hear the Garmin nights look right now. One small pointer if you do spin up a copy: the overlay toggles live on the
:nightlyimage, not:edge.:edgeonly carries the fixes between releases, while:nightlyis what's lined up for Saturday. Either way I'll ping you here once it's out.kruemelro commentedon Nov 30, 2026
@MBombeck i spinned up a complete dev environment with a full copy of my data. and the
:nightlyimageThe overlay technical works, but i've have some minor findings.
The Overlay also renders values which doesn't have data for the full range of the sleep. I think thats ok, but a little hint would be usefull

Cause Garmin only provides the daily totals and my HomeAssistant automation gets only single values (as you can see in the screenshot above), i created a little importer for the full range of data.

What i'm missing here is the scala of the overlay graphs. My suggestion here is to display max 2 scales on the right side, each in the color of the graph. This would improve the readability of the lines
P.S. I really like the new theme and design changes! <3
MBombeck commentedon Dec 1, 2026
@kruemelro thanks for running a full copy against
:nightly, that's the best test I could ask for, and the importer for the full range is a nice touch.On the sparse values: I'd rather let the chart show it than add a hint. A line only connects readings that are close together, so a value that only exists at a few moments of the night shows as separate points with gaps in between. That's what your first screenshot shows: the lone dot is a single SpO2 reading, and the short stroke joins two readings about a quarter of an hour apart. Nothing gets drawn across the stretches nobody measured, so you can see at a glance how thin it is.
The scales are in: each overlay line now gets its own scale on the right, in the line's colour, with the unit on the top value. Two at most, the same as the overlay limit. That ships with the next release, most likely on Saturday.
Thanks again, this is exactly the kind of detail that only shows up with real data.
Refs #1419