Created
July 22, 2020 19:30
-
-
Save wittekind/61690f3f8f8008d725a989d35faea5d0 to your computer and use it in GitHub Desktop.
node-red function, that gets the port_overrides array of a specific Unifi device from the output of the node-red-contrib-unifi node's AccessDevices command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "76e8dd64.3526ac", | |
"type": "function", | |
"z": "3eed02d1.e6900e", | |
"name": "extract port_overrides", | |
"func": "const deviceId = \"your device id\";\n\nconst port_overrides = msg.payload.flatMap(site => site) \n .filter(device => device._id == deviceId)\n .flatMap(device => device.port_overrides);\nmsg.payload = port_overrides;\nmsg.device_id = deviceId;\n\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"x": 732, | |
"y": 546, | |
"wires": [ | |
[] | |
] | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment