Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Serial
[
{
"id": "49613054.b1d67",
"type": "xml",
"z": "31f47a75.15b9d6",
"name": "",
"property": "payload",
"attr": "",
"chr": "",
"x": 390,
"y": 240,
"wires": [
[
"d818f11e.81889",
"6fdebd4c.10b684"
]
]
},
{
"id": "23a80426.b2a8dc",
"type": "udp in",
"z": "31f47a75.15b9d6",
"name": "",
"iface": "",
"port": "1234",
"ipv": "udp4",
"multicast": "false",
"group": "",
"datatype": "utf8",
"x": 220,
"y": 240,
"wires": [
[
"49613054.b1d67",
"73fdffc6.6f116"
]
]
},
{
"id": "73fdffc6.6f116",
"type": "debug",
"z": "31f47a75.15b9d6",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 410,
"y": 140,
"wires": []
},
{
"id": "d818f11e.81889",
"type": "function",
"z": "31f47a75.15b9d6",
"name": "",
"func": "let array = [ \"floor_2\", \"floor_3\", \"floor_4\", \"floor_5\", \"floor_6\", \"floor_7\", \"floor_8\", \"floor_9\",\n \"floor_10\", \"floor_11\",\"floor_12\",\"floor_13\",\"floor_14\",\"floor_15\",\"floor_16\",\"floor_17\",\n \"floor_18\", \"floor_19\",\"floor_21\",\"floor_22\",\"floor_23\",\"floor_24\",\"floor_25\",\"floor_26\",\n \"floor_27\", \"floor_28\",\"floor_29\",\"floor_30\",\"floor_31\",\"floor_32\",\"faci_22\" ,\"faci_32\" ]\n\nglobal = msg.payload.XmlCmd.GlobalMacro;\n\nlet channel = 0;\n\nif ( (global[0] === \"Perspective\") || (global[0] === \"walkthrough\") || (global[0] === \"360 View\") || (global[0] === \"ProjectDetail\") || (global[0] === \"Roomlayout\") ) {\n var out = {\n ch : 255,\n value : 1\n }\n msg.payload = JSON.stringify(out);\n node.send(msg);\n} else {\n var out = {\n ch : 255,\n value : 0\n }\n msg.payload = JSON.stringify(out);\n node.send(msg);\n for (let i=0;i<array.length;i++) {\n if (global[0] === array[i]) {\n var out = {\n ch : i,\n value : 1\n }\n msg.payload = JSON.stringify(out);\n node.send(msg);\n break;\n }\n }\n}\n\n// return msg;",
"outputs": 1,
"noerr": 0,
"x": 550,
"y": 240,
"wires": [
[
"c235d48d.f1fbc8"
]
]
},
{
"id": "c235d48d.f1fbc8",
"type": "debug",
"z": "31f47a75.15b9d6",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 710,
"y": 240,
"wires": []
},
{
"id": "6fdebd4c.10b684",
"type": "debug",
"z": "31f47a75.15b9d6",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 570,
"y": 180,
"wires": []
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.