[OBSOLETE] Gentle Wake Up

@steve_vlaminck clear as mud right now, but I’m sure it will make more sense once I’ve read through your code in depth.

Looking at the device events, if I could differentiate that the source is DEVICE and switch value is off then i would know if the physical device gave the off or on command and could act appropriately in the code.

perhaps something like

def installed() {
    subscribe(dimmers, "switch.on", interruptHandler)
    subscribe(dimmers, "switch.off", interruptHandler)
}

def interruptHandler(evt) {
     if ( dimmers.currentValue("source") == "DEVICE" ) {
        stop()
    }
}

Good call on the event source. I often forget about that.

I’ve actually been assigned another bug in Gentle Wake Up so I’m looking at the code right now. I think you can solve this by adding subscribe(dimmers, "switch.off", manualDimmerHandler) to the end of initialize(), and then below that add the method:

def manualDimmerHandler(evt) {

   if (!atomicState.running) {
       	return // only stop if we're actually running
   }

   if (evt.source != "DEVICE") {
       	return // only stop if a physical device sent the event 
   }

   stop()

   if (direction == "Down") {
       	down(100) // jump to the end of the cycle so all the lights shut off
   }

}

Your subscribe would only handle the off condition correct? Would adding both subscribes be necessary or just subscribe to “switch”?
I also dont see direction as a value in the event

You can just subscribe to “switch”, but you’ll need to check if (evt.value == "on" || evt.value == "off") { ... } because otherwise you might get some poll events in there or something.

direction is in preferences, not the event

Alright, code is in, Ill test when i get home tonight!

Unfortunately no luck with the above code. Tested it and the routine kept going even after sending the on and off signal at the physical switch.

Is the code for Gentle Wake Up available for user modification? I would like to implement a dim up to X% over X amount of time. We are waking up at around 50% brightness and would like to keep the light at this level instead of continuing to 100%. Would also like to implement the local on/off at the switch that interrupts the Wake Up app as others have mentioned. Otherwise love the implementation and thank you!

@Brian_Solomon, Absolutely! If you update it, I can help you get it published.

Also, sorry for not responding sooner

I’m with @Brian_Solomon on this. I’d love to be able to dim up, or down to a specific level.

Also, I’ve noticed that when dimming down, the lamp jumps up to 99 then works down from there. Kind of a problem if your lamp is at 40 when you start.

I’ve poked at the code a bit, but I’m new to smartthings and only half know what I’m looking for.

@Brian_Solomon and @Dotknott,

I have a working version that allows you to set where to start the dimming and where to stop the dimming. So instead of only allowing your dimmers to go from 0-99 or 99-0 you can specify 30-50 or 99-60 if you want to.

I also added the ability to start dimming from the current level of your dimmers. So if your dimmers are at 50 and Gentle Wake Up is set to dim from the current level down to 0 over 30 minutes, it would do just that instead of jumping to 99 and then dimming down to 0. This also works for dimmers at varying levels. Say you had dimmer A at 75 and dimmer B at 40. Dimmer A would go from 75 to 0 and dimmer B would go from 40 to 0, both taking the entire 30 minutes to do so.

I’ve been testing this version for a while now and will submit the changes, but it’ll be a little while before this version gets published for everyone. I’ll update this thread when it’s out there.

1 Like

Steve, This sounds like it’s exactly what I was hoping for! I can’t wait!

Looking forward to the update @steve_vlaminck and @Dotknott!

Hey everyone,
The latest version of Gentle Wake Up was published last night so be on the lookout for bugs ;). If you happen to find any, feel free to call me out here and I’ll get them fixed as fast as possible.

I’ve moved the dimming logic into a separate page to help simplify setup. Here are the first page and the dimming page:

The default behavior is to dim from 0% to 99% over a 30 minute duration. Here I have it set to dim from the Current Level to 99%. To do this, all you have to do is clear out the From this level setting. If you don’t supply a From this level setting Gentle Wake Up will just start from wherever your lights are currently at. Be aware that if your light is off, it has a current level of 0%. So if you are expecting it to turn on and dim down, it won’t happen. It’ll dim from 0-0 over the duration you chose. It’s a weird scenario, and I’m still thinking about ways to improve it. Let me know if you have any suggestions.

Next on my list of things to do is a major code refactoring. With the latest changes, I fear I made it even harder to read, and it wasn’t really the most straight forward app to begin with. I feel like if I clean it up and add a lot of documentation, it would be more accessible for other developers.

Anyway, let me know what you think of the new version, and if you have any suggestions to further improve Gentle Wake Up.

Thanks,
Steve

Hi, I’ve read through this string and was interested in the idea to kill the process when the particular switch being dimmed is turned off. Is this still possible? I don’t think it’s done that for me in the past. I just tried removing then reinstalling the app from Smart Setup so I’ll test it out tomorrow morning. Sometimes I wake up before it’s dimmed all the way up and it would be nice to kill the process at that point instead of having to wait it out.

Currently this app is keeping the last colors of my Hue lights, is there a way to tweak the code to allow for a specific color to be selected? Even hard coding the colors would be great! Thanks!

I’m using the app with a GE Link and it kinda works…

When it starts, the light turns on 100%. Dims to like 40ish and goes up as planned from there

Does anyone have a link to this code? I can’t figure out how to get to it since I know ST changed things around last year.

How would one create an additional instance of this? I want different times for my wife and I and our daughter.

I never did find the original code so I had to write my own. I included one additional feature that I have yet to see anyone do - the ability to detect if someone manually dimmed the lights… up or down. If that happens, then stop automatically dimming.

I’m still double checking to make sure things are working correctly. So far, it seems like the lights dim properly in the morning and then again at night.

For yours, just use the presence sensor on their phones. If wife then… else if daughter… then …

Seems pretty easy to do.

1 Like

Could you share this code @DrHill, this is exactly what I came looking for…