Custom sunrise LED light setup

Hi there, I have recently managed to create a custom sunrise lighting setup for my aquarium diy light, but I am having a few issues.
I am using a shelly rgbw2 as my light controller for 4 LED light strips.

What I have come across so far is this:

I think it's a very simple process, which works, most of the times. I know it's not optimised but it gets the job done.
The problem I have come across is, because the light transition node receives a start command, it always goes to the connected delays. The problem is, if I use the shelly app to shut down the lights, the process ends and does not resume. So lets say for example I have a power outage, the process will not go on and the cycle will not be continued. I would like to know a way of resuming the process (if the power goes out or I manually turn off/on the lights in the shelly app) and to bypass the delays, resuming the brightest and possibly checking the time of day and ignore the 6 hour delay for example. (Imagine that the light is shut down at 16:00, and if I resume the process I would not like tom waits for another 6 hour delay to go to the next dimming process, as it would make the lights not reach the desired brightness as in the timestamp below), So in order for you to understand the goal of this automation I will leave a timestamp which it was based on.

LIGH TURN ON at 13:00 at 1 % brightness
Increase brightness from 1% to 50% from 13:00 to 13:15 (15 min)
Stay with 50% brightness untill 14:15
Increase brightness from 50% to 100% from 14:15 to 14:30 (15 min)
Stay with 100% brightness until 20:30
Decrease brightness from 100% to 50% from 20:30 to 20:45 (15 min)
Stay with 100% brightness until 21:45
Decrease brightness from 50% to 1% from 21:45 to 22:00 (15 min)
LIGHT TUR OFF at 22:00

Can you help me automate this so it won't fail on me? Is it possible?
I have created sort of a function that can stop the light transition node if it reaches a certain value as seen here:

But am unsure as this is useful for my current problem.

I tried to use time range in here as well, but am not sure if it works as well.i will post the print if asked (new users only 2)

Thank you in advance for giving your time to help me with this.

A quick look would suggest that this is an 'Open Loop' control system, you tell it to switch on and off with no feedback. If you are using the Shelly App, then Node-RED doesn't know what is happening and so just sits there.

It might be that you need to monitor the Shelly to see what is happening/monitor current status and switch things from Node-RED accordingly.

Also, you can automate the start of your flow by ticking the Inject once after... box in the inject node, this would trigger an on every time Node-RED starts.

i will try looking into a node that can monitor the state of the shelly.
As for the inject node i dont quite understand how to apply that to my current flow. can you perhaps share a exemple flow on how this works and improves my current flow?

here is the sourse code of my flow:

