Skip to content

[Feature] Add a Hypnogram to the sleep insights #1419

Open

Description

@kruemelro

Problem

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).

Activity

  1. added
    enhancement
    on Nov 19, 2026
  2. MBombeck commented on Nov 19, 2026

    @MBombeck
    Owner

    @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.

  3. MBombeck commented on Nov 22, 2026

    @MBombeck
    Owner

    @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.

  4. MBombeck commented on Nov 23, 2026

    @MBombeck
    Owner

    @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?

  5. added
    waiting-on-reporter
    on Nov 23, 2026
  6. kruemelro commented on Nov 24, 2026

    @kruemelro
    Author

    @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:
    sleepstages_garmin

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

    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:
    image

  7. MBombeck commented on Nov 24, 2026

    @MBombeck
    Owner

    @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.

  8. MBombeck commented on Nov 26, 2026

    @MBombeck
    Owner

    @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.

  9. MBombeck commented on Nov 28, 2026

    @MBombeck
    Owner

    @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

  10. kruemelro commented on Nov 30, 2026

    @kruemelro
    Author

    @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 :-)

  11. MBombeck commented on Nov 30, 2026

    @MBombeck
    Owner

    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.

  12. removed
    waiting-on-reporter
    on Nov 30, 2026
  13. kruemelro commented on Nov 30, 2026

    @kruemelro
    Author

    @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
    image

    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.
    image
    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

  14. MBombeck commented on Dec 1, 2026

    @MBombeck
    Owner

    @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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions