Wake up alarm with lights - fade in

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..

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.

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.


For the sake of the idea.

[{"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":[]}]

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.

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

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