Skip to content

Conversation

@RKBoss6
Copy link
Contributor

@RKBoss6 RKBoss6 commented Oct 7, 2025

Fixed bugs relating to HRM data being incorrectly pulled in and comparing with undefined.
This comes from the discussion at #4010, and has been tested by me and @ondras12345

From the looks of it, this also fixes #4012

Removed unnecessary whitespace and comments in health function.
@bobrippling
Copy link
Collaborator

bobrippling commented Oct 7, 2025

Not for this PR, but would you find it useful to have typescript check this code, to stop similar errors in future? I wouldn't mind making the change if so

@RKBoss6
Copy link
Contributor Author

RKBoss6 commented Oct 7, 2025

@bobrippling That would be good! Just a question: how does typescript checking differ from the checks that are already done?

@bobrippling
Copy link
Collaborator

@bobrippling That would be good! Just a question: how does typescript checking differ from the checks that are already done?

It'd be able to find typos such as object.propertyy that we might miss, or catch nulls and so on

@RKBoss6
Copy link
Contributor Author

RKBoss6 commented Oct 14, 2025

@ondras12345 Any updates from testing for you? For me it seems as though only deep sleep is being compared in consecutive sleep, and even when the light sleep Hrm threshold is 100, it does not register. Light sleep is still registered, but doesn't look like it is accurate. When the deep sleep threshold is 100 it works as expected and shows everything as sleep, as it should.

@ondras12345
Copy link

Sorry for the late reply.

For me it seems as though only deep sleep is being compared in consecutive sleep

That definitely isn't the case for me. E.g. today, it shows consecutive sleeping 9h 50min, true sleeping 9h 50min, deep sleep 5h 10min, light sleep 4h 40min. My HRM thresholds are 60 for deep sleep and 64 for light sleep.

@RKBoss6
Copy link
Contributor Author

RKBoss6 commented Oct 28, 2025

@ondras12345 can you try something out? Try setting the light sleep threshold to 100. Theoretically, it should report that you sleep all the time, but when I try it does not register. Changing deep sleep as stated is what works for me. Test that out...

@ondras12345
Copy link

You're right, it registers as awake when I set light sleep threshold to 100. Will experiment with this some more and let you know what I find.

@ondras12345
Copy link

I think this behavior is by design:
https://github.com/RKBoss6/BangleApps/blob/06fc36115835384bb4ccd2ad964398e63197a5d4/apps/sleeplog/boot.js#L230-L234

Light sleep is corrected to awake if it did not start with a deep sleep.

@RKBoss6
Copy link
Contributor Author

RKBoss6 commented Nov 2, 2025

Hmm, is that accurate though? From what I have researched, a daily sleep starts with light sleep, and then alternates between deep sleep and light sleep again. I'm tagging @storm64, the creator, to see what the decision behind this was.

@storm64
Copy link
Contributor

storm64 commented Nov 3, 2025

As the programming is some time ago I can't tell you what the decision process was, but I tried to document all behaviour and settings in the readme: https://banglejs.com/apps/?id=sleeplog&readme

@ondras12345
Copy link

I think it is working well enough. We should probably get this PR through so that users who update don't get a completely broken app. A change to the light sleep behavior can be added later if deemed necessary.

@RKBoss6
Copy link
Contributor Author

RKBoss6 commented Nov 4, 2025

True. I'll work on fixing checks so we can hopefully get this merged in.

@RKBoss6
Copy link
Contributor Author

RKBoss6 commented Nov 4, 2025

This looks good to go right now!

@thyttan
Copy link
Collaborator

thyttan commented Nov 4, 2025

Two review comments waiting for answers in the files view :)

@RKBoss6
Copy link
Contributor Author

RKBoss6 commented Nov 4, 2025

Should be resolved now

@RKBoss6
Copy link
Contributor Author

RKBoss6 commented Nov 11, 2025

This is good to go, so if we can merge this in, that would be great for users to fix the currently broken app :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SleepLog] Trigger returning undefined for prevStatus

5 participants