Sunrise effect

Hello experts,

first i have to thank aircookie and involved developers for the phantastic work.
My first wled project is up and running without any problem.
Now my idea.
I’ve build a while ago a sunrise alarm clock with the fastled-sunrise.ino by jasoncoon
It would be a great idea to implement it in wled.
But i have no idea where to integrate the different parts of the code. :thinking:
My programming skills are not the best, but i am on the way.
Maybe sombody can give me some brain input, where to start. :wink:



Hi @borrmi, you can do this with WLED right now.

Please try the “sun rise” feature of the NightLight for this.
Sun Rise is like Nightlight but with additional color-transition from the primary to the secondary color.
paste this string to one of the macro slots:


It does the following:

  • &FX=0 … set the Effect to “Solid Color”
  • &CL=hFF8C00 … set the primary color to Redish
  • &C2=hFFC28C&W2=255 … set the secondary color to a warm white (change this if you do not have a dedicated white color channel)
  • &A=5 … set the starting brightness to 5 (about 2%)
  • &NT=255 … set the target brightness to 255 (100%)
  • &NL=20 … set the transition time to 20 minutes
    &NF=2 … set Nightlight to “On with color transition”

Is this what you’d like to have ?


Thanks @Def3nder! Sounds good! I’ll try it asap!

the code looks good but it does not run. color transition stops at a light orange, the w2-channel do nothing. I tested it on a wemos D1 mini with a ws2812b GRBW Strip

Oh sorry, I did not know that you work with 5CH LEDs.

Yes, the 5-channel Colors are only a quick work-around for getting the right color in combination with Alexa.

So exactly 5 RGBW combinations (and only these RGBW values) are “converted” to RGBW+W2.

I work on implementing a new color model where RGBW and RGBW+W2 are both supported and mixed avvording to the desired color temperature.

Once ready Frenck will adapt the WLED integration in Home Assistant.

…until then this only works correctly without 5CH support :cry:

@Def3nder you missunderstood . I’ll tried with a 4 ColourStrip R G B W ! But the G and R Channel are changed.
The W Channel do nothing and the RGB Channels stay static when they reached “orange” .

Hi @borrmi,

the RGBW analog strips are usually coded RGWB - so you need to connect the right PINs to the strip.
One question: is the strip displaying “normal colours” with separate white channel when using without the sunrise effect ?

@Def3nder without the effect every selected colour and warmwhite are displayed correct.and ofcourse the strip is a digital one with (V+, GND) and the Data in connected to pin D4 on a wemos D1 mini.

Hi @borrmi,

hmmm - that’s interesting - the color fade during nightlight does the following:
when initialized:

for (byte i=0; i<4; i++) colNlT[i] = col[i];   // remember starting color

…during fade:

if (nightlightColorFade)  
       for (byte i=0; i<4; i++) col[i] = colNlT[i]+ ((colSec[i] - colNlT[i])*nper);

So all four colors will be linear faded from the actual color (saved to colNIT[]) to the secondary color (colSec[]).

So I do not see where other colors could be displayed…

@Def3nder I tested and double checked every parameter of the macro.
The result: The &W2=255 do nothing. I also tried &W=xx with the same effect. Nothing. :angry:

Hy @Def3nder , it’s possible to use 3 segments and put a segment like sun in the middle? If you have an 100 LEDs the sun will be like 20-30 LEDs in the middle. Thanks :smile:

Hi @borrmi,

hmm - I now remember that I had similar issues with “W=…” parameter.

The way I solved this is that I coded the color itself “CL=…” and “C2=…” as 4-byte value with the order W,R,G,B.

My son has a transition from dark red to yellow within 10 minutes and this is the macro (it’s a normal RGB strip without white channel):

- The corresponding color is 255,0,0 (W=0) with brightness 5 (A=5)
- the target color is 255, 177, 74 (W2=0) with target brightness 255 (NT=255)
- transition time 10 minutes (NL=10) - be aware: this is remebered 
  and does override the value in the LED-settings -> Timed Light -> default duration.
  I use another macro the turn-off the light an hour later and reset this value:

My daughter does not like the red-to-yellow transition and she has an analog RGBWW strip - this is the macro:

- The corresponding color is 0,0,0 (W=255) with brightness 5 (A=5)
- the target color is 0,0,0 (W2=255) with target brightness 255 (NT=255)

I first tried this with 3-byte values for “CL=…” and “C2=…” and “W=…” + “W2=…” but that did not work.
With the above you include the “W=…” value as first byte of the “CL=…”

Does this work for you ?

1 Like

Hi @Mariu86, hhmmm - that could be possible - however, you need to select this segment first to control this with the macros and the NightLight Effect does influence the whole strip … don’t know for sure right now.

@Aircoookie: what do you think: when dealing with multiple segments how does this work together with nightlight ?

Sounds like a possible solution. Thanks you!
I’ ll try it soon and give a report of the results.
First I have to calculate my colour values.

I found no usable colour calculator for RGBW to 4 bit HEX. :cry:
Any idea how i can setup my CL= dark red with 0% W and C2=light orange with 50% W ? :crazy_face:

Hi @borrmi,

yes, just calculate the RGB values as hex (100% red = FF0000) and then add the white value up-front.
So 100% red without white = 00FF0000. For the API you need to add h in front, so this becomes CL=h00FF0000 (and remember to use capital letters and a non-capital h).
This is the color only - the brightness is separated from this in the A=... value.
A light yellow could be FCBA00, adding 50% white is 128 = 80 hex, so it becomes C2=h80FCBA00.

So the macro line with effect “solid” and a transition of 10 minutes would be:


or you choose 100% white and 50% brightness - this would be:


(I would do the second).

@Def3nder: The result after the first macro --> nice orange but no white!
first macro
the second is the same
second macro
The white channel slider stays at 0% :cry:

Hi @borrmi, hmmm - there must be something configured that prevents this.

What are the LED-settings for RGBW ?

LEDs are 4-channel type (RGBW): should be turned on
Auto-calculate white channel from RGB: should be set to none

Hi @Def3nder,

that is my configuration.
LED 4-ch. and auto-white is off.
Thats the point,where i am out, because your macros are right and easy to understand.
Sometimes computers going strange ways! :wink:

Stay healthy, stay at home

Hi @borrmi,

if you have an RGBW strip, you need to turn on LEDs are 4-channel type (RGBW):