Integration with other systems over TCP/IP protocol

Integration with other systems over TCP/IP protocol

Integration with an other systems (BMS, Audio Visual … ) using TCP/IP enables you to control the lighting, blinds and screens in spaces like conference rooms, lecture halls and schools.

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

[{"id":"df9465cd.815ae8","type":"tab","label":"BMS, Audio/Video System over TCP/IP","disabled":false,"info":""},{"id":"2d6d1e9b.53e212","type":"tcp in","z":"df9465cd.815ae8","name":"Listening on port 30501","server":"server","host":"10.0.6.50","port":"30501","datamode":"stream","datatype":"utf8","newline":"","topic":"","trim":false,"base64":false,"tls":"","x":160,"y":280,"wires":[["99760983.b23ec8"]]},{"id":"1eeed119.55e54f","type":"switch","z":"df9465cd.815ae8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"},{"t":"eq","v":"3","vt":"str"},{"t":"eq","v":"4","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"6","vt":"str"}],"checkall":"true","repair":false,"outputs":7,"x":670,"y":280,"wires":[["c331af0d.e480a"],["526790c4.76257"],["bfb59be6.ba4338"],["bb19ccad.dc48c"],["a6372d45.90b9b"],["354e9651.8ba36a"],["9792c80a.3ee288"]]},{"id":"526790c4.76257","type":"vertex action","z":"df9465cd.815ae8","name":"ON 80%","typeButton":"single","bPayload":{"action":"setbrightness","group":null,"param":"80","priority":"254"},"bState":"","defaultpriority":true,"x":930,"y":200,"wires":[["539e493b.95d5b8"]]},{"id":"bfb59be6.ba4338","type":"vertex action","z":"df9465cd.815ae8","name":"Preset 1 0%","typeButton":"single","bPayload":{"action":"setbrightness","group":null,"param":"0","priority":"254"},"bState":"","defaultpriority":true,"x":940,"y":240,"wires":[["539e493b.95d5b8"]]},{"id":"bb19ccad.dc48c","type":"vertex action","z":"df9465cd.815ae8","name":"Preset 2 25%","typeButton":"single","bPayload":{"action":"setbrightness","group":null,"param":"25","priority":"254"},"bState":"","defaultpriority":true,"x":950,"y":280,"wires":[["539e493b.95d5b8"]]},{"id":"a6372d45.90b9b","type":"vertex action","z":"df9465cd.815ae8","name":"Preset 3 50%","typeButton":"single","bPayload":{"action":"setbrightness","group":null,"param":"50","priority":"254"},"bState":"","defaultpriority":true,"x":950,"y":320,"wires":[["539e493b.95d5b8"]]},{"id":"354e9651.8ba36a","type":"vertex action","z":"df9465cd.815ae8","name":"Preset 4 75%","typeButton":"single","bPayload":{"action":"setbrightness","group":null,"param":"75","priority":"254"},"bState":"","defaultpriority":true,"x":950,"y":360,"wires":[["539e493b.95d5b8"]]},{"id":"9792c80a.3ee288","type":"vertex action","z":"df9465cd.815ae8","name":"Preset 5 100%","typeButton":"single","bPayload":{"action":"setbrightness","group":null,"param":"100","priority":"254"},"bState":"","defaultpriority":true,"x":950,"y":400,"wires":[["539e493b.95d5b8"]]},{"id":"2004d106.91b74e","type":"inject","z":"df9465cd.815ae8","name":"OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":330,"y":540,"wires":[["b58ab5b9.855108"]]},{"id":"75fa8f85.63a","type":"inject","z":"df9465cd.815ae8","name":"ON","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":330,"y":580,"wires":[["b58ab5b9.855108"]]},{"id":"57de2e04.e8d69","type":"inject","z":"df9465cd.815ae8","name":"Preset 1 0%","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":350,"y":620,"wires":[["b58ab5b9.855108"]]},{"id":"f15e03a7.04084","type":"inject","z":"df9465cd.815ae8","name":"Preset 2 25%","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3","payloadType":"num","x":350,"y":660,"wires":[["b58ab5b9.855108"]]},{"id":"8b71e05c.57cb2","type":"inject","z":"df9465cd.815ae8","name":"Preset 3 50%","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4","payloadType":"num","x":350,"y":700,"wires":[["b58ab5b9.855108"]]},{"id":"cd557d6f.27f1c","type":"inject","z":"df9465cd.815ae8","name":"Preset 4 75%","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"5","payloadType":"num","x":350,"y":740,"wires":[["b58ab5b9.855108"]]},{"id":"88b7299d.9e77e8","type":"inject","z":"df9465cd.815ae8","name":"Preset 5 100%","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"6","payloadType":"num","x":360,"y":780,"wires":[["b58ab5b9.855108"]]},{"id":"c331af0d.e480a","type":"vertex action","z":"df9465cd.815ae8","name":"OFF","typeButton":"single","bPayload":{"action":"setbrightness","group":null,"param":"0","priority":"254"},"bState":"","defaultpriority":true,"x":920,"y":160,"wires":[["539e493b.95d5b8"]]},{"id":"3b5680e2.64f08","type":"vertex action","z":"df9465cd.815ae8","name":"Dimm","typeButton":"dimm","bPayload":{"DON":{"action":"noreact","group":null,"param":null,"priority":"254"},"HOLDUP":{"action":"upaction","group":null,"param":null,"priority":"254"},"HOLDDOWN":{"action":"downaction","group":null,"param":null,"priority":"254"},"DOFF":{"action":"noreact","group":null,"param":null,"priority":"254"}},"bState":false,"defaultpriority":true,"x":920,"y":460,"wires":[["539e493b.95d5b8"]]},{"id":"66580d3d.1865c4","type":"function","z":"df9465cd.815ae8","name":"Dimm Up/Down","func":"\nif(msg.payload==14)\n{\n msg.payload= { \"HOLDUP\" : 1 };\n return msg;\n}\nelse if(msg.payload==15)\n{\n msg.payload= { \"HOLDUP\" : 2 };\n return msg;\n}\nelse if(msg.payload==16)\n{\n msg.payload= { \"HOLDDOWN\" : 1 };\n return msg;\n}\nelse if(msg.payload==17)\n{\n msg.payload= { \"HOLDDOWN\" : 2 };\n return msg;\n}\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":740,"y":460,"wires":[["3b5680e2.64f08"]]},{"id":"fbb2cf4d.7d254","type":"inject","z":"df9465cd.815ae8","name":"Stop Dimm up","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"15","payloadType":"num","x":350,"y":920,"wires":[["b58ab5b9.855108"]]},{"id":"b34690b5.60988","type":"inject","z":"df9465cd.815ae8","name":"Stop Dimm down","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"17","payloadType":"num","x":360,"y":960,"wires":[["b58ab5b9.855108"]]},{"id":"b58ab5b9.855108","type":"tcp out","z":"df9465cd.815ae8","name":"Broadcast on port 30501 10.0.6.69","host":"10.0.6.69","port":"30501","beserver":"client","base64":false,"end":false,"tls":"","x":820,"y":720,"wires":[]},{"id":"110bf57a.cfb9ab","type":"comment","z":"df9465cd.815ae8","name":"msg.payload = 0","info":"","x":140,"y":540,"wires":[]},{"id":"34e4987c.075608","type":"comment","z":"df9465cd.815ae8","name":"msg.payload = 1","info":"","x":140,"y":580,"wires":[]},{"id":"955dad61.d0478","type":"comment","z":"df9465cd.815ae8","name":"msg.payload = 2","info":"","x":140,"y":620,"wires":[]},{"id":"172aa76e.105a69","type":"comment","z":"df9465cd.815ae8","name":"msg.payload = 3","info":"","x":140,"y":660,"wires":[]},{"id":"23c38344.45cd5c","type":"comment","z":"df9465cd.815ae8","name":"msg.payload = 4","info":"","x":140,"y":700,"wires":[]},{"id":"121b504e.d2c0e","type":"comment","z":"df9465cd.815ae8","name":"msg.payload = 5","info":"","x":140,"y":740,"wires":[]},{"id":"3cbc3e1b.8d2fb2","type":"comment","z":"df9465cd.815ae8","name":"msg.payload = 6","info":"","x":140,"y":780,"wires":[]},{"id":"ccb267c4.5d8b28","type":"comment","z":"df9465cd.815ae8","name":"msg.payload = 15","info":"","x":150,"y":920,"wires":[]},{"id":"bb4dbc96.cbed3","type":"comment","z":"df9465cd.815ae8","name":"msg.payload = 17","info":"","x":150,"y":960,"wires":[]},{"id":"5773b441.c135cc","type":"comment","z":"df9465cd.815ae8","name":"Configure the transmitting node","info":"","x":810,"y":680,"wires":[]},{"id":"b674f6b4.de9bd8","type":"comment","z":"df9465cd.815ae8","name":"Configure the receiving node","info":"","x":160,"y":240,"wires":[]},{"id":"cdf9ab14.a4eb68","type":"comment","z":"df9465cd.815ae8","name":"Set brightness level","info":"","x":930,"y":120,"wires":[]},{"id":"7aa28278.12128c","type":"comment","z":"df9465cd.815ae8","name":"Direct logic to only one Vertex","info":"","x":440,"y":240,"wires":[]},{"id":"8d9032f3.4c17e","type":"inject","z":"df9465cd.815ae8","name":"Dimm down","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"16","payloadType":"num","x":350,"y":880,"wires":[["b58ab5b9.855108"]]},{"id":"f6a56cbb.e4a29","type":"inject","z":"df9465cd.815ae8","name":"Dimm up","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"14","payloadType":"num","x":340,"y":840,"wires":[["b58ab5b9.855108"]]},{"id":"137aaea4.9c01e1","type":"comment","z":"df9465cd.815ae8","name":"msg.payload = 14","info":"","x":150,"y":840,"wires":[]},{"id":"15011a01.e20b76","type":"comment","z":"df9465cd.815ae8","name":"msg.payload = 16","info":"","x":150,"y":880,"wires":[]},{"id":"539e493b.95d5b8","type":"vertex cluster","z":"df9465cd.815ae8","rate":5,"x":1200,"y":280,"wires":[]},{"id":"99760983.b23ec8","type":"vertex filterByVertex","z":"df9465cd.815ae8","selectedVertex":"10.0.6.51","x":400,"y":280,"wires":[["1eeed119.55e54f","66580d3d.1865c4"]]}]
image-20260216-073923.png

Step-by-step instructions

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

  • tcp in

  • Filter by Vertex

  • switch

  • vertex action x8

  • function

  • vertex Cluster

  • inject x11

 

2. In the tcp in node properties, select Type: Listen on [1] and specify the port number for communication [2]. Determine the Output as stream of String [3].

This article contains a detailed description of the network settings: Network requirements

image-20260216-074019.png

3. Go to the Filter by Vertex node and choose the correct Vertex controller as a message source.

 

4. Configure the switch node’s properties. An example shown below.

Each payload value corresponds with a different, preset brightness level. Specify different payloads and set a logic that matches your needs (e.g. setting brightness level using direct input value).

5. Go to the function node properties tab and configure it accordingly. Paste this code in the On Message tab. This code will be executed every time there is an input message (trigger).

image-20260316-080201.png
if(msg.payload==14) { msg.payload= { "HOLDUP" : 1 }; return msg; } else if(msg.payload==15) { msg.payload= { "HOLDUP" : 2 }; return msg; } else if(msg.payload==16) { msg.payload= { "HOLDDOWN" : 1 }; return msg; } else if(msg.payload==17) { msg.payload= { "HOLDDOWN" : 2 }; return msg; }

 

6. Go to the vertex action node and set the Mode field as Single button . Next, in the Action field, choose Set brightness. Set the brightness value of your choice (e.g. 0 - off, 100 - max luminaire brightness) using the slider. Remember to set a group if necessary. Do this for all the necessery vertex action nodes with set values. Here you see an example of two different vertex action nodes.

 

The vertex action node responsible for the dimming process has a different configuration. Set the Mode field as Dimm button. Remember to set a group if necessary. Check if the events are chosen correctly.

7. Use the inject nodes as test triggers for your flow. For now, use 11 of them, 7 for brightness and 4 for dimming control.

image-20260216-074147.png

Configure the nodes as shown. Note that, each Inject node has a different payload value.

 

8. In the properties tab of the tcp out node, select Type: Connect to and specify the port number you wish to use for communication. Enter the host controller ip address.

image-20260216-074338.png

 

Do not forget to click Done and Deploy!

Comments