Fading lights?

I wasn’t sure where else to put this or how to ask this…but…

I’m sure there’s some IDE code that can be implemented to emulate the fading of a physical dimmer switch. Similar to the Gentle Wake Up SmartApp…for waking up, seems to work great, but you can easily see the steps, and sometimes it will skip a few percent and the fade isn’t perfect (guessing this is a network connection issue), you can easily see jumps.

Watching YouTube videos of other people SmartBulb set ups, I see nice smooth fading actions, are these features of the hubs? apps? smartapps (or similar)? hardware of the bulbs themselves? I have 2 OSRAM Lightify bulbs, and I just want them to always fade, every time. If they are turned off / 0%, and I set them to 50%, then fade from 0 to 50…if the bulbs are set to 80 and I set it to 30, then fade from 80 to 30.

I understand there will always be a minimum voltage required for the bulbs to be on, so you can’t dim to/from 0% perfectly…I’m just looking for nice SMOOTH fading from X% to Y%.

I use to have the WEMO hub, and it offered a sleep timer, and after X minutes, the lights would fade off, you could easily see the steps because it took something like 30 seconds to fade. I’m looking for more of a 1-2 second fade. I’ve recently watched some videos on the Phillips hue bulbs, and they were doing a demonstration, and they “told” the bulbs to dim, and they smoothly faded down (I guess they offer verbal actions now with their app or something).

What Osram bulbs? And what devicetype are they using (this can be found in the IDE on the device page)?

It’s a native feature of most zigbee bulb hardware. I usually use a 2 second fade for all my bulbs. Fading for set level commands should always work, but not all bulbs support fade for on/off commands.

Edited: I just checked and neither stock ST devicetype for those bulbs includes the fade parameter. You’d have to use a custom devicetype to enable it.

When I first added them to the hub, it set them to the generic “ZigBee White Color Temperature Bulb”, but then I changed them to the “OSRAM LIGHTIFY LED Tunable White 60W” device type.

So neither of these support fading? How do did you check if they have that? I have no problem going through the IDE code, or adding custom code. Also, now that I’ve set the color of the bulbs, as long as they retain their color setting, I would be okay with switching them to a device type that would support fading, even if I lose the ability to adjust color. Or maybe I could download the code for a mix and just merge the code where needed to support all.

Neither has it in the code. ST publishes the groovy code for most of their stock devicetypes and SmartApps on their public github repo, so you can see it and use them as examples.

You can try this custom devicetype. I wrote it for the Lightify bulbs before they were officially supported. I use a version of it still. I’ll try to update the code at the link to the latest when I get a chance, but this should be fully functional and fade for dim commands. (Don’t forget that custom code won’t run local on the V2 hub, so it will always make the cloud round trip and be non-functional without Internet)

1 Like

So I applied the device type, and played around with it, and I applaud you kind sir. I was especially suprised when I saw it also supported fading on color changes as well. Thanks!!! I’ll let you know if I have any issues, and maybe I’ll tinker with the code a bit. I’m still getting the hang of this groovy stuff.

No problem. The fade parameter is the last 4 digit part of the payload in the “st cmd…” line in either setColorTemp or setLevel.

It’s little endian hex format, so the 1500 in the setLevel is actually 0015 in hex or 21. The parameter is in tenths of a second, so it’s a 2.1 second transition time. That seems to have become a standard in smart bulbs in ST.

I chose longer for color temp transitions because it felt right in testing and looks cool.


Got it, perfect! I’ll have fun with this. haha

@Sticks18 I see how the fade works for going from color to color but is there a way to remove the fade when going on or off?


In @Sticks18’s device type, he only has commands in there for fading from one dim level to another, not for on/off, so it shouldn’t be fading on or off.

What bulbs are you using? If you are using the Osram bulbs, you could use this, to change your fade on/off times:
zigbee.writeAttribute(0x0008, 0x10, 0x21, 0x000A)

000A = 10 Tenths of a second = 1 second // OnOffTransitionTime

I believe if you set it to 0000 then it will just turn on/off like normal. But it’s been a while.

1 Like

One thing I recommend having that I did. I created a new function in my device type called SetDefaults. It sets my fade on/off times. I set mine to 1 second. I then have a Rule Machine trigger that sets my preferred color temp on all of my bulbs, and also runs the SetDefaults function. Then I have that trigger pointing at a Routine.

Whenever any of my bulbs settings get out of whack, I just run that routine. Usually this happens when a bulb loses power and comes back on and loses it’s settings.

Thanks for the good information. I will have to play around with this but hopefully it puts me on the correct track.

I am playing with a number of different handlers and trying to get it to behave the way I want using an Osram RGBW bulb.

Hello everybody, I’m new to the smart things community. I have a few Osram Tunable bulbs. Does anyone have a code that fades the light going from Off to On and vice versa?

EDIT: I just realized after reading the older comments that your question was already answered in a previous response from me. Be sure to read the older comments in the future. Especially short threads like this one. Longer threads I can understand not wanting to read the comments.

This is what I use. Keep in mind, the on/off transition time is not a function you use every time, it’s a setting on the bulb. So you set it one time and it retains that setting until it loses power, after which, it restores back to its default settings. I currently don’t know of any way to set persistent bulb settings.

In my device handler for the bulbs I created a new function called “SetDefaults” and it sets the bulb to my preferred bulb temp and it sets my preferred on/off transition time. I probably could have just as easily just added that code to the “Refresh” function instead of creating a new one, but I was trying to learn so that’s what I did. I then set up the SetDefaults custom function in Rule Machine and I have a trigger set up to run that function for all of my bulbs when a certain routine is run. That way any time I lose power to any of my bulbs, all I have to do is run that one routine and it fixes all of the on/off transition times and sets the bulbs back to my preferred bulb temp all at once. I’m sure there are better ways to do it, but oh well. haha.

Here ya go:
zigbee.writeAttribute(0x0008, 0x10, 0x21, 0x000A)

0x000A = 10 Tenths of a second aka 1 second. Change this to change how quickly it fades on or off.

1 Like

Sorry I missed that you had already answer this question in an older comments. but thanks for responding once again. I’m fairly new to this and dont know exactly where i should add the code you just gave me. Do you mind giving me a lil bit more details on what to do?

Hey there! I’m in the same boat you were 6 months back and have no idea where to stick the code. Did you ever figure this out?

No unfortunately I wasnt able to figure it out and just gave up:joy:

Well that’s less than awesome. I got some more findable whites in sale at Lowe’s this weekend. Found that in the Osram app, the new ones (same model number) keep their fade. Out of 15, I have 7 that only go on and off. Frustrating!!

Very frustrating indeed. I’m hoping with this new firmware update that will be fixed. I will try it out tonight see how it does

@maddmanj looks like the firmaware update fixed the fading. All my lights (GE Link, Osram RGBW, Osram Tuneable) now fade while turning on or off

Really!!? Did you switch the device handler back to the default? Mine are still just popping on and off…