This is a small simulator I just drawed in the editor. You can simulate sunrise (and sunset) and see how it would work. I added a part just to show how you also could handle the sunset annd automatic closing of the roller shutters
The "sunrise" flow works like this:
- the gate is opened at a defined hour like 7:00 am
- if sunrise has already happened, the sunrise command waiting in the trigger node will soon fire and pass through the open gate, the change node is setting the proper "UP" command needed and you can study the result in the debug view. I did configure trigger nodes to fire every ten second to make it easier to test, you could of course change this, typically to once per minute. If you do not want the message being repeated every minute (to synchronize the state and position of your shutters), simply insert the rbe node in the chain
- the gate closes at a defined time like 12:00 am, messages are blocked
The "sunset" flow works the same but with different time settings and with "DOWN" as final command
These flows are just one example of, I assume, many possible ways but at least it gives some ideas how you can do it
EDIT: the gate node used in this example is the node-red-contrib-simple-gate
[{"id":"93738d51.24d45","type":"inject","z":"c25ba5de.f73df8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 07 * * *","once":false,"onceDelay":0.1,"topic":"control","payload":"open","payloadType":"str","x":450,"y":250,"wires":[["f05a4eeb.fb6f5"]]},{"id":"3fb556ea.d5694a","type":"debug","z":"c25ba5de.f73df8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1250,"y":270,"wires":[]},{"id":"f05a4eeb.fb6f5","type":"gate","z":"c25ba5de.f73df8","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"status","persist":false,"x":730,"y":270,"wires":[["bca16a67.1a7798"]]},{"id":"b1b3fdb5.ae42a","type":"trigger","z":"c25ba5de.f73df8","name":"","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"close","bytopic":"all","topic":"topic","outputs":1,"x":730,"y":360,"wires":[["62aa018c.a9ef7","f05a4eeb.fb6f5"]]},{"id":"62aa018c.a9ef7","type":"switch","z":"c25ba5de.f73df8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":730,"y":420,"wires":[["b1b3fdb5.ae42a"]]},{"id":"93cf1f2e.1cc63","type":"inject","z":"c25ba5de.f73df8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 12 * * *","once":false,"onceDelay":0.1,"topic":"control","payload":"close","payloadType":"str","x":450,"y":300,"wires":[["f05a4eeb.fb6f5","b1b3fdb5.ae42a"]]},{"id":"8a05c0e8.ccd57","type":"inject","z":"c25ba5de.f73df8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"sunrise","payloadType":"str","x":480,"y":360,"wires":[["b1b3fdb5.ae42a","f05a4eeb.fb6f5"]]},{"id":"6e8d069c.4f7368","type":"rbe","z":"c25ba5de.f73df8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1080,"y":320,"wires":[["3fb556ea.d5694a"]]},{"id":"bca16a67.1a7798","type":"change","z":"c25ba5de.f73df8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"UP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":270,"wires":[["3fb556ea.d5694a"]]},{"id":"1f6187af.0c21e8","type":"inject","z":"c25ba5de.f73df8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 18 * * *","once":false,"onceDelay":0.1,"topic":"control","payload":"open","payloadType":"str","x":450,"y":540,"wires":[["fe14a64.10d0658"]]},{"id":"21108a25.df3d26","type":"debug","z":"c25ba5de.f73df8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1250,"y":560,"wires":[]},{"id":"fe14a64.10d0658","type":"gate","z":"c25ba5de.f73df8","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"status","persist":false,"x":730,"y":560,"wires":[["300daeb.7564652"]]},{"id":"b06bcf3d.83c43","type":"trigger","z":"c25ba5de.f73df8","name":"","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"close","bytopic":"all","topic":"topic","outputs":1,"x":730,"y":650,"wires":[["97ed8e51.36bc3","fe14a64.10d0658"]]},{"id":"97ed8e51.36bc3","type":"switch","z":"c25ba5de.f73df8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":730,"y":710,"wires":[["b06bcf3d.83c43"]]},{"id":"91dc4d6d.22637","type":"inject","z":"c25ba5de.f73df8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 23 * * *","once":false,"onceDelay":0.1,"topic":"control","payload":"close","payloadType":"str","x":450,"y":590,"wires":[["fe14a64.10d0658","b06bcf3d.83c43"]]},{"id":"4d244296.dde0dc","type":"inject","z":"c25ba5de.f73df8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"sunset","payloadType":"str","x":480,"y":650,"wires":[["b06bcf3d.83c43","fe14a64.10d0658"]]},{"id":"3b1891d0.86c81e","type":"rbe","z":"c25ba5de.f73df8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1080,"y":610,"wires":[["21108a25.df3d26"]]},{"id":"300daeb.7564652","type":"change","z":"c25ba5de.f73df8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"DOWN","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":560,"wires":[["21108a25.df3d26"]]}]