[{"id":"124727204afb0b5d","type":"tab","label":"Controlador Luz Aquario","disabled":false,"info":"","env":[]},{"id":"77b757fb572708f0","type":"api-call-service","z":"124727204afb0b5d","name":"TURN LIGHT ON","server":"a8cd1e6a.e1868","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":["sala_de_estar"],"deviceId":["d44f4bd4ed933c4ce0c4893b2444ebc4"],"entityId":["light.shellyrgbw2_ddccd8","light.shellyrgbw2_ddccd8_channel_2","light.shellyrgbw2_ddccd8_channel_3","light.shellyrgbw2_ddccd8_channel_4"],"data":"{\"brightness_pct\": payload.brightness_pct}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":500,"wires":[[]]},{"id":"f3e60013167e0860","type":"light-transition","z":"124727204afb0b5d","name":"0-50% (15 min)","startRGB":"#ff0000","transitionRGB":"#ffc864","endRGB":"#ffffff","startMired":"","endMired":"","transitionTime":"15","transitionTimeUnits":"Minute","steps":"50","startBright":"0","endBright":"50","brightnessType":"Percent","transitionType":"Linear","colorTransitionType":"None","x":540,"y":560,"wires":[["77b757fb572708f0"],["85f033bac2bf8c92"]]},{"id":"85f033bac2bf8c92","type":"delay","z":"124727204afb0b5d","name":"","pauseType":"delay","timeout":"60","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":730,"y":620,"wires":[["39bec14f69597066"]]},{"id":"39bec14f69597066","type":"light-transition","z":"124727204afb0b5d","name":"50-100% (15 min)","startRGB":"#ff0000","transitionRGB":"#ffc864","endRGB":"#ffffff","startMired":"","endMired":"","transitionTime":"15","transitionTimeUnits":"Minute","steps":"50","startBright":"50","endBright":"100","brightnessType":"Percent","transitionType":"Linear","colorTransitionType":"None","x":530,"y":740,"wires":[["c6e8681add3e3bf0"],["caf2ee7c415a1862"]]},{"id":"c6e8681add3e3bf0","type":"api-call-service","z":"124727204afb0b5d","name":"TURN LIGHT ON","server":"a8cd1e6a.e1868","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":["sala_de_estar"],"deviceId":["d44f4bd4ed933c4ce0c4893b2444ebc4"],"entityId":["light.shellyrgbw2_ddccd8_channel_4","light.shellyrgbw2_ddccd8","light.shellyrgbw2_ddccd8_channel_2","light.shellyrgbw2_ddccd8_channel_3"],"data":"{\"brightness_pct\": payload.brightness_pct}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":700,"wires":[[]]},{"id":"caf2ee7c415a1862","type":"delay","z":"124727204afb0b5d","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"hours","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":720,"y":780,"wires":[["98ee8f6fc0bca944"]]},{"id":"98ee8f6fc0bca944","type":"light-transition","z":"124727204afb0b5d","name":"100-50% (15 min)","startRGB":"#ff0000","transitionRGB":"#ffc864","endRGB":"#ffffff","startMired":"","endMired":"","transitionTime":"15","transitionTimeUnits":"Minute","steps":"50","startBright":"100","endBright":"50","brightnessType":"Percent","transitionType":"Linear","colorTransitionType":"None","x":530,"y":920,"wires":[["3ddec053db9ce7e9"],["2cf0a78f18000d5c"]]},{"id":"2cf0a78f18000d5c","type":"delay","z":"124727204afb0b5d","name":"","pauseType":"delay","timeout":"60","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":730,"y":960,"wires":[["c23674832bc085b0"]]},{"id":"c23674832bc085b0","type":"light-transition","z":"124727204afb0b5d","name":"50-100% (15 min)","startRGB":"#ff0000","transitionRGB":"#ffc864","endRGB":"#ffffff","startMired":"","endMired":"","transitionTime":"15","transitionTimeUnits":"Minute","steps":"50","startBright":"50","endBright":"1","brightnessType":"Percent","transitionType":"Linear","colorTransitionType":"None","x":530,"y":1100,"wires":[["a596f0b1e895acce"],["53606ca86d7e92b2"]]},{"id":"695501d27c546090","type":"api-call-service","z":"124727204afb0b5d","name":"TURN LIGHT OFF","server":"a8cd1e6a.e1868","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":["sala_de_estar"],"deviceId":["d44f4bd4ed933c4ce0c4893b2444ebc4"],"entityId":["light.shellyrgbw2_ddccd8_channel_4","light.shellyrgbw2_ddccd8","light.shellyrgbw2_ddccd8_channel_2","light.shellyrgbw2_ddccd8_channel_3"],"data":"{\"brightness_pct\": payload.brightness_pct}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":950,"y":1140,"wires":[[]]},{"id":"3ddec053db9ce7e9","type":"api-call-service","z":"124727204afb0b5d","name":"TURN LIGHT ON","server":"a8cd1e6a.e1868","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":["sala_de_estar"],"deviceId":["d44f4bd4ed933c4ce0c4893b2444ebc4"],"entityId":["light.shellyrgbw2_ddccd8_channel_4","light.shellyrgbw2_ddccd8","light.shellyrgbw2_ddccd8_channel_2","light.shellyrgbw2_ddccd8_channel_3"],"data":"{\"brightness_pct\": payload.brightness_pct}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":880,"wires":[[]]},{"id":"a596f0b1e895acce","type":"api-call-service","z":"124727204afb0b5d","name":"TURN LIGHT ON","server":"a8cd1e6a.e1868","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":["sala_de_estar"],"deviceId":["d44f4bd4ed933c4ce0c4893b2444ebc4"],"entityId":["light.shellyrgbw2_ddccd8_channel_4","light.shellyrgbw2_ddccd8","light.shellyrgbw2_ddccd8_channel_2","light.shellyrgbw2_ddccd8_channel_3"],"data":"{\"brightness_pct\": payload.brightness_pct}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":1060,"wires":[[]]},{"id":"53606ca86d7e92b2","type":"change","z":"124727204afb0b5d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":1140,"wires":[["695501d27c546090"]]},{"id":"4931af9f235add0d","type":"schedex","z":"124727204afb0b5d","name":"","passthroughunhandled":false,"suspended":false,"lat":"","lon":"","ontime":"12:58","ontopic":"","onpayload":"on","onoffset":"0","onrandomoffset":0,"offtime":"22:00","offtopic":"","offpayload":"off","offoffset":0,"offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":310,"y":440,"wires":[["f3e60013167e0860"]]},{"id":"3b3f8f72334a4418","type":"inject","z":"124727204afb0b5d","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"3600","topic":"","payload":"on","payloadType":"str","x":170,"y":340,"wires":[["4931af9f235add0d"]]},{"id":"2ef3485144ce69a4","type":"inject","z":"124727204afb0b5d","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":170,"y":520,"wires":[["4931af9f235add0d"]]},{"id":"a8cd1e6a.e1868","type":"server","name":"Home Assistant","addon":true}]

You can check the state of the Shelly using either MQTT or an API call (http).

I did try to import your flow, but it has nodes that I don't have installed and my test server is offline at the moment. Personally I use MQTT, but I also use the http API call for a Shelly TRV (MQTT doesn't work currently!).

Shelly API docs here.

I will be busy for an hour or so, but will send a short test program when I get back. Or, in the meantime, you might be able to adapt this...

[{"id":"e1e91658b006e6d3","type":"inject","z":"cb1f246f.1210f","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"status","x":110,"y":80,"wires":[["b6355986b7239eed"]]},{"id":"b6355986b7239eed","type":"http request","z":"cb1f246f.1210f","name":"TRV Basic","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://172.27.123.250/{{{topic}}}","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"credentials":{},"x":270,"y":80,"wires":[["420dcf24c2ada988"]]},{"id":"e99ebcf121c9c68c","type":"debug","z":"cb1f246f.1210f","name":"debug 17","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":80,"wires":[]},{"id":"420dcf24c2ada988","type":"json","z":"cb1f246f.1210f","name":"","property":"payload","action":"","pretty":false,"x":430,"y":80,"wires":[["e99ebcf121c9c68c"]]}]

i have discovered this node tha comunnicates with the shelly ip , does this help with my problem?

[{"id":"7659a366c0fc320d","type":"debug","z":"0d338faf61a7ae48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":220,"wires":[]},{"id":"7b2d2337a2be80bc","type":"comment","z":"0d338faf61a7ae48","name":"Shelly RGBW white stripes example","info":"","x":340,"y":120,"wires":[]},{"id":"0c3cd883f4e7a37d","type":"shelly-gen1","z":"0d338faf61a7ae48","hostname":"192.168.178.178","description":"","mode":"none","server":"033a6e9acf499057","uploadretryinterval":"5000","pollinginterval":5000,"pollstatus":false,"getstatusoncommand":true,"devicetype":"RGBW","outputs":1,"credentials":{"username":"","password":""},"x":630,"y":220,"wires":[["7659a366c0fc320d"]]},{"id":"43a858c7730b360a","type":"function","z":"0d338faf61a7ae48","name":"white","func":"msg.payload =\n{\n    light : msg.light,\n    brightness : 100,\n    timer : 0,\n    on : msg.on\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":450,"y":220,"wires":[["0c3cd883f4e7a37d"]]},{"id":"827285f1d06ac701","type":"inject","z":"0d338faf61a7ae48","name":"Light 0 On","props":[{"p":"light","v":"0","vt":"num"},{"p":"on","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":260,"y":180,"wires":[["43a858c7730b360a"]]},{"id":"02fc04288114ceeb","type":"inject","z":"0d338faf61a7ae48","name":"Light 0 Off","props":[{"p":"light","v":"0","vt":"num"},{"p":"on","v":"false","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":260,"y":220,"wires":[["43a858c7730b360a"]]},{"id":"b74c161c51d266ba","type":"inject","z":"0d338faf61a7ae48","name":"Light 1 On","props":[{"p":"light","v":"1","vt":"num"},{"p":"on","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":260,"y":260,"wires":[["43a858c7730b360a"]]},{"id":"c277d71f6d086a85","type":"inject","z":"0d338faf61a7ae48","name":"Light 1 Off","props":[{"p":"light","v":"1","vt":"num"},{"p":"on","v":"false","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":260,"y":300,"wires":[["43a858c7730b360a"]]},{"id":"756070cd0d42aada","type":"inject","z":"0d338faf61a7ae48","name":"Light 2 On","props":[{"p":"light","v":"2","vt":"num"},{"p":"on","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":260,"y":340,"wires":[["43a858c7730b360a"]]},{"id":"3210fea9d8f20e4f","type":"inject","z":"0d338faf61a7ae48","name":"Light 2 Off","props":[{"p":"light","v":"2","vt":"num"},{"p":"on","v":"false","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":260,"y":380,"wires":[["43a858c7730b360a"]]},{"id":"348a69fa455d31ba","type":"inject","z":"0d338faf61a7ae48","name":"Light 3 On","props":[{"p":"light","v":"3","vt":"num"},{"p":"on","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":260,"y":420,"wires":[["43a858c7730b360a"]]},{"id":"fa146f41a8115368","type":"inject","z":"0d338faf61a7ae48","name":"Light 3 Off","props":[{"p":"light","v":"3","vt":"num"},{"p":"on","v":"false","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":260,"y":460,"wires":[["43a858c7730b360a"]]},{"id":"033a6e9acf499057","type":"shelly-gen1-server","port":"20001","hostname":""}]

i have tried your trv node but nothing is passed through the debug msg (yes i have changed the ip adress) meanwhile using the shelly node (the one i sent in the previous reply) it passes all parameters of the current device status.
so if im now able to communicate with the device, all i have to do is adapt the previous flow to this new node ? now i need a node or a function that checks the device status and changes the brightness percentage accordingly? am i on a good path here?
i am sorry my knowledge of programming json is limited, i used to know how to javascript, but cant remember anymore, but if i see an example i might be able to adapt to my needs!

I have just checked against an RGBW2 I have here, just changing the IP address to that of the Shelly and I get data back on the Debug nodes (added one just after the HTTP call).

Don't worry about the JSON, we can sort that later, just interested in the data from the Debug Nodes.

I don't use the Shelly node and as I said, can't test it on the production server.

i get nothing with the tvr u sent me:

but with the shelly node i get this data:

i dont think it gives the current time tho, as yours does

it does return timestamp, i i click on it on the debug it shows me the time :slight_smile:

Hmmm! If you can see the status of the Shelly using the Node you have installed, then by all means use it. You need to see what it returns and then pull out the message that shows the status. I am in the dark here as to what you are seeing as I don't have that Node installed.

Once you get the status, you can then drive the Shelly accordingly.

I would suggest that you look at the Tutorials/short Videos to help you understand what you can do with Node-RED. It is very powerful, and once you understand the basics, easy to use for tasks.

Using a Browser (Firefox gives a nicely formatted output), put the IP address of the Shelly unit into the Address Bar of the browser with the following format XXX.XXX.XXX.XXX/status this should give you the status of the Shelly Module as the Node-RED flow I posted above should. (This is the output of that flow, the value of the topic can be changed to make other calls to the API)

If it doesn't then I would suggest that you might have the wrong IP address for the Shelly Module. BTW, this is a standard call for all Shelly modules with the HTTP API and so should work on them all by changing the IP address.

For reference Shelly API /status

EDIT: A Switch node might help to trap the message you are looking for.

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