Define actions based on pre-defined schedules using the Light Scheduler node. This functionality is based on astronomical hours of dusks and dawns.
Import the ready made flow using the instructions here: Importing a Node-RED flow or follow the instructions below.
[{"id":"2dd64d2ffc858f6c","type":"light-scheduler","z":"ab392f0dc3f60eae","settings":"b17a207d2a6309f3","events":"[{\"start\":{\"dow\":1,\"mod\":1270},\"end\":{\"dow\":2,\"mod\":0}},{\"start\":{\"dow\":2,\"mod\":1270},\"end\":{\"dow\":3,\"mod\":0}},{\"start\":{\"dow\":3,\"mod\":1270},\"end\":{\"dow\":4,\"mod\":0}},{\"start\":{\"dow\":4,\"mod\":1270},\"end\":{\"dow\":5,\"mod\":0}},{\"start\":{\"dow\":5,\"mod\":1270},\"end\":{\"dow\":6,\"mod\":0}},{\"start\":{\"dow\":6,\"mod\":1270},\"end\":{\"dow\":0,\"mod\":0}},{\"start\":{\"dow\":0,\"mod\":1270},\"end\":{\"dow\":1,\"mod\":0}},{\"start\":{\"dow\":1,\"mod\":0},\"end\":{\"dow\":1,\"mod\":365}},{\"start\":{\"dow\":2,\"mod\":0},\"end\":{\"dow\":2,\"mod\":365}},{\"start\":{\"dow\":4,\"mod\":0},\"end\":{\"dow\":4,\"mod\":365}},{\"start\":{\"dow\":3,\"mod\":0},\"end\":{\"dow\":3,\"mod\":365}},{\"start\":{\"dow\":5,\"mod\":0},\"end\":{\"dow\":5,\"mod\":365}},{\"start\":{\"dow\":6,\"mod\":0},\"end\":{\"dow\":6,\"mod\":365}},{\"start\":{\"dow\":0,\"mod\":0},\"end\":{\"dow\":0,\"mod\":365}}]","topic":"","name":"","onPayload":"100","onPayloadType":"num","offPayload":"0","offPayloadType":"num","onlyWhenDark":true,"scheduleRndMax":"","sunElevationThreshold":"-18","sunShowElevationInStatus":true,"outputfreq":"output.statechange.startup","x":740,"y":340,"wires":[["4aef42ead51468c5"]]},{"id":"5f0490d247784132","type":"vertex cluster","z":"ab392f0dc3f60eae","rate":90,"x":1250,"y":340,"wires":[]},{"id":"2e6a0a7c7e7138e4","type":"comment","z":"ab392f0dc3f60eae","name":"Setting shedule","info":"","x":740,"y":300,"wires":[]},{"id":"c0276ce44e5a63dc","type":"comment","z":"ab392f0dc3f60eae","name":"Direct value","info":"","x":990,"y":300,"wires":[]},{"id":"4aef42ead51468c5","type":"vertex action","z":"ab392f0dc3f60eae","name":"","typeButton":"directv","bPayload":{"action":"setbrightness","group":"3f27ccfea1c114f791557e1328f9d924","param":0,"priority":"254"},"bState":"","defaultpriority":true,"x":990,"y":340,"wires":[["5f0490d247784132"]]},{"id":"1d0882e570252d87","type":"inject","z":"ab392f0dc3f60eae","name":"","props":[{"p":"payload"},{"p":"topic","v":"","vt":"date"}],"repeat":"","crontab":"","once":true,"onceDelay":"10","topic":"","payload":"light-only","payloadType":"str","x":320,"y":340,"wires":[["2dd64d2ffc858f6c"]]},{"id":"6652701141623cd0","type":"comment","z":"ab392f0dc3f60eae","name":"Inject with light-only payload and timestamp topic","info":"","x":420,"y":300,"wires":[]},{"id":"b17a207d2a6309f3","type":"light-scheduler-settings","name":"test","latitude":"50.049272","longitude":"19.957367"}]
Step-by-step instructions
Find the following nodes in the palette on the left side of the Node-RED, drag them to your workspace and connect them as shown.
Light Scheduler
inject
vertex action
vertex cluster
Configure Light Scheduler settings:
a. Global settings: select the icon with a pen [1] and set the name, longitude, and latitude of your location [2].
b. Output settings: Mark "Output," "On Payload," and "Off Payload" as shown below [3]. Make sure to mark the type of variable as number [4].
c. Only When Dark: Enable the "Only When Dark" option [5].
d. Threshold: Set the threshold to -18° for astronomical dusk/dawn [6].
Go to the inject node and set payload to “light-only”, topic to “date” [7] and set the repeat interval to your desired frequency [8].
Go to the vertex action node and choose direct value [9] mode with action set brightness (scale percent) [10]. Specify the group of lights you want to control [11].
Link all the nodes and select the Deploy button.
Add Comment