isSleepMode bug in new Vivoactive HR

I am trying to have my WatchFace display an icon when Sleep Mode / Do Not Disturb is enabled.

On the new Vivoactive HR, I don't think the usual isSleepMode method is working. My app, as well as all the other user apps, won't display the "moon" icon when Sleep / DND is entered.

The default Garmin WatchFaces all work correctly.
  • Former Member
    Former Member over 8 years ago
    Sleep Mode and Do Not Disturb are not the same setting. Sleep mode has been removed from all future devices, and access to the Do Not Disturb setting is planned for a future SDK update.
  • I am trying to have my WatchFace display an icon when Sleep Mode / Do Not Disturb is enabled.

    On the new Vivoactive HR, I don't think the usual isSleepMode method is working. My app, as well as all the other user apps, won't display the "moon" icon when Sleep / DND is entered.

    The default Garmin WatchFaces all work correctly.


    On the va-hr, there's no way to manually enter sleep mode (unlike the va, but like the 23x, for example). It uses your configured sleep and wake times for data sent to GC.

    That said, it also has "Do Not Disturb", which today, isn't exposed in the SDK.

    There is a tie between the two, in that during your configured sleep times on the va-hr, DND turns on (no vibrations while you're sleeping). But you can manually turn on and off DND (say you're in a meeting and don't want to get vibrations), so it's not a one-to-one match with sleep mode, as DND can happen for other reasons.

    What I did was actually write a little function called "mySleepMode()" that I "or'ed" with the standard isSleepMode.

    What "mySleepMode()" does, is get that it looks at your configured sleep time (it's in Profile), and returns true if the current time is between your "go to sleep" time and your "wakeup" time. So It'll show the sleep icon if the devices can do a manual "sleep mode" and that's on, and/or during your configured sleep time. (I actually did this back for the 23x devices, but works on the va-hr too)
  • Here's my code:

    function mySleepMode()
    {
    //var profile = UserProfile.getProfile();
    //var sleep=profile.sleepTime.value();
    //var wake=profile.wakeTime.value();
    var sleepMode=false;
    if(sleep==wake) { return sleepMode; }
    var nowT=Sys.getClockTime();
    var now=nowT.hour*3600+nowT.min*60+nowT.sec;
    if(sleep>wake) {
    if(now>=sleep || now<=wake) {sleepMode=true; }
    } else {
    if(now<=wake && now>=sleep) {sleepMode=true; }
    }
    ////Sys.println("t="+now+" "+wake+" "+sleep+" "+sleepDefault);
    return sleepMode;
    }


    The three lines I have commented out, are actually needed, but what I do is set "sleep" and "wake" in initialize(), as you don't need to set them each time the function is called, but for testing, just take off the //'s

    DND is different than "sleep mode", and if that gets exposed in the SDK, I'll probably add a new icon for it.
  • Sleep Mode and Do Not Disturb are not the same setting. Sleep mode has been removed from all future devices, and access to the Do Not Disturb setting is planned for a future SDK update.


    Ugh. Would be helpful if the simulator reflected this. As is, sleep mode works fine there.

    3 hours wasted.
  • Ugh. Would be helpful if the simulator reflected this. As is, sleep mode works fine there.

    3 hours wasted.


    It still works on a real va (and maybe the f3 as I think the brought back manual sleep mode there).

    It's like the simulator setting for "Activity Tracking". You can turn that on/off on a real va-hr and 23x, but not for the va.

    The settings in the sim allow you change things that might be available on the watch, but aren't device specific in what can be set.