Toggle button + sensor
The getting started with Node-RED section is here: Programing logic (Node-Red)
One of the features of Node-RED logic is using a toggle button and sensor. The lighting turns on when the button is pressed. When a sensor stops detecting the presence the lighting turns off. Use this flow if you have one button to turn the light on and off (toggle button mode).
You avoid pressing the button twice to turn the light on and there is no need to turn it off.
Import the ready made flow using the instructions here: Importing a Node-RED flow
[{"id":"731f515c766a87a5","type":"DALI2 Devs Common","z":"c833afacf7eaa164","name":"Toggle button","outputs":1,"uid":"0000000829E23C254D","devStatus":2,"devSettings":[{"InstanceType":1,"isDisabled":false,"mode":"normal","evenFilters":84},{"InstanceType":1,"isDisabled":true,"mode":"normal","evenFilters":86},{"InstanceType":1,"isDisabled":true,"mode":"normal","evenFilters":246},{"InstanceType":1,"isDisabled":true,"mode":"normal","evenFilters":244}],"savedSettings":[{"InstanceType":1,"isDisabled":false,"mode":"normal","evenFilters":84},{"InstanceType":1,"isDisabled":true,"mode":"normal","evenFilters":86},{"InstanceType":1,"isDisabled":true,"mode":"normal","evenFilters":246},{"InstanceType":1,"isDisabled":true,"mode":"normal","evenFilters":244}],"x":360,"y":320,"wires":[["1bcb334cfc41476e"]]},{"id":"ba59bc21ee3741da","type":"DALI2 Devs Common","z":"c833afacf7eaa164","name":"DALI-2 multisensor","outputs":1,"uid":"003D282AE2B3506440","devStatus":2,"devSettings":[{"InstanceType":3,"isDisabled":false,"dali2t1":"11","dali2t2":"3","evenFilters":27},{"InstanceType":4,"isDisabled":true,"evenFilters":1}],"savedSettings":[{"InstanceType":3,"isDisabled":false,"dali2t1":"11","dali2t2":"3","evenFilters":27},{"InstanceType":4,"isDisabled":true,"evenFilters":1}],"x":370,"y":420,"wires":[["20c76703e3d31ac4"]]},{"id":"1bcb334cfc41476e","type":"vertex action","z":"c833afacf7eaa164","name":"ON/OFF","typeButton":"toggle","bPayload":{"ON":{"action":"setbrightness","group":"7366e2b3dd6a53d1f5b01598b018d5f2","param":"100","priority":"254"},"OFF":{"action":"setbrightness","group":"7366e2b3dd6a53d1f5b01598b018d5f2","param":"0","priority":"254"}},"bState":false,"defaultpriority":false,"x":730,"y":320,"wires":[["8bdfa86246fdc667"]]},{"id":"20c76703e3d31ac4","type":"vertex action","z":"c833afacf7eaa164","name":"Motion sensor ","typeButton":"motionsensor","bPayload":{"PRESENCE":{"action":"noreact","group":"7366e2b3dd6a53d1f5b01598b018d5f2","param":null,"priority":"255"},"TRANSITION":{"action":"noreact","group":"7366e2b3dd6a53d1f5b01598b018d5f2","param":null,"priority":"0"},"NOPRESENCE":{"action":"setbrightness","group":"7366e2b3dd6a53d1f5b01598b018d5f2","param":"0","priority":"254"}},"bState":"","defaultpriority":true,"x":750,"y":420,"wires":[["8bdfa86246fdc667"]]},{"id":"8bdfa86246fdc667","type":"vertex cluster","z":"c833afacf7eaa164","rate":5,"x":1130,"y":360,"wires":[]},{"id":"874d52020ad909c3","type":"vertex feedback","z":"c833afacf7eaa164","name":"","primarygroup":"7366e2b3dd6a53d1f5b01598b018d5f2","x":740,"y":200,"wires":[["1bcb334cfc41476e"]]},{"id":"881e80e9c92d2f09","type":"comment","z":"c833afacf7eaa164","name":"Select the same group as in Vertex action","info":"Select the same group as in Vertex action nodes.\nThis will pass the actual state of the group to the input of the Vertex action node.\nIn this way - the vertex action will toggle ON/OFF in the right way instead of needing the double-click to turn the group on when it was turned off by the sensor.","x":820,"y":160,"wires":[]},{"id":"3fb38b8b29d640f6","type":"comment","z":"c833afacf7eaa164","name":"Select and configure a button","info":"Select the same group as in Vertex action nodes.\nThis will pass the actual state of the group to the input of the Vertex action node.\nIn this way - the vertex action will toggle ON/OFF in the right way instead of needing the double-click to turn the group on when it was turned off by the sensor.","x":400,"y":280,"wires":[]},{"id":"aafd32b08aa76345","type":"comment","z":"c833afacf7eaa164","name":"Select and configure a sensor","info":"Select the same group as in Vertex action nodes.\nThis will pass the actual state of the group to the input of the Vertex action node.\nIn this way - the vertex action will toggle ON/OFF in the right way instead of needing the double-click to turn the group on when it was turned off by the sensor.","x":400,"y":380,"wires":[]}]
Instructions
Find the following nodes in the Node-RED palette:
DALI2 Devs Common x2
Vertex action x2
Vertex cluster
Vertex feedback
2. In the Toggle button node select the right DALI-2 device in the Device field and set Event filters as follows:
3. In the DALI-2 multisensor node select the right DALI-2 device in the Device field and fill times for your setup.
4. Go to the Vertex action (ON/OFF node) and select the correct group.
5. Select the same group in the second Vertex action (Motion Sensor node) and choose actions as follows:
6. Go to the Vertex feedback node and select the same group as in the previous steps.
Vertex feedback will work only if values in “Event On” actions are equal for both Vertex action nodes. For example the button sets the brightness to 100% and Motion Sensor does the same.
If the Button sets brightness to 80% and sensor for 100% then the “double click issue” will appear.
What can I modify?
Brightness levels - remember that the brightness levels on “Event ON” must be the same for both Vertex action nodes!
Change the presence and transition times in the DALI-2 multisensor node.