# Wake up alarm with lights - fade in

**URL:** <https://discourse.nodered.org/t/wake-up-alarm-with-lights-fade-in/55578>\
**Category:** General\
**Created:** [22 December 2021 18:39 UTC](https://discourse.nodered.org/t/wake-up-alarm-with-lights-fade-in/55578 "2021-12-22T18:39:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![derail\_green](https://avatars.discourse-cdn.com/v4/letter/d/e19b73/32.png) [@derail\_green](https://discourse.nodered.org/u/derail_green)\
**Post date:** [22 December 2021 18:39 UTC](https://discourse.nodered.org/t/wake-up-alarm-with-lights-fade-in/55578/1 "2021-12-22T18:39:52Z")

</div>

I’m using node-red to control my lights with zigbee2mqtt. Everything works as it should… I’m interested in having lights fade in over 30 minutes. What would be the best way to accomplish this? I doubt adding the transition parameter of 1800 seconds would do..

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 December 2021 20:59 UTC](https://discourse.nodered.org/t/wake-up-alarm-with-lights-fade-in/55578/2 "2021-12-22T20:59:35Z")

</div>

There are many ways to do it.

So you may have to elaborate on how you want to do it.

Say you make it happen over 30 steps. 1 every minute.

You send a message with a slightly increasing value for brightness every minute.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [22 December 2021 22:36 UTC](https://discourse.nodered.org/t/wake-up-alarm-with-lights-fade-in/55578/3 "2021-12-22T22:36:33Z")

</div>

Here is a basic idea of how to do it.

You will need to change the times (now 1 second) to what you want. Say 3 minutes.  
Increase the size of the array - if needed.

Anyway....

For the sake of the idea.

```auto
[{"id":"8defeab6b5553a0d","type":"function","z":"d103f472.19f3c8","name":"","func":"let brightness = [1,2,3,4,5,6,7,8,9,10];\n\nlet x = 10;\nlet y = 0;\n\nfunction f(x,y) {\n// node.warn(y);\n msg.payload = brightness[y];\n node.send(msg);\n y += 1;\n if(y < x){\n setTimeout( f, 1000, x, y );\n }\n}\n\nf(x,y);\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":520,"wires":[["bd9f3db9e2e1fccb"]]},{"id":"1f14dadfdf41c1c2","type":"inject","z":"d103f472.19f3c8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":520,"wires":[["8defeab6b5553a0d"]]},{"id":"bd9f3db9e2e1fccb","type":"debug","z":"d103f472.19f3c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":520,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 December 2021 22:51 UTC](https://discourse.nodered.org/t/wake-up-alarm-with-lights-fade-in/55578/4 "2021-12-22T22:51:58Z")

</div>

Check out the settings in Zigbee2MQTT because some devices have this facility. The fadable Ikea bulbs for example. You can set the fade period and then set the desired end brightness.

---

<div class="post-metadata">

**Author:** ![derail\_green](https://avatars.discourse-cdn.com/v4/letter/d/e19b73/32.png) [@derail\_green](https://discourse.nodered.org/u/derail_green)\
**Post date:** [23 December 2021 06:24 UTC](https://discourse.nodered.org/t/wake-up-alarm-with-lights-fade-in/55578/5 "2021-12-23T06:24:57Z")

</div>

Just got back home from work... thank you all! I'll tinker with these ideas. I appreciate the help!!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 February 2022 06:25 UTC](https://discourse.nodered.org/t/wake-up-alarm-with-lights-fade-in/55578/6 "2022-02-21T06:25:07Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
