In a Vertex Action node Motion sensor mode is created to get the information from the motion sensor configured in a node (dali2devs or dali2common).
Input of the node:
These are commands received from Motion sensor:{"payload": {"MSEVENT": 0}} - presence
{"payload": {"MSEVENT": 1}} - transition
{"payload": {"MSEVENT": 2}} - no presence
Additionally, each sensor is sending an individual UID (unique identifier):
You need to create a direct connection between a “device” node and a VA: Motion sensor node.
That’s because there is a list of devices in the Vertex Action node, and the logic behind it is waiting for all of the devices to report the No Presence event to turn off a group of luminaires.
Every flow “deploy” clears the list of devices that are connected to the Vertex Action.
NodeRed flow:
[{"id":"4eabee83.2562f","type":"group","z":"463437f9.dd86a8","name":"Incorrect","style":{"stroke":"#ff3f3f","fill":"#ffbfbf","label":true,"color":"#ff0000","label-position":"n"},"nodes":["b8f3ec05.aea928","2ab3617c.777f76","6d1ba9c4.6aeb9","25ee059.d3e137a","9b11bc35.aa856","e5bc2fd6.9ea6a","e72d29dd.e884","ee592f75.794d8","528a5ffd.1eb02","d7a95c3c.92cb28"],"x":74,"y":419,"w":1412,"h":262},{"id":"b8f3ec05.aea928","type":"vertex cluster","z":"463437f9.dd86a8","g":"4eabee83.2562f","rate":5,"x":1390,"y":540,"wires":[]},{"id":"2ab3617c.777f76","type":"dali2devs","z":"463437f9.dd86a8","g":"4eabee83.2562f","name":"Motion Sensor no1","uid":"00000003A4214709BC","dali2dev":"11","instanceType":1,"dali2t1":90,"dali2t2":"","mode":"","x":190,"y":460,"wires":[["9b11bc35.aa856"]]},{"id":"6d1ba9c4.6aeb9","type":"dali2devs","z":"463437f9.dd86a8","g":"4eabee83.2562f","name":"Motion Sensor no2","uid":"00000003A4214709BC","dali2dev":"8","instanceType":1,"dali2t1":"10","dali2t2":"","mode":"","x":190,"y":540,"wires":[["9b11bc35.aa856"]]},{"id":"25ee059.d3e137a","type":"dali2devs","z":"463437f9.dd86a8","g":"4eabee83.2562f","name":"Motion Sensor no3","uid":"00000003A4214709BC","dali2dev":"11","instanceType":1,"dali2t1":"10","dali2t2":"","mode":"","x":190,"y":620,"wires":[["9b11bc35.aa856"]]},{"id":"9b11bc35.aa856","type":"switch","z":"463437f9.dd86a8","g":"4eabee83.2562f","name":"Presence/Transition/NoPresence","property":"payload.MSEVENT","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":500,"y":540,"wires":[["ee592f75.794d8"],["528a5ffd.1eb02"],["d7a95c3c.92cb28"]]},{"id":"e5bc2fd6.9ea6a","type":"vertex action","z":"463437f9.dd86a8","g":"4eabee83.2562f","name":"Direct Value","typeButton":"single","bPayload":{"action":"setbrightness","group":"1d606bc8d9eb7c1241805d7b07c81f1d","param":"50","priority":"254"},"bState":"","defaultpriority":true,"x":1100,"y":500,"wires":[["b8f3ec05.aea928"]]},{"id":"e72d29dd.e884","type":"comment","z":"463437f9.dd86a8","g":"4eabee83.2562f","name":"This flow does not check and compare values from all sensors","info":"","x":790,"y":640,"wires":[]},{"id":"ee592f75.794d8","type":"change","z":"463437f9.dd86a8","g":"4eabee83.2562f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"level","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":500,"wires":[["e5bc2fd6.9ea6a"]]},{"id":"528a5ffd.1eb02","type":"vertex action","z":"463437f9.dd86a8","g":"4eabee83.2562f","name":"Direct Value","typeButton":"single","bPayload":{"action":"setbrightness","group":"1d606bc8d9eb7c1241805d7b07c81f1d","param":"50","priority":"254"},"bState":"","defaultpriority":true,"x":1100,"y":540,"wires":[["b8f3ec05.aea928"]]},{"id":"d7a95c3c.92cb28","type":"vertex action","z":"463437f9.dd86a8","g":"4eabee83.2562f","name":"Direct Value","typeButton":"single","bPayload":{"action":"setbrightness","group":"1d606bc8d9eb7c1241805d7b07c81f1d","param":"50","priority":"254"},"bState":"","defaultpriority":true,"x":1100,"y":580,"wires":[["b8f3ec05.aea928"]]},{"id":"8b0cf8a1.a69ad8","type":"group","z":"463437f9.dd86a8","name":"Correct","style":{"stroke":"#92d04f","fill":"#e3f3d3","label":true,"label-position":"n","color":"#009919"},"nodes":["e80d35a8.6d7d1","d361885a.96a2c8","39f5c80b.08bad","b88f58bc.dff27","931d822f.61c8d","ec01ed4.c44cc9","61f904f6.91ebd4","bb07db98.3080b","90fa4b74.21e36","ff7fa553.91a68"],"x":74,"y":139,"w":1412,"h":262},{"id":"e80d35a8.6d7d1","type":"vertex action","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Motion sensor","typeButton":"motionsensor","bPayload":{"PRESENCE":{"action":"setbrightness","group":"1d606bc8d9eb7c1241805d7b07c81f1d","param":"50","priority":"255"},"TRANSITION":{"action":"setbrightness","group":"1d606bc8d9eb7c1241805d7b07c81f1d","param":"50","priority":"0"},"NOPRESENCE":{"action":"setbrightness","group":"1d606bc8d9eb7c1241805d7b07c81f1d","param":"0","priority":"254"}},"bState":"","defaultpriority":true,"x":530,"y":260,"wires":[["931d822f.61c8d"]]},{"id":"d361885a.96a2c8","type":"dali2devs","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Motion Sensor no1","uid":"00000003A4214709BC","dali2dev":"0","instanceType":3,"dali2t1":"10","dali2t2":"","mode":"","x":190,"y":180,"wires":[["e80d35a8.6d7d1"]]},{"id":"39f5c80b.08bad","type":"dali2devs","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Motion Sensor no2","uid":"00000003A4214709BC","dali2dev":"0","instanceType":3,"dali2t1":"10","dali2t2":"","mode":"","x":190,"y":260,"wires":[["e80d35a8.6d7d1"]]},{"id":"b88f58bc.dff27","type":"dali2devs","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Motion Sensor no3","uid":"00000003A4214709BC","dali2dev":"0","instanceType":3,"dali2t1":"10","dali2t2":"","mode":"","x":190,"y":340,"wires":[["e80d35a8.6d7d1"]]},{"id":"931d822f.61c8d","type":"switch","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Presence/Transition/NoPresence","property":"payload.MSEVENT","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":820,"y":260,"wires":[["bb07db98.3080b"],["ec01ed4.c44cc9"],["ec01ed4.c44cc9"]]},{"id":"ec01ed4.c44cc9","type":"vertex cluster","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","rate":5,"x":1390,"y":260,"wires":[]},{"id":"61f904f6.91ebd4","type":"vertex action","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Direct Value","typeButton":"directv","bPayload":{"action":"setbrightness","group":"1d606bc8d9eb7c1241805d7b07c81f1d","param":0,"priority":"254"},"bState":"","defaultpriority":true,"x":1240,"y":220,"wires":[["ec01ed4.c44cc9"]]},{"id":"bb07db98.3080b","type":"change","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"level","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1060,"y":220,"wires":[["61f904f6.91ebd4"]]},{"id":"90fa4b74.21e36","type":"inject","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Presence","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"MSEVENT\": 0, \"UID\": \"FAKE1\"}","payloadType":"json","x":500,"y":320,"wires":[["e80d35a8.6d7d1"]]},{"id":"ff7fa553.91a68","type":"inject","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"No presence","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"MSEVENT\": 2, \"UID\": \"FAKE1\"}","payloadType":"json","x":510,"y":360,"wires":[["e80d35a8.6d7d1"]]},{"id":"d176b7eb.c2ce1","type":"group","z":"463437f9.dd86a8","name":"Global values","style":{"stroke":"#a4a4a4","label":true,"color":"#777777","fill":"#d1d1d1","label-position":"n"},"nodes":["f610cec.980f33","6f775291.3e5eac"],"x":74,"y":19,"w":372,"h":102},{"id":"f610cec.980f33","type":"es cct","z":"463437f9.dd86a8","g":"d176b7eb.c2ce1","name":"","startTime":"07:00","finishTime":"19:00","colorLevels":[4500,5000,6500,6500,5000,5000,6500,6500,5000,4500,3000],"colorLabels":["07:00","09:00","09:20","10:50","11:10","12:30","12:50","14:00","14:20","17:00","19:00"],"brightnessLevels":[50,80,100,100,80,80,100,100,80,50,30],"brightnessLabels":["07:00","09:00","09:20","10:50","11:10","12:30","12:50","14:00","14:20","17:00","19:00"],"sendFrequencyInMinutes":1,"cctMin":2700,"cctMax":6500,"x":160,"y":60,"wires":[[],["6f775291.3e5eac"]]},{"id":"6f775291.3e5eac","type":"change","z":"463437f9.dd86a8","g":"d176b7eb.c2ce1","name":"","rules":[{"t":"set","p":"level","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":80,"wires":[[]]}]
This is example flow related to: Change node - Setting and triggering variables
Output of the node:
One of the above commands is sent directly to the vertex cluster node
OR
It can be splited by the msg.payload.MSEVENT value:
Tricks & tips:
Fake sensor events:
By using the "Inject" block into Vertex action, you are able to fake the action of a sensor, for example, to maintain the "Presence" state even in the absence of physical movement.
You need to send a msg.payload of { "MSEVENT": 0}; "UID" : "FAKE1" }
:
NodeRed flow:
[{"id":"8b0cf8a1.a69ad8","type":"group","z":"463437f9.dd86a8","name":"Correct","style":{"stroke":"#92d04f","fill":"#e3f3d3","label":true,"label-position":"n","color":"#009919"},"nodes":["e80d35a8.6d7d1","d361885a.96a2c8","39f5c80b.08bad","b88f58bc.dff27","931d822f.61c8d","ec01ed4.c44cc9","61f904f6.91ebd4","bb07db98.3080b","90fa4b74.21e36","ff7fa553.91a68"],"x":334,"y":139,"w":1422,"h":262},{"id":"e80d35a8.6d7d1","type":"vertex action","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Motion sensor","typeButton":"motionsensor","bPayload":{"PRESENCE":{"action":"setbrightness","group":"1d606bc8d9eb7c1241805d7b07c81f1d","param":"50","priority":"255"},"TRANSITION":{"action":"setbrightness","group":"1d606bc8d9eb7c1241805d7b07c81f1d","param":"50","priority":"0"},"NOPRESENCE":{"action":"setbrightness","group":"1d606bc8d9eb7c1241805d7b07c81f1d","param":"0","priority":"254"}},"bState":"","defaultpriority":true,"x":790,"y":260,"wires":[["931d822f.61c8d"]]},{"id":"d361885a.96a2c8","type":"dali2devs","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Motion Sensor no1","uid":"00000003A4214709BC","dali2dev":"0","instanceType":3,"dali2t1":"10","dali2t2":"","mode":"","x":450,"y":180,"wires":[["e80d35a8.6d7d1"]]},{"id":"39f5c80b.08bad","type":"dali2devs","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Motion Sensor no2","uid":"00000003A4214709BC","dali2dev":"0","instanceType":3,"dali2t1":"10","dali2t2":"","mode":"","x":450,"y":260,"wires":[["e80d35a8.6d7d1"]]},{"id":"b88f58bc.dff27","type":"dali2devs","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Motion Sensor no3","uid":"00000003A4214709BC","dali2dev":"0","instanceType":3,"dali2t1":"10","dali2t2":"","mode":"","x":450,"y":340,"wires":[["e80d35a8.6d7d1"]]},{"id":"931d822f.61c8d","type":"switch","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Presence/Transition/NoPresence","property":"payload.MSEVENT","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":1080,"y":260,"wires":[["bb07db98.3080b"],["ec01ed4.c44cc9"],["ec01ed4.c44cc9"]]},{"id":"ec01ed4.c44cc9","type":"vertex cluster","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","rate":5,"x":1650,"y":260,"wires":[]},{"id":"61f904f6.91ebd4","type":"vertex action","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Direct Value","typeButton":"directv","bPayload":{"action":"setbrightness","group":"1d606bc8d9eb7c1241805d7b07c81f1d","param":0,"priority":"254"},"bState":"","defaultpriority":true,"x":1500,"y":220,"wires":[["ec01ed4.c44cc9"]]},{"id":"bb07db98.3080b","type":"change","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"level","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1320,"y":220,"wires":[["61f904f6.91ebd4"]]},{"id":"90fa4b74.21e36","type":"inject","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"Presence","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"MSEVENT\": 0, \"UID\": \"FAKE1\"}","payloadType":"json","x":760,"y":320,"wires":[["e80d35a8.6d7d1"]]},{"id":"ff7fa553.91a68","type":"inject","z":"463437f9.dd86a8","g":"8b0cf8a1.a69ad8","name":"No presence","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"MSEVENT\": 2, \"UID\": \"FAKE1\"}","payloadType":"json","x":770,"y":360,"wires":[["e80d35a8.6d7d1"]]}]
0 Comments