• Hi everyone,

    I recently made the jump and got a Bangle.js 2. I'm very much enjoying it so far, especially thanks to the community support and apps, so thanks to everyone who contributed! It has practically all of the features I require from a smartwatch: lightweight, always-on display, long battery life, checked grocery/to-do list, some health tracking features, sliding clock-inspired watch face, mini-games and smart sleep alarm. A more general purpose workout tracking app is lacking for me (with a real-time timer, heart rate monitor and step count, and a summary of the workout afterwards). Maybe I'll also contribute by making such an app but with my limited coding skills, I'm not sure if it'll be possible :S

    More to the point, the smart sleep alarm (SleepPhaseAlarm or Sleep Log Alarm) particularly helped in my decision in getting the Bangle.js 2, as it is surprisingly rare to find on-device smart sleep alarms. Others like Sleep As Android require a companion phone app and drain battery. The only other smartwatches that I know have an on-device smart sleep alarm are TicWatch WearOS smartwatches. But as the Bangle.js 2 is more privacy focused, it's a more appropriate fit for me.

    However, unless I am mistaken (please correct me if I am!), the SleepPhaseAlarm or Sleep Log Alarm app only wakes you up at a specific interval before your actual alarm (rather than at any time within a range). For example, if my alarm is set for 8am, either of the smart alarm app will wake me up at 7:30 if I set the earlier wake time for 30min before the actual alarm.

    Other smart sleep alarm apps work differently as far as I know. If you set the smart wake-up interval for 30min, it will not wake you up at exactly 30min before the actual alarm. Rather, within 30min, the smart alarm will determine when you are in light sleep stage and will wake you up. This can be 30min, 17min or 6min before the actual alarm time. This makes sense to me as your sleep stage duration fluctuates and isn't necessarily 30min/20min/10min before your alarm.

    As such, I wanted to request if it would be possible to have such a smart wake feature for the SleepPhaseAlarm (or Sleep Log Alarm) that would wake you up within a set interval, instead of a specific earlier time. If such a feature already exists and I am not aware, my apologies! I'd appreciate any clarifications in the app use in this case.

    I hope that my request is clear and thanks for taking the time to read it!

  • Howdy! Afraid I can't answer your question but came here because I'm considering the Bangle.js 2 for this exact use case. Interested to know the answer.

  • I just read the README's of sleeplogalarm and sleepphasealarmand both describe the behavior you say you want. So it seems they should already implement it. 🙂

  • I can only speak about sleepphasealarm, but this is what should be implemented. Can you please open the sleepphasealarm download interface (save icon in the app loader) and post a screenshot of an example line plot where it woke you up early?

  • thanks for your reply! I've swapped to SleepLogAlarm but will reinstall SleepPhaseAlarm and track my sleep tonight and share the result tomorrow.

  • hmm, doesn't seem like the case for me, unless I have a very regular light sleep stage which is at the exact interval the early smart alarm period is set at :S

  • Maybe you can tweak some of the settings of sleeplog or sleeplogalarm to make it work better. But I have limited experience with the apps so I don't know.

    It might be worth it to file an issue on the espruino/BangleApps repo.

  • I've been using SleepPhaseAlarm for the last few days, and while it has woken me up (30min before my set alarm), it doesn't seem to have tracked the sleep data (the download data option in App Loader doesn't show any valid date)? I'll use it some more and see if the tracking shows on the app and share.

    1 Attachment

    • sleepphasealarm.jpg
  • uhm invalid date? Could you share your sleepphasealarm.json please? You can download it from the ide

  • Got it, looks like the json format written for dates changed in new firmware:

    require("Storage").writeJSON("test.json"­, new Date());
    ={ ms: 1710748136790.38647460937 }

    earlier it was saved in a format like this:

    >JSON.stringify(new Date())

    @Gordon Is that intentional? I don't see it in the changelog up to firmware 2v21

  • Well there were some changes to how writeJSON works, but it wasn't meant to have that effect. Sorry about that.

    Either way I guess it wouldn't have worked exactly as you might expect from the code (you wouldn't get a Date back when reading). Maybe you could change the code that writes to ensure you do (new Date()).toISOString() which should be backwards compatible?

    And I'll see if I can get a fix in for writeJSON

  • Just fixed.

    Just a note that you could pretty easily fix existing files - the ms field you see there is milliseconds, so pass that into the Date constructor and you're good.

  • Yea, already have fixed that locally, but not tested fully yet

    new Date(typeof timeStr === 'string' ? timeStr : timeStr.ms)
  • @tipans You should be able to view the sleep plots in the development app loader:

  • hey @user140377, thanks for the update! However, I've updated the app and the issue still persist. I'll try uninstalling and reinstalling and see if there's any luck. Thanks!

    1 Attachment

    • sleep alarm.png
  • You'll need to use the development app loader, that @user140377 linked to at https://espruino.github.io/BangleApps/?i­d=sleepphasealarm

  • Thanks! Just tried it and it looks... odd? I've deleted and reinstalled the app though. Will check again after a few more sleep cycles and update.

    1 Attachment

    • Screenshot_2024-03-21-17-21-09-727_com.android.chrome-edit.jpg
  • So I assume you set your alarm to 8:00. The question is why was the sleep tracking only started at 7:00? Did you set "Run before alarm" to only 1h?

  • Yes, that's correct as "run before alarm" is said to save battery. You don't recommend it for more accurate sleep tracking/wake up?

  • For debugging purposes a higher value helps, lets say 8h?

  • Noted! I'll set it to that, thanks!

  • Here's the one from last night. It still woke me exactly 30min before the set alarm. Is the graph informative to you regarding the app's behaviour?

    1 Attachment

    • Screenshot_2024-03-22-13-49-41-106_com.android.chrome-edit.jpg
  • Basically yes. It tells me that you were in state awake since 7:00 which is why it woke you up at 7:30. If it would wake you up later there is a risk for you falling into a deeper sleep state again.

    What confuses me is the long awake phase from approx. midnight to 4:00.

    You could do the following test

    1. Create an alarm at least 45 minutes into the future.
    2. Start sleepphasealarm and put the watch on a stable surface (table) and do not touch it
    3. Approx. 10 minutes before the alarm move the watch. The alarm should go off exactly when you move the watch.
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

[Request] SleepPhaseAlarm improved smart wake-up interval

Posted by Avatar for tipans @tipans