Skip to content

Only one sleep session per night is shown when the ring records several #63

Description

@Albabit

On a YCBT ring (Ale-Hop2211 E1C7, ColmiSmartHealthCoordinator), PulseLoop showed 4 h 06 of sleep for last night, 03:21 to 07:27. I went to bed around 23:30, so I read the ring's history directly with my Python client to see what it actually holds.

The ring recorded two sessions for that night :

SESSION 09-04 00:12 -> 03:18   declared 172 min
   light 2h04   deep 0h12   REM 0h46   awake 0h01
SESSION 09-04 03:21 -> 07:24   declared 196 min
   light 1h59   deep 1h05   REM 0h47

PulseLoop displayed only the second one. The first, three hours of it, isn't shown anywhere in the app. Combined they come to 368 minutes, so the night was about 6 h 08, not 4 h 06.

Why the ring splits a night :

I got up briefly during the night. The gap between the two sessions is three minutes (03:18 to 03:21), which fits. So this isn't a malfunction, it's the ring closing a session when it detects you're up and opening a new one when you settle again.

It isn't systematic either. Two nights earlier the same ring recorded a single unbroken session :

SESSION 09-02 23:57 -> 07:31   declared 356 min

So whatever picks a session works fine on nights with one, and silently drops the rest on nights with more.

Record layout, in case it's useful :

Sleep comes back as 05 13. Each session starts with an af fa header carrying declared minutes and the start and end timestamps, followed by 8-byte entries :

[stage(1)] [start(4)] [duration_seconds(3)]

Stages are 0xF1 deep, 0xF2 light, 0xF3 REM, 0xF4 awake. I validated that mapping against the vendor app's own display on an earlier night : it reported 1 h 27 deep, 4 h 18 light, 1 h 23 REM, matching my decode of the same night to the minute.

Worth noting the vendor app handles the multi-session case : it lists each session separately under "history record" and shows a combined total for the night.

What I'd expect :

All sessions for a night aggregated, with the total reflecting time actually asleep. Showing them separately as well would be a bonus, since a nocturnal wake is itself information, but the total is the part that's wrong today.

Happy to pull raw dumps of any night you'd like to see, or to test a build.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions