Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This function implements the functionality of Daylight Harvesting and Motion Sensor. If movement is detected, the luminaires are set to a brightness level corresponding with the current daylight harvesting value. It eliminates lighting “jumps“ while Daylight Harvesting is active and Motion sensor triggers fixed brightness values.

Panel
panelIconId1f7e2
panelIcon:green_circle:
panelIconText🟢
bgColor#E3FCEF

Import the ready made flow using the instructions here: Importing a Node-RED flow or follow the instructions below.

Code Block
languagejson
[{"id":"b5cf2f8a.7e67d0b8a5fc647e413bf","type":"tab","label":"Flow 6","disabled":false,"info":""},{"id":"45228343.6ba62c036840cb239dc941","type":"vertex daylightHarvesting","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","name":"Daylight Harvesting","primarygroup":"1406058a7c624da69532a06ea422ec10","target":"200","tolerance":"2","P":0.25,"I":0.03,"D":0,"min":-25"0","max":25"100","x":650,"y":380,"wires":[["ce8d389d.9756e816cd547fbf3855fa","0c0b512447f588bba984b3c3eabbc201"]]},{"id":"ce8d389d.9756e816cd547fbf3855fa","type":"vertex action","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","name":"","typeButton":"directv","bPayload":{"action":"setbrightnesslog","group":null,"param":0,"priority":"0"},"bState":"","defaultpriority":false,"x":890,"y":380,"wires":[["ce478c01.e8342888051b6ad7cc2"]]},{"id":"5ee8e578.5a0d8c81b94d756b86d1f7","type":"vertex action","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","name":"","typeButton":"motionsensor","bPayload":{"PRESENCE":{"action":"setbrightness","group":null,"param":"100","priority":"255"},"TRANSITION":{"action":"setbrightness","group":null,"param":"44","priority":"0"},"NOPRESENCE":{"action":"setbrightness","group":null,"param":"0","priority":"254"}},"bState":"","defaultpriority":true,"x":670,"y":540,"wires":[["e32e152b.617d689c46ac4c449f04ad"]]},{"id":"ce478c01.e8342888051b6ad7cc2","type":"vertex cluster","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","rate":"50","x":1130,"y":460,"wires":[]},{"id":"ceb786fc.befe785561a6e04af30fb8","type":"dali2devs","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","name":"Motion Sensor Instance","uid":"00000003A4214709BC","dali2dev":"0","devStatus":2,"instanceType":3,"dali2t1":"10","dali2t2":"2","mode":"","x":350,"y":540,"wires":[["5ee8e578.5a0d8c81b94d756b86d1f7"]]},{"id":"e9bee633.fa1468be12216b5a32c545","type":"dali2devs","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","name":"Light Sensor Instance","uid":"00000003A4214709BC","dali2dev":"2","devStatus":2,"instanceType":4,"dali2t1":"10","dali2t2":"","mode":"","x":340,"y":380,"wires":[["45228343.6ba62c036840cb239dc941"]]},{"id":"af722060.937e61ca07f415f22305f","type":"comment","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","name":"change payload function","info":"","x":870,"y":580,"wires":[]},{"id":"63d92d25.570164a8b75c1533da3223","type":"comment","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","name":"Configure the light sensor","info":"","x":350,"y":340,"wires":[]},{"id":"89f34c0d.131261202eb5a431c5a7c","type":"comment","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","name":"Configure the motion sensor","info":"","x":360,"y":600,"wires":[]},{"id":"e32e152b.617d689c46ac4c449f04ad","type":"function","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","name":"motion flow dhv1","func":"if(msg.topic.includes(\"MOTIONSENSOR/PRESENCE\")||msg.topic.includes(\"MOTIONSENSOR/TRANSITION\"))\n{\n    for(var gr in msg.payload.parameter.value)\n    {\n\t     msg.payload.parameter.value[gr] = flow.get(\"dhv1\");\n    }\n    return msg;\n}\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":540,"wires":[["ce478c01.e8342888051b6ad7cc2"]]},{"id":"f927b0bedce6dd899b39f4104b63f4fa","type":"comment","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","name":"Specify DH parameters","info":"","x":640,"y":340,"wires":[]},{"id":"0c0b512447f588bba984b3c3eabbc201","type":"change","z":"b5cf2f8a.7e67d0b8a5fc647e413bf","name":"","rules":[{"t":"set","p":"dhv1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":440,"wires":[[]]}]

InstructionsDrag & Drop

Step-by-step instructions

  1. Find the following nodes onto the workspace: in the palette on the left side of the Node-RED, drag them to your workspace and connect them as shown.

  • dali2devs x2

  • Daylight Harvesting

  • function

  • vertex action x2

  • vertex cluster

  • change

Info

See how to configure the Daylight Harvesting node here → Daylight harvesting.

Configure the function and change nodes

2.
  1. Go to the change node properties. The configuration is shown below. The node writes flow variable “dhv1“ with msg.payload value coming from the output of Daylight Harvesting node.

3. Go into the function node properties and name it motion flow dhv1. Make sure that the code is as in the screenshot below.

Configure the vertex action nodes

4. Configure Open the lower vertex action node in a standard way for a multisensor. An example of such configuration can be found below or here → Multisensor (DALI-2 sensor)properties. By default all instances are marked which means they are disabled. Enable detection by unchecking the Motion/presence sensor checkbox. Set the mode to motion sensor and set parameters like brightness and transition. Remember to set the correct group.

5. Configure Go to the second vertex action node linked with the daylight harvesting node (the upper one) in the direct value mode. Check how to do that here → Daylight harvesting.

Confirm and deploy

6. Make sure that a correct group is set in all needed nodes.

7. Select the Deploy button. The program is now sent to Vertex.. Set the mode as a Direct Value and Set brightness (scale logarithmic) as the action. Select the same group as in the Daylight Harvesting node. Enable detection by unchecking the Motion/presence sensor checkbox and set the Priority to 0.

Image Added

Do not forget to click Done and Deploy!