VISCA protocol for camera control

Having looked around for weeks without any success, I decided to create a very rough flow to package VISCA controls for cameras.

By using TCP out or Serial out nodes, it is possible to route the VISCA packets wherever you want them.

This flow is not pretty and I'm sure someone could make a much nicer job of the function nodes, but it works.

The attached flow is Warts and All, all the test injection nodes and my notes, please feel free to do with it whatever you like.

I did try Pelco-D protocol if anyone wants that flow

The Link-In nodes are what I used to link this to a HID Joystick

[{"id":"7577a0.333b786","type":"tab","label":"PTZ / RS422 Visca","disabled":false,"info":"Visca\nSee command spresdheet in Google Drive\nhttps://docs.google.com/spreadsheets/d/1fpq8Ykp2fM3LyuOPZWLI6rqMTgcU5GEu/edit#gid=1320261376\n\n\n\nPelco P tutorial\nhttps://www.commfront.com/pages/pelco-p-protocol-tutorial\n\nxOR the command to get the last Byte\n\n\nPelco D Tutorial\nhttps://www.commfront.com/pages/pelco-d-protocol-tutorial\n\nByte 7 (Checksum) - sum of bytes (excluding the synchronization byte), then modulo 100 (Decimal code: 256)\n\n\nxOR node\nhttps://flows.nodered.org/node/node-red-contrib-boolean-logic\n\nUseful page\nhttps://discourse.nodered.org/t/trying-to-xor-a-hexidecimal-string/15053"},{"id":"523ad0dc.a9962","type":"inject","z":"7577a0.333b786","name":"Cam 1 Preset 5","props":[{"p":"id","v":"1","vt":"num"},{"p":"preset","v":"5","vt":"num"},{"p":"command","v":"call","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1920,"y":1020,"wires":[["2e9a96e0.b0b31a"]]},{"id":"751427b5.1c16d8","type":"inject","z":"7577a0.333b786","name":"Cam 1 ON (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,4,0,2,255]","payloadType":"bin","x":3260,"y":620,"wires":[["c74fbdb38ef68a7c"]]},{"id":"401466d8.b53398","type":"inject","z":"7577a0.333b786","name":"Cam 1 OFF (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,4,0,3,255]","payloadType":"bin","x":3250,"y":580,"wires":[["c74fbdb38ef68a7c"]]},{"id":"d635f99c.b22f48","type":"inject","z":"7577a0.333b786","name":"Call Cam 1 Preset 1","props":[{"p":"id","v":"1","vt":"num"},{"p":"preset","v":"1","vt":"num"},{"p":"command","v":"call","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":1930,"y":780,"wires":[["2e9a96e0.b0b31a"]]},{"id":"2e9a96e0.b0b31a","type":"function","z":"7577a0.333b786","name":"Presets (Call, Set & Clear) (7 Byte)","func":"// set command\n//if (msg.action ===\"call\"){\n//    var byte4 = 7}\nvar byte7 = 255; // EOF\n\nvar byte2 = 0x01; // Always 0x01\n\nvar byte3 = 0x04; // Always 0x04\nvar byte4 = 63; // always 0x3F\nvar byte5 = 0; //0x00\nvar byte6 = 0; // default Preset number 0\n\nvar swap = false;\n\n//if (msg.command != null){\n\nswitch (msg.command) {\n   case \"set\":\n        byte5 = 1;\n        break;\n   case \"clear\":\n        byte5 = 0 ;\n        break;\n   case \"call\":\n        byte5 = 2;\n        break;\n        \n        \n    case \"PanSwapON\":\n        byte4 = 103; // 0x67\n        byte5 = 63 ; // 0x3f\n        swap = true;\n        byte6 = 2 ;\n        break;\n        \n    case \"PanSwapOFF\":\n        byte4 = 103; // 0x67\n        byte5 = 63 ; // 0x3f\n        byte6 = 3 ;\n        swap = true;\n        break;\n        \n    case \"TiltSwapON\":\n        byte4 = 104; // 0x68\n        byte5 = 63 ; // 0x3f\n        byte6 = 2 ;\n        swap = true;\n        break;\n    case \"TiltSwapOFF\":\n\n        byte4 = 104 ; // 0x68\n        byte5 = 63 ; // 0x3f\n        byte6 = 3 ;\n        swap = true;\n}\n\n\n\n// Camera number\nvar byte1 = 129; // default to Visca Cam 0\nif (msg.id !== null){\nbyte1 = 129 + Number(msg.id)\n    \n}\n\n\n  if (global.get(\"CamID\") == null) {\n //     byte1 = 129;\n      global.set(\"CamID\",0);\n  } \n\n\n\nif (msg.id == null) {\nbyte1 = 129 + Number(global.get(\"CamID\"));\n\n                }\nmsg.CamID = byte1;\n\n\n\n\n\nif (swap == false){\n\n// Check Preset\nif (msg.preset != null){\n        byte6 = Number(msg.preset)\n    }\nelse {byte6 = 1}\n}\n\n \n\n\n\n\n msg.payload= Buffer.from([byte1,byte2,byte3,byte4,byte5,byte6,byte7]);\nnode.status({fill:\"red\",shape:\"ring\",text:\"Command =\"+msg.command+\" Preset =\"+byte6+\" Everything else \"+byte1+byte2+byte3+byte4+byte5+byte6+byte7});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2000,"y":660,"wires":[["aabbc22e1c44df08","c74fbdb38ef68a7c"]]},{"id":"602f80c8.e2304","type":"inject","z":"7577a0.333b786","name":"Cam 1 Preset 2","props":[{"p":"id","v":"1","vt":"num"},{"p":"preset","v":"2","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":1920,"y":840,"wires":[["2e9a96e0.b0b31a"]]},{"id":"a7f97130.b0ed1","type":"inject","z":"7577a0.333b786","name":"Cam 1 Preset 3","props":[{"p":"id","v":"1","vt":"num"},{"p":"preset","v":"3","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1920,"y":880,"wires":[["2e9a96e0.b0b31a"]]},{"id":"9df2d972.4bc7f8","type":"inject","z":"7577a0.333b786","name":"Cam 1 Preset 4","props":[{"p":"id","v":"1","vt":"num"},{"p":"preset","v":"4","vt":"num"},{"p":"command","v":"call","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1920,"y":940,"wires":[["2e9a96e0.b0b31a"]]},{"id":"2ee3db4d.d0d444","type":"inject","z":"7577a0.333b786","name":"Cam 1 Call Preset 6","props":[{"p":"id","v":"1","vt":"str"},{"p":"preset","v":"6","vt":"num"},{"p":"command","v":"call","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1930,"y":1080,"wires":[["2e9a96e0.b0b31a"]]},{"id":"897c36a9.0479e8","type":"inject","z":"7577a0.333b786","name":"set Cam 1 Preset 1","props":[{"p":"id","v":"1","vt":"num"},{"p":"preset","v":"1","vt":"num"},{"p":"command","v":"set","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":2170,"y":780,"wires":[["2e9a96e0.b0b31a"]]},{"id":"336c87c4.fce5b8","type":"change","z":"7577a0.333b786","name":"Set CamID to 0","rules":[{"t":"set","p":"CamID","pt":"global","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":4620,"y":2120,"wires":[[]]},{"id":"cc713eb0.31365","type":"inject","z":"7577a0.333b786","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":4400,"y":2120,"wires":[["336c87c4.fce5b8"]]},{"id":"54428946.df9058","type":"change","z":"7577a0.333b786","name":"Set CamID to 8","rules":[{"t":"set","p":"CamID","pt":"global","to":"8","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":4620,"y":2166,"wires":[[]]},{"id":"dc91e768.166788","type":"inject","z":"7577a0.333b786","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":4400,"y":2166,"wires":[["54428946.df9058"]]},{"id":"b73049e6.05fc68","type":"change","z":"7577a0.333b786","name":"Call CamID","rules":[{"t":"set","p":"payload","pt":"msg","to":"CamID","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":2200,"wires":[["827f4bb.1dd98b8"]]},{"id":"517c0843.bf3528","type":"inject","z":"7577a0.333b786","name":"Query","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":280,"y":2200,"wires":[["b73049e6.05fc68"]]},{"id":"827f4bb.1dd98b8","type":"debug","z":"7577a0.333b786","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":670,"y":2200,"wires":[]},{"id":"9e7372d4.20f62","type":"inject","z":"7577a0.333b786","name":"On","props":[{"p":"payload"},{"p":"CamID","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"PON","payloadType":"str","x":970,"y":200,"wires":[["dbe8dc25.43777"]]},{"id":"b1c7a8e2.cad718","type":"inject","z":"7577a0.333b786","name":"OFF","props":[{"p":"payload"},{"p":"CamID","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"POFF","payloadType":"str","x":970,"y":240,"wires":[["2d6971b2.ee8e7e"]]},{"id":"28d1c7dc.4030f8","type":"function","z":"7577a0.333b786","name":"Pan - Tilt","func":"\nvar byte7 = 0;\nvar btye8 = 0;\n\nvar byte9 = 255; // EOF\n\nswitch (msg.command) {\n   case \"up\":\n        byte7 = 3;\n        byte8 = 1;\n        break;\n   case \"down\":\n        byte7 = 3;\n        byte8 = 2;\n        break;\n   case \"left\":\n        byte7 = 1;\n        byte8 = 3;\n        break;\n    case\"right\":\n        byte7 = 2;\n        byte8 = 3;\n        break;\n       case \"upleft\":\n        byte7 = 1;\n        byte8 = 1;\n        break;\n   case \"upright\":\n        byte7 = 2;\n        byte8 = 1;\n        break;\n   case \"downleft\":\n        byte7 = 1;\n        byte8 = 2;\n        break;\n    case\"downright\":\n        byte7 = 2;\n        byte8 = 2;\n        break;\n    case\"stop\":\n        byte7 = 3;\n        byte8 = 3;\n        break;\n    case\"STOP\":\n        byte7 = 3;\n        byte8 = 3;       \n}\n\n\n\n\n\n// Camera number\nvar byte1 = 129; // default to Visca Cam 0\nif (msg.id !== null){\nbyte2 = 129 + Number(msg.id)\n    \n}\n\n\n  if (global.get(\"CamID\") == null) {\n //     byte1 = 129;\n      global.set(\"CamID\",0);\n  } \n\n\n\nif (msg.id == null) {\nbyte1 = 129 + Number(global.get(\"CamID\"));\n\n                }\nmsg.CamID = byte1;\n\n\n\n\nvar byte2 = 1; // Always 1\nvar byte3 = 6; // Always 6\nvar byte4 = 1; // always 1\n\nvar byte5 = 0; // default Pan Speed\n\nif (msg.panSpeed != null){\n    byte5 = Number(msg.panSpeed);\n}\n\n\nif (global.get(\"panSpeed\") == null)\n{\n    global.set(\"panSpeed\",10);\n}\n\nif (msg.panSpeed == null) {\nbyte5 = Number(global.get(\"panSpeed\"));\n}\n\n\n\n\n byte6 = 0; // default tilt speed\n \n \n\nif (msg.tiltSpeed != null){\n        byte6 = Number(msg.tiltSpeed)\n    }\n\nif (global.get(\"tiltSpeed\") == null)\n{\n    global.set(\"tiltSpeed\",10);\n    msg.setSpeed = 10;\n}    \n    \n    \nif (msg.tiltSpeed == null) {\nbyte6 = Number(global.get(\"tiltSpeed\"));\n}\n\n \n\n\n// byte1 =Cam id\n// byte2 = 01\n// byte3 = 06\n// byte4 = 01 // pan tilt command\n// byte5 = PAN speed between 0x01 and (normal 0x18) & (smooth 0x64)\n// byte6 = TILT speed betwen 0x01 and (normal 0x18) & (smooth 0x64)\n\n\n msg.payload= Buffer.from([byte1,byte2,byte3,byte4,byte5,byte6,byte7,byte8,byte9]);\n\nreturn [msg];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2020,"y":3200,"wires":[["c74fbdb38ef68a7c"]]},{"id":"65e8083e.3b8e18","type":"inject","z":"7577a0.333b786","name":"UP @ 18","props":[{"p":"command","v":"up","vt":"str"},{"p":"tiltSpeed","v":"18","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1220,"y":3280,"wires":[["28d1c7dc.4030f8"]]},{"id":"9b8c12cf.2329d","type":"inject","z":"7577a0.333b786","name":"STOP","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"STOP","payloadType":"str","x":1250,"y":3020,"wires":[["fc68dc8f.d7ade"]]},{"id":"6589fe0.35bc604","type":"inject","z":"7577a0.333b786","name":"Down @ 10","props":[{"p":"command","v":"down","vt":"str"},{"p":"tiltSpeed","v":"10","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1230,"y":3360,"wires":[["28d1c7dc.4030f8"]]},{"id":"78c9b5b4.76078c","type":"inject","z":"7577a0.333b786","name":"Right @ 3","props":[{"p":"command","v":"right","vt":"str"},{"p":"panSpeed","v":"3","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1420,"y":3280,"wires":[["28d1c7dc.4030f8"]]},{"id":"d8a62cbf.e99b2","type":"inject","z":"7577a0.333b786","name":"Left @ 10","props":[{"p":"command","v":"left","vt":"str"},{"p":"panSpeed","v":"10","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1420,"y":3360,"wires":[["28d1c7dc.4030f8"]]},{"id":"11243c4b.f0fbc4","type":"change","z":"7577a0.333b786","name":"Set Speeds to Payload","rules":[{"t":"set","p":"tiltSpeed","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2080,"y":2120,"wires":[[]]},{"id":"119b7869.e639d8","type":"inject","z":"7577a0.333b786","name":"12","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"12","payloadType":"num","x":1410,"y":2140,"wires":[["19d4f082.6d1fff","5156883b.c210b8"]]},{"id":"603a6622.692688","type":"inject","z":"7577a0.333b786","name":"UP","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"up","payloadType":"str","x":1230,"y":2860,"wires":[["602d173.7fb9be8"]]},{"id":"b37a9239.3d40a","type":"inject","z":"7577a0.333b786","name":"Down","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"down","payloadType":"str","x":1250,"y":3200,"wires":[["ba95a64.a876258"]]},{"id":"7c4e475e.a16748","type":"inject","z":"7577a0.333b786","name":"Right","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"right","payloadType":"str","x":1630,"y":3000,"wires":[["17decbfa.3c0c94"]]},{"id":"15e285b6.968c1a","type":"inject","z":"7577a0.333b786","name":"Left","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"left","payloadType":"str","x":810,"y":3020,"wires":[["87d6f53.dbb3b08"]]},{"id":"41a21457.e1cc2c","type":"inject","z":"7577a0.333b786","name":"6","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"6","payloadType":"num","x":1410,"y":2100,"wires":[["19d4f082.6d1fff","5156883b.c210b8"]]},{"id":"a21a9ac.3384e68","type":"inject","z":"7577a0.333b786","name":"18","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"18","payloadType":"num","x":1410,"y":2180,"wires":[["19d4f082.6d1fff","5156883b.c210b8"]]},{"id":"d430bcf7.f6833","type":"inject","z":"7577a0.333b786","name":"1","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":1410,"y":2060,"wires":[["19d4f082.6d1fff","5156883b.c210b8"]]},{"id":"60fe86a9.9597c8","type":"inject","z":"7577a0.333b786","name":"IN","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"in","payloadType":"str","x":1030,"y":4040,"wires":[["4b4d07b7.fc6f08"]]},{"id":"f008a536.5dab68","type":"inject","z":"7577a0.333b786","name":"OUT","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"out","payloadType":"str","x":1490,"y":4040,"wires":[["8d91106.4c685f"]]},{"id":"de042d87.3f4af","type":"inject","z":"7577a0.333b786","name":"SET","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"set","payloadType":"str","x":270,"y":760,"wires":[["a90fb6b8.323608","e4d06259.1875f"]]},{"id":"fbd0583a.2f0758","type":"inject","z":"7577a0.333b786","name":"CALL","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"call","payloadType":"str","x":270,"y":840,"wires":[["e4d06259.1875f"]]},{"id":"44fca10f.209d4","type":"inject","z":"7577a0.333b786","name":"Preset 6","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"6","payloadType":"num","x":600,"y":1320,"wires":[["10fe6d1e.ae31e3"]]},{"id":"b8e089f6.255e28","type":"inject","z":"7577a0.333b786","name":"Preset 1","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":220,"y":1180,"wires":[["da35c5dc.1a3d28"]]},{"id":"a9a3f8c4.5ee7d8","type":"inject","z":"7577a0.333b786","name":"Preset 2","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":620,"y":1180,"wires":[["c912e0f9.d65b2"]]},{"id":"fdb520c6.87ca1","type":"inject","z":"7577a0.333b786","name":"Preset 3","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3","payloadType":"num","x":920,"y":1180,"wires":[["23ba1347.d1c6ec"]]},{"id":"7a5fbc3f.abcb44","type":"inject","z":"7577a0.333b786","name":"Preset 5","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"5","payloadType":"num","x":280,"y":1320,"wires":[["a3fb8e82.a9b04"]]},{"id":"79b5c5e8.11be9c","type":"inject","z":"7577a0.333b786","name":"Preset 4","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4","payloadType":"num","x":1220,"y":1180,"wires":[["827687ec.2f1248"]]},{"id":"faafa7ae.82d8d8","type":"change","z":"7577a0.333b786","name":"Preset Global","rules":[{"t":"set","p":"preset","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":920,"wires":[[]]},{"id":"54755f4a.a19aa","type":"function","z":"7577a0.333b786","name":"","func":"msg.command = global.get(\"preset\");\nnode.status({fill:\"red\",shape:\"ring\",text:\"Command =\"+msg.command+\" Preset =\"+msg.preset});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2020,"y":1220,"wires":[["c211feb7.400b","2e9a96e0.b0b31a"]]},{"id":"c211feb7.400b","type":"debug","z":"7577a0.333b786","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":2220,"y":1220,"wires":[]},{"id":"a90fb6b8.323608","type":"delay","z":"7577a0.333b786","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":500,"y":1000,"wires":[["3ddd4fdf.457f9"]]},{"id":"3ddd4fdf.457f9","type":"change","z":"7577a0.333b786","name":"Preset Global to CALL","rules":[{"t":"set","p":"payload","pt":"msg","to":"call","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":1000,"wires":[["e4d06259.1875f"]]},{"id":"f8375c10.1d5fe","type":"change","z":"7577a0.333b786","name":"Set CamID to Payload","rules":[{"t":"set","p":"CamID","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":4640,"y":2020,"wires":[["bc0edcaf.cce38"]]},{"id":"7ddb538c.a3085c","type":"inject","z":"7577a0.333b786","name":"1","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":4390,"y":1980,"wires":[["f8375c10.1d5fe"]]},{"id":"8b1722fa.44105","type":"inject","z":"7577a0.333b786","name":"2","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":4388.33332824707,"y":2016.6666259765625,"wires":[["f8375c10.1d5fe"]]},{"id":"93270ce3.64f54","type":"inject","z":"7577a0.333b786","name":"3","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3","payloadType":"num","x":4390,"y":2060,"wires":[["f8375c10.1d5fe"]]},{"id":"e4d06259.1875f","type":"ui_dropdown","z":"7577a0.333b786","name":"","label":"Mode","tooltip":"Will revert to CALL after 5 seconds","place":"Select option","group":"597ccc60.341d04","order":2,"width":"6","height":"1","passthru":true,"multiple":false,"options":[{"label":"Call","value":"call","type":"str"},{"label":"Set","value":"set","type":"str"}],"payload":"","topic":"topic","topicType":"msg","x":510,"y":920,"wires":[["faafa7ae.82d8d8","929cf326.b545e"]]},{"id":"2be8bc98.8449c4","type":"change","z":"7577a0.333b786","name":"Preset ","rules":[{"t":"set","p":"preset","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"command","pt":"msg","to":"preset","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":1850,"y":1220,"wires":[["54755f4a.a19aa"]]},{"id":"f9fd5e2f.038e6","type":"ui_numeric","z":"7577a0.333b786","name":"","label":"Select Preset","tooltip":"","group":"597ccc60.341d04","order":3,"width":"6","height":"1","wrap":true,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":0,"max":"20","step":1,"x":1630,"y":1220,"wires":[["2be8bc98.8449c4","54b7d701.608598"]]},{"id":"929cf326.b545e","type":"switch","z":"7577a0.333b786","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"set","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":270,"y":920,"wires":[["a90fb6b8.323608"]]},{"id":"da35c5dc.1a3d28","type":"ui_button","z":"7577a0.333b786","name":"","group":"597ccc60.341d04","order":6,"width":"1","height":"1","passthru":true,"label":"1","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"topic","topicType":"msg","x":430,"y":1180,"wires":[["f9fd5e2f.038e6"]]},{"id":"c912e0f9.d65b2","type":"ui_button","z":"7577a0.333b786","name":"","group":"597ccc60.341d04","order":7,"width":"1","height":"1","passthru":true,"label":"2","tooltip":"","color":"","bgcolor":"","icon":"","payload":"2","payloadType":"num","topic":"topic","topicType":"msg","x":750,"y":1180,"wires":[["f9fd5e2f.038e6"]]},{"id":"23ba1347.d1c6ec","type":"ui_button","z":"7577a0.333b786","name":"","group":"597ccc60.341d04","order":8,"width":"1","height":"1","passthru":true,"label":"3","tooltip":"","color":"","bgcolor":"","icon":"","payload":"3","payloadType":"num","topic":"topic","topicType":"msg","x":1050,"y":1180,"wires":[["f9fd5e2f.038e6"]]},{"id":"827687ec.2f1248","type":"ui_button","z":"7577a0.333b786","name":"","group":"597ccc60.341d04","order":9,"width":"1","height":"1","passthru":true,"label":"4","tooltip":"","color":"","bgcolor":"","icon":"","payload":"4","payloadType":"num","topic":"topic","topicType":"msg","x":1350,"y":1180,"wires":[["f9fd5e2f.038e6"]]},{"id":"a3fb8e82.a9b04","type":"ui_button","z":"7577a0.333b786","name":"","group":"597ccc60.341d04","order":12,"width":"1","height":"1","passthru":true,"label":"5","tooltip":"","color":"","bgcolor":"","icon":"","payload":"5","payloadType":"num","topic":"topic","topicType":"msg","x":410,"y":1320,"wires":[["f9fd5e2f.038e6"]]},{"id":"10fe6d1e.ae31e3","type":"ui_button","z":"7577a0.333b786","name":"","group":"597ccc60.341d04","order":13,"width":"1","height":"1","passthru":true,"label":"6","tooltip":"","color":"","bgcolor":"","icon":"","payload":"6","payloadType":"num","topic":"topic","topicType":"msg","x":750,"y":1320,"wires":[["f9fd5e2f.038e6"]]},{"id":"63df01d8.0563b","type":"ui_text_input","z":"7577a0.333b786","name":"","label":"Manual Preset","tooltip":"Enter the value and press enter (or wait 500ms)","group":"597ccc60.341d04","order":17,"width":"6","height":"1","passthru":false,"mode":"number","delay":"500","topic":"topic","topicType":"msg","x":700,"y":1240,"wires":[["f9fd5e2f.038e6"]]},{"id":"54b7d701.608598","type":"change","z":"7577a0.333b786","name":"Set blank","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":1240,"wires":[["63df01d8.0563b"]]},{"id":"7e76a8d3.abbd68","type":"inject","z":"7577a0.333b786","name":"CAM 5","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"5","payloadType":"num","x":3250,"y":2100,"wires":[["5fe2652c.78de2c"]]},{"id":"4628c940.c89a18","type":"inject","z":"7577a0.333b786","name":"CAM 0","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":2970,"y":1960,"wires":[["5bf99130.27609"]]},{"id":"7716b49f.1a7bac","type":"inject","z":"7577a0.333b786","name":"CAM 1","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":3290,"y":1960,"wires":[["a0a53981.3a1b18"]]},{"id":"79860c91.f74d84","type":"inject","z":"7577a0.333b786","name":"CAM 2","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":3590,"y":1960,"wires":[["4874f567.07cb9c"]]},{"id":"2f894843.0464e8","type":"inject","z":"7577a0.333b786","name":"CAM 4","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4","payloadType":"num","x":2950,"y":2100,"wires":[["82b4a105.7276"]]},{"id":"b40d2fc4.5073","type":"inject","z":"7577a0.333b786","name":"CAM 3","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3","payloadType":"num","x":3890,"y":1960,"wires":[["48bac141.8e38f"]]},{"id":"3b31f8f1.2f76a8","type":"ui_numeric","z":"7577a0.333b786","name":"","label":"Select Camera","tooltip":"","group":"5e61a16263303fdd","order":2,"width":"3","height":"1","wrap":true,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":0,"max":"7","step":1,"x":4070,"y":2020,"wires":[["f8375c10.1d5fe","39a5b7ca.ac94f8"]]},{"id":"5bf99130.27609","type":"ui_button","z":"7577a0.333b786","name":"","group":"5e61a16263303fdd","order":3,"width":"2","height":"1","passthru":true,"label":"0","tooltip":"","color":"","bgcolor":"","icon":"","payload":"0","payloadType":"num","topic":"topic","topicType":"msg","x":3110,"y":1960,"wires":[["3b31f8f1.2f76a8"]]},{"id":"a0a53981.3a1b18","type":"ui_button","z":"7577a0.333b786","name":"","group":"5e61a16263303fdd","order":4,"width":"2","height":"1","passthru":true,"label":"1","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"topic","topicType":"msg","x":3430,"y":1960,"wires":[["3b31f8f1.2f76a8"]]},{"id":"4874f567.07cb9c","type":"ui_button","z":"7577a0.333b786","name":"","group":"5e61a16263303fdd","order":5,"width":"2","height":"1","passthru":true,"label":"2","tooltip":"","color":"","bgcolor":"","icon":"","payload":"2","payloadType":"num","topic":"topic","topicType":"msg","x":3730,"y":1960,"wires":[["3b31f8f1.2f76a8"]]},{"id":"48bac141.8e38f","type":"ui_button","z":"7577a0.333b786","name":"","group":"5e61a16263303fdd","order":6,"width":"2","height":"1","passthru":true,"label":"3","tooltip":"","color":"","bgcolor":"","icon":"","payload":"3","payloadType":"num","topic":"topic","topicType":"msg","x":4030,"y":1960,"wires":[["3b31f8f1.2f76a8"]]},{"id":"82b4a105.7276","type":"ui_button","z":"7577a0.333b786","name":"","group":"5e61a16263303fdd","order":7,"width":"2","height":"1","passthru":true,"label":"4","tooltip":"","color":"","bgcolor":"","icon":"","payload":"4","payloadType":"num","topic":"topic","topicType":"msg","x":3090,"y":2100,"wires":[["3b31f8f1.2f76a8"]]},{"id":"5fe2652c.78de2c","type":"ui_button","z":"7577a0.333b786","name":"","group":"5e61a16263303fdd","order":8,"width":"2","height":"1","passthru":true,"label":"5","tooltip":"","color":"","bgcolor":"","icon":"","payload":"5","payloadType":"num","topic":"topic","topicType":"msg","x":3410,"y":2100,"wires":[["3b31f8f1.2f76a8"]]},{"id":"39a5b7ca.ac94f8","type":"ui_text_input","z":"7577a0.333b786","name":"","label":"Camera","tooltip":"Enter the value and press enter (or wait 500ms)","group":"5e61a16263303fdd","order":1,"width":"3","height":"1","passthru":false,"mode":"number","delay":"500","topic":"topic","topicType":"msg","x":3350,"y":2020,"wires":[["3b31f8f1.2f76a8"]]},{"id":"bc0edcaf.cce38","type":"ui_text","z":"7577a0.333b786","group":"597ccc60.341d04","order":1,"width":"6","height":"1","name":"","label":"Camera Number  = ","format":"{{msg.payload}}","layout":"row-center","x":4890,"y":2020,"wires":[]},{"id":"dbe8dc25.43777","type":"ui_button","z":"7577a0.333b786","name":"","group":"5e61a16263303fdd","order":16,"width":"6","height":"1","passthru":true,"label":"ON","tooltip":"","color":"","bgcolor":"GREEN","icon":"","payload":"PON","payloadType":"str","topic":"topic","topicType":"msg","x":1170,"y":200,"wires":[["ea03f2a7.c4a54"]]},{"id":"2d6971b2.ee8e7e","type":"ui_button","z":"7577a0.333b786","name":"","group":"5e61a16263303fdd","order":17,"width":"6","height":"1","passthru":true,"label":"OFF","tooltip":"","color":"","bgcolor":"RED","icon":"","payload":"POFF","payloadType":"str","topic":"topic","topicType":"msg","x":1170,"y":240,"wires":[["ea03f2a7.c4a54"]]},{"id":"ea03f2a7.c4a54","type":"change","z":"7577a0.333b786","name":"","rules":[{"t":"set","p":"command","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1410,"y":280,"wires":[["535311065988ef85"]]},{"id":"868cbdbe.08df","type":"ui_text","z":"7577a0.333b786","group":"73c5347dac61dd36","order":4,"width":"7","height":"1","name":"PTZ label","label":"PTZ Movement","format":"{{msg.command}}","layout":"col-center","className":"","x":2320,"y":1940,"wires":[]},{"id":"19d4f082.6d1fff","type":"ui_slider","z":"7577a0.333b786","name":"","label":"Pan Speed","tooltip":"","group":"73c5347dac61dd36","order":15,"width":"7","height":"1","passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":"1","max":"64","step":1,"x":1770,"y":2060,"wires":[["c96459dd.1d1648"]]},{"id":"c96459dd.1d1648","type":"change","z":"7577a0.333b786","name":"Set PAN Speeds to Payload","rules":[{"t":"set","p":"panSpeed","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2100,"y":2060,"wires":[[]]},{"id":"5156883b.c210b8","type":"ui_slider","z":"7577a0.333b786","name":"","label":"Tilt Speed","tooltip":"","group":"73c5347dac61dd36","order":5,"width":"1","height":"6","passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":"1","max":"64","step":1,"x":1760,"y":2120,"wires":[["11243c4b.f0fbc4"]]},{"id":"fc68dc8f.d7ade","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":10,"width":"2","height":"2","passthru":true,"label":"STOP","tooltip":"","color":"","bgcolor":"","icon":"","payload":"stop","payloadType":"str","topic":"topic","topicType":"msg","x":1400,"y":3020,"wires":[["43b2cacf.733cf4"]]},{"id":"43b2cacf.733cf4","type":"change","z":"7577a0.333b786","name":"","rules":[{"t":"set","p":"command","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2090,"y":3000,"wires":[["28d1c7dc.4030f8","868cbdbe.08df"]]},{"id":"602d173.7fb9be8","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":7,"width":"2","height":"2","passthru":true,"label":"UP","tooltip":"","color":"","bgcolor":"","icon":"","payload":"up","payloadType":"str","topic":"topic","topicType":"msg","x":1390,"y":2860,"wires":[["43b2cacf.733cf4"]]},{"id":"ba95a64.a876258","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":13,"width":"2","height":"2","passthru":true,"label":"DOWN","tooltip":"","color":"","bgcolor":"","icon":"","payload":"down","payloadType":"str","topic":"topic","topicType":"msg","x":1400,"y":3200,"wires":[["43b2cacf.733cf4"]]},{"id":"17decbfa.3c0c94","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":11,"width":"2","height":"2","passthru":true,"label":"Right","tooltip":"","color":"","bgcolor":"","icon":"","payload":"right","payloadType":"str","topic":"topic","topicType":"msg","x":1810,"y":3000,"wires":[["43b2cacf.733cf4"]]},{"id":"87d6f53.dbb3b08","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":9,"width":"2","height":"2","passthru":true,"label":"Left","tooltip":"","color":"","bgcolor":"","icon":"","payload":"left","payloadType":"str","topic":"topic","topicType":"msg","x":950,"y":3020,"wires":[["43b2cacf.733cf4"]]},{"id":"4b4d07b7.fc6f08","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":18,"width":"2","height":"2","passthru":true,"label":"Zoom </br>IN","tooltip":"","color":"","bgcolor":"","icon":"","payload":"in","payloadType":"str","topic":"topic","topicType":"msg","x":1220,"y":4040,"wires":[["0b9b0b99ec688fe7","995323c9d0f00716"]]},{"id":"8d91106.4c685f","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":20,"width":"2","height":"2","passthru":true,"label":"Zoom </br>Out","tooltip":"","color":"","bgcolor":"","icon":"","payload":"out","payloadType":"str","topic":"topic","topicType":"msg","x":1700,"y":4040,"wires":[["0b9b0b99ec688fe7","995323c9d0f00716"]]},{"id":"b0653c76.aa3cd","type":"ui_button","z":"7577a0.333b786","name":"Zoom stop","group":"73c5347dac61dd36","order":19,"width":"3","height":"2","passthru":true,"label":"STOP","tooltip":"","color":"","bgcolor":"","icon":"","payload":"stop","payloadType":"str","topic":"topic","topicType":"msg","x":1390,"y":4100,"wires":[["0b9b0b99ec688fe7","995323c9d0f00716"]]},{"id":"dfc914ee.81a168","type":"inject","z":"7577a0.333b786","name":"Preset 8","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"8","payloadType":"num","x":1200,"y":1320,"wires":[["635593b2.86c27c"]]},{"id":"635593b2.86c27c","type":"ui_button","z":"7577a0.333b786","name":"","group":"597ccc60.341d04","order":15,"width":"1","height":"1","passthru":true,"label":"8","tooltip":"","color":"","bgcolor":"","icon":"","payload":"8","payloadType":"num","topic":"topic","topicType":"msg","x":1350,"y":1320,"wires":[["f9fd5e2f.038e6"]]},{"id":"47c458e1.37bd88","type":"inject","z":"7577a0.333b786","name":"Preset 7","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"7","payloadType":"num","x":900,"y":1320,"wires":[["a2361c91.5c376"]]},{"id":"a2361c91.5c376","type":"ui_button","z":"7577a0.333b786","name":"","group":"597ccc60.341d04","order":14,"width":"1","height":"1","passthru":true,"label":"7","tooltip":"","color":"","bgcolor":"","icon":"","payload":"7","payloadType":"num","topic":"topic","topicType":"msg","x":1030,"y":1320,"wires":[["f9fd5e2f.038e6"]]},{"id":"e8c225b.b0067d8","type":"inject","z":"7577a0.333b786","name":"CAM 7","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"7","payloadType":"num","x":3870,"y":2100,"wires":[["859dcc7b.149c5"]]},{"id":"a043d86e.e4e588","type":"inject","z":"7577a0.333b786","name":"CAM 6","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"6","payloadType":"num","x":3570,"y":2100,"wires":[["1893556d.a15ccb"]]},{"id":"1893556d.a15ccb","type":"ui_button","z":"7577a0.333b786","name":"","group":"5e61a16263303fdd","order":9,"width":"2","height":"1","passthru":true,"label":"6","tooltip":"","color":"","bgcolor":"","icon":"","payload":"6","payloadType":"num","topic":"topic","topicType":"msg","x":3710,"y":2100,"wires":[["3b31f8f1.2f76a8"]]},{"id":"859dcc7b.149c5","type":"ui_button","z":"7577a0.333b786","name":"","group":"5e61a16263303fdd","order":10,"width":"2","height":"1","passthru":true,"label":"7","tooltip":"","color":"","bgcolor":"","icon":"","payload":"7","payloadType":"num","topic":"topic","topicType":"msg","x":4030,"y":2100,"wires":[["3b31f8f1.2f76a8"]]},{"id":"a9c8c88cacb80a0c","type":"comment","z":"7577a0.333b786","name":"Add user nodered to dialout","info":"run this command to add user \"nodered\" to the \"dialout\" group of Linux to enable access to the USB adapter/s\n\n\n\nsudo usermod -a -G dialout nodered","x":3300,"y":1080,"wires":[]},{"id":"8071398b775836fb","type":"function","z":"7577a0.333b786","name":"Zoom & Stop","func":"// Example\n// Camera Visca 0 (0x81) Zoom stop = 81 01 04 07 00 FF - Where 07 is zoom and following 00 is stop\n// Camera Visca 0 (0x81) Zoom in = 81 01 04 07 02 FF - Where 07 is zoom and 02 is Tele / IN\n// Camera Visca 0 (0x81) zoom out = 81 01 04 07 03 FF - Where 07 is zoom and 03 is Wide / OUT\n\nvar byte6 = 255 // EOF\n\nvar command = 0; // default to \"stop\"\n\nif (global.get(\"ZSpeed\") == null){\n       global.set(\"ZSpeed\",4) \n    \n}\n\n\nvar ZSpeed = Number(global.get(\"ZSpeed\"));\n\n//  if (ZSpeed == null){\n//      ZSpeed = 4;\n//      global.set(\"ZSpeed\",4);\n//  }\n\n\nswitch (msg.command) {\n\n   case \"in-step\":\n        command = 4;\n        break;\n    case\"out-step\":\n        command = 5;\n        break;\n    case\"in\":\n        command = 32 + ZSpeed; //0x02 = fixed speed, 0x20 + 1 ~7 = variable (32 + 1 ~7)\n        break;\n    case\"out\":\n        command = 48 + ZSpeed; ////0x03 = fixed speed, 0x30 + 1 ~7 = variable (48 + 1 ~7)\n        break;\n    case\"stop\":\n        command = 0;\n        break;\n    case\"STOP\":\n        command = 0;        \n}\nmsg.command = command;\nvar byte5 = command;\n\n\n\n\n // Camera number\nvar byte1 = 129; // default to Visca Cam 0\nif (msg.id !== null){\nbyte2 = 129 + Number(msg.id)\n    \n}\n\n\n  if (global.get(\"CamID\") == null) {\n //     byte1 = 129;\n      global.set(\"CamID\",0);\n  } \n\n                \nif (msg.CamID == null) {\n    byte1 = 129 + Number(global.get(\"CamID\"));\n    msg.CamID = byte1;\n    }\n\n\n\n\nvar byte2 = 01; // Always 01\n\nvar byte3 = 04; // Always 04\n\nvar byte4 = 07; // Zoom\n\n\n// Checksum calculation\n//  var modo = 100;\n//  \n//  var checksum = (byte1+byte2+byte3+byte4+byte5) % modo;\n//  \n//  msg.checksum = checksum;\n\n\n\nmsg.payload= Buffer.from([byte1,byte2,byte3,byte4,byte5,byte6]);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2170,"y":4040,"wires":[["19619dfa636b42a3","c74fbdb38ef68a7c"]]},{"id":"19619dfa636b42a3","type":"debug","z":"7577a0.333b786","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":2350,"y":4040,"wires":[]},{"id":"ae3a092c64527b5b","type":"inject","z":"7577a0.333b786","name":"stop","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"stop","payloadType":"str","x":1150,"y":4100,"wires":[["b0653c76.aa3cd"]]},{"id":"9e172ae95cce31ae","type":"inject","z":"7577a0.333b786","name":"Cam 1 ZOOM IN (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,4,7,2,255]","payloadType":"bin","x":2880,"y":500,"wires":[["c74fbdb38ef68a7c"]]},{"id":"071e0111fe490d2e","type":"inject","z":"7577a0.333b786","name":"Cam 1 Zoom Stop (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,4,7,0,255]","payloadType":"bin","x":2870,"y":460,"wires":[["c74fbdb38ef68a7c"]]},{"id":"4bed3cad69a3f321","type":"inject","z":"7577a0.333b786","name":"Cam 1 Zoom OUT (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,4,7,3,255]","payloadType":"bin","x":2870,"y":540,"wires":[["c74fbdb38ef68a7c"]]},{"id":"0b9b0b99ec688fe7","type":"change","z":"7577a0.333b786","name":"","rules":[{"t":"set","p":"command","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1970,"y":4040,"wires":[["8071398b775836fb"]]},{"id":"fabda9cdd15e45a9","type":"inject","z":"7577a0.333b786","name":"IN STEP","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"in-step","payloadType":"str","x":1060,"y":4200,"wires":[["e1512aa98e8759a6"]]},{"id":"3b74093fcad725e2","type":"inject","z":"7577a0.333b786","name":"OUT STEP","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"out-step","payloadType":"str","x":1480,"y":4200,"wires":[["9692f3f35da1b7af"]]},{"id":"e1512aa98e8759a6","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":21,"width":"2","height":"1","passthru":true,"label":"IN step","tooltip":"","color":"","bgcolor":"","icon":"","payload":"in-step","payloadType":"str","topic":"topic","topicType":"msg","x":1200,"y":4200,"wires":[["0b9b0b99ec688fe7","995323c9d0f00716"]]},{"id":"9692f3f35da1b7af","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":23,"width":"2","height":"1","passthru":true,"label":"Out step","tooltip":"","color":"","bgcolor":"","icon":"","payload":"out-step","payloadType":"str","topic":"topic","topicType":"msg","x":1660,"y":4200,"wires":[["0b9b0b99ec688fe7","995323c9d0f00716"]]},{"id":"45c0260c7bdb5fa0","type":"inject","z":"7577a0.333b786","name":"Cam 1 Zoom to pos 0 (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,4,71,0,0,0,0,255]","payloadType":"bin","x":2880,"y":620,"wires":[["c74fbdb38ef68a7c"]]},{"id":"44cc23458b1e32c3","type":"inject","z":"7577a0.333b786","name":"Cam 1 Zoom to pos (HEX) max = 4000","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,4,71,3,15,15,15,255]","payloadType":"bin","x":2910,"y":660,"wires":[["c74fbdb38ef68a7c"]]},{"id":"805adcc8d1b6531f","type":"inject","z":"7577a0.333b786","name":"Cam 1 HOME (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,6,4,255]","payloadType":"bin","x":2830,"y":340,"wires":[["c74fbdb38ef68a7c"]]},{"id":"2b460b96f99bc620","type":"inject","z":"7577a0.333b786","name":"Cam 1 RESET (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,6,5,255]","payloadType":"bin","x":2840,"y":400,"wires":[["c74fbdb38ef68a7c"]]},{"id":"30ed1e6747251717","type":"inject","z":"7577a0.333b786","name":"Cam 1 Speed Normal (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,6,31,0,255]","payloadType":"bin","x":2860,"y":860,"wires":[["c74fbdb38ef68a7c"]]},{"id":"5f1f84cc9e8af1b8","type":"inject","z":"7577a0.333b786","name":"Cam 1 Speed Smooth (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,6,31,1,255]","payloadType":"bin","x":2860,"y":900,"wires":[["c74fbdb38ef68a7c"]]},{"id":"e16858fdf33927e0","type":"inject","z":"7577a0.333b786","name":"Cam 1 Set Preset 4","props":[{"p":"id","v":"1","vt":"num"},{"p":"preset","v":"4","vt":"num"},{"p":"command","v":"set","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":2130,"y":940,"wires":[["2e9a96e0.b0b31a"]]},{"id":"b68ab762ded7ccaa","type":"inject","z":"7577a0.333b786","name":"Cam 1 Set Preset 5","props":[{"p":"id","v":"1","vt":"num"},{"p":"preset","v":"5","vt":"num"},{"p":"command","v":"set","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":2130,"y":1020,"wires":[["2e9a96e0.b0b31a"]]},{"id":"5853f4acaccee10a","type":"inject","z":"7577a0.333b786","name":"UP Left","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"upleft","payloadType":"str","x":810,"y":2860,"wires":[["284e191355c49204"]]},{"id":"284e191355c49204","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":6,"width":"2","height":"2","passthru":true,"label":"UP Left","tooltip":"","color":"","bgcolor":"","icon":"","payload":"upleft","payloadType":"str","topic":"topic","topicType":"msg","x":980,"y":2860,"wires":[["43b2cacf.733cf4"]]},{"id":"b59ec9a65c76bfd0","type":"inject","z":"7577a0.333b786","name":"UP Right","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"upright","payloadType":"str","x":1620,"y":2860,"wires":[["333942627b0bc5d5"]]},{"id":"333942627b0bc5d5","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":8,"width":"2","height":"2","passthru":true,"label":"UP Right","tooltip":"","color":"","bgcolor":"","icon":"","payload":"upright","payloadType":"str","topic":"topic","topicType":"msg","x":1780,"y":2860,"wires":[["43b2cacf.733cf4"]]},{"id":"1600208d57eae87a","type":"inject","z":"7577a0.333b786","name":"down Left","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"downleft","payloadType":"str","x":780,"y":3200,"wires":[["7b3f91d05dc9df6f"]]},{"id":"7b3f91d05dc9df6f","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":12,"width":"2","height":"2","passthru":true,"label":"Down Left","tooltip":"","color":"","bgcolor":"","icon":"","payload":"downleft","payloadType":"str","topic":"topic","topicType":"msg","x":940,"y":3200,"wires":[["43b2cacf.733cf4"]]},{"id":"195011f9a40ee3d2","type":"inject","z":"7577a0.333b786","name":"Down Right","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"downright","payloadType":"str","x":1630,"y":3200,"wires":[["8b541f2050af962a"]]},{"id":"8b541f2050af962a","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":14,"width":"2","height":"2","passthru":true,"label":"Down Right","tooltip":"","color":"","bgcolor":"","icon":"","payload":"downright","payloadType":"str","topic":"topic","topicType":"msg","x":1790,"y":3200,"wires":[["43b2cacf.733cf4"]]},{"id":"7d766ac5f2499f74","type":"function","z":"7577a0.333b786","name":"home or reset","func":"\n\n\nvar byte5 = 255; // EOF\n\nswitch (msg.payload) {\n   case \"home\":\n        byte4 = 4;\n\n        break;\n   case \"reset\":\n        byte4 = 5;\n\n              \n}\n\n\n\n\n\n// Camera number\nvar byte1 = 129; // default to Visca Cam 0\nif (msg.id !== null){\nbyte2 = 129 + Number(msg.id)\n    \n}\n\n\n  if (global.get(\"CamID\") == null) {\n //     byte1 = 129;\n      global.set(\"CamID\",0);\n  } \n\n\n\nif (msg.id == null) {\nbyte1 = 129 + Number(global.get(\"CamID\"));\n\n                }\nmsg.CamID = byte1;\n\n\n\n\nvar byte2 = 1; // Always 1\nvar byte3 = 6; // Always 6\n\n\n\n\n// byte1 =Cam id\n// byte2 = 01\n// byte3 = 06\n// byte4 =  command\n\n\n\n msg.payload= Buffer.from([byte1,byte2,byte3,byte4,byte5]);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2220,"y":2340,"wires":[["c74fbdb38ef68a7c"]]},{"id":"878414e599249028","type":"inject","z":"7577a0.333b786","name":"Home","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":1870,"y":2320,"wires":[["7d766ac5f2499f74","5cd26f8f70fa9832"]]},{"id":"7fc002dee45c5e31","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":1,"width":"3","height":"1","passthru":false,"label":"Home","tooltip":"","color":"{{colour}}","bgcolor":"{{BGcolour}}","className":"","icon":"","payload":"home","payloadType":"str","topic":"topic","topicType":"msg","x":1950,"y":2400,"wires":[["7d766ac5f2499f74","5cd26f8f70fa9832"]]},{"id":"80d01c10803ff14e","type":"inject","z":"7577a0.333b786","name":"Reset","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"reset","payloadType":"str","x":1870,"y":2280,"wires":[["aade0531ca1d8fcd"]]},{"id":"aade0531ca1d8fcd","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":3,"width":"3","height":"1","passthru":true,"label":"Reset","tooltip":"","color":"","bgcolor":"","icon":"","payload":"reset","payloadType":"str","topic":"topic","topicType":"msg","x":2030,"y":2280,"wires":[["7d766ac5f2499f74"]]},{"id":"535311065988ef85","type":"function","z":"7577a0.333b786","name":"6 Byte commands ON & OFF. Flip and Speed","func":"\nvar byte6 = 255; // EOF\n\n\n\n\nvar command = 2; // default to \"on\" to be used on byte5\n\nvar byte2 = 01; // Always 0x01\n\nvar byte3 = 04;\nvar byte4 = 0;\n\n\nswitch (msg.command) {\n   case \"Pon\":\n        command = 2;\n        break;\n   case \"Poff\":\n        command = 3 ;\n        break;\n   case \"PON\":\n        command = 2;\n        break;\n   case \"POFF\":\n        command = 3;\n        break;\n    case \"HFlipON\":\n        command = 2;\n        byte4 = 97; // 0x61\n        break;\n   case \"HFlipOFF\":\n        command = 3 ;\n        byte4 = 97; // 0x61\n        break;\n    case \"VFlipON\":\n        command = 2;\n        byte4 = 102; // 0x66\n        break;\n   case \"VFlipOFF\":\n        command = 3 ;\n        byte4 = 102; // 0x66\n        break;\n    case \"SmoothON\":\n        command = 1;\n        byte3 = 06; \n        byte4 = 31; // 0x1f\n        break;\n   case \"SmoothOFF\":\n        command = 0 ;\n        byte3 =  06;\n        byte4 = 31; // 0x1f\n}\n\nmsg.command = command;\nvar byte5 = command;\n\n\n\n// Camera number\nvar byte1 = 129; // default to Visca Cam 0\nif (msg.id !== null){\nbyte1 = 129 + Number(msg.id)\n    \n}\n\n\n  if (global.get(\"CamID\") == null) {\n //     byte1 = 129;\n      global.set(\"CamID\",0);\n  } \n\n\n\nif (msg.id == null) {\nbyte1 = 129 + Number(global.get(\"CamID\"));\n\n                }\nmsg.CamID = byte1;\n\n\n\n\n\n\n\n msg.payload= Buffer.from([byte1,byte2,byte3,byte4,byte5,byte6]);\nnode.status({fill:\"red\",shape:\"ring\",text:\"Command =\"+msg.command+\" Camera =\"+msg.CamID+\"  byte 2 = \"+byte2});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1730,"y":280,"wires":[["ea630d65e52ee60c","c74fbdb38ef68a7c"]]},{"id":"ea630d65e52ee60c","type":"debug","z":"7577a0.333b786","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1910,"y":200,"wires":[]},{"id":"fdcf9c0413ac38ec","type":"inject","z":"7577a0.333b786","name":"H Flip On","props":[{"p":"payload"},{"p":"CamID","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"HFlipON","payloadType":"str","x":980,"y":300,"wires":[["b1142628561defef"]]},{"id":"0235fbd870a61b3d","type":"inject","z":"7577a0.333b786","name":"H Flip Off","props":[{"p":"payload"},{"p":"CamID","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"HFlipOFF","payloadType":"str","x":980,"y":340,"wires":[["b1142628561defef"]]},{"id":"a5a9e6137e6239e6","type":"inject","z":"7577a0.333b786","name":"V Flip On","props":[{"p":"payload"},{"p":"CamID","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"VFlipON","payloadType":"str","x":980,"y":400,"wires":[["4944ee16d4474102"]]},{"id":"754c4b7c076375eb","type":"inject","z":"7577a0.333b786","name":"V Flip Off","props":[{"p":"payload"},{"p":"CamID","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"VFlipOFF","payloadType":"str","x":980,"y":440,"wires":[["4944ee16d4474102"]]},{"id":"b1142628561defef","type":"ui_switch","z":"7577a0.333b786","name":"","label":"Image Hor Flip","tooltip":"","group":"5e61a16263303fdd","order":11,"width":"3","height":"1","passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"HFlipON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"HFlipOFF","offvalueType":"str","officon":"","offcolor":"","animate":false,"x":1180,"y":320,"wires":[["ea03f2a7.c4a54"]]},{"id":"4944ee16d4474102","type":"ui_switch","z":"7577a0.333b786","name":"","label":"Image Vert Flip","tooltip":"","group":"5e61a16263303fdd","order":12,"width":"3","height":"1","passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"VFlipON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"VFlipOFF","offvalueType":"str","officon":"","offcolor":"","animate":false,"x":1180,"y":420,"wires":[["ea03f2a7.c4a54"]]},{"id":"0cc8c7b569fc73ca","type":"inject","z":"7577a0.333b786","name":"0","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":4390,"y":1920,"wires":[["f8375c10.1d5fe"]]},{"id":"ad5bca997c4015e0","type":"inject","z":"7577a0.333b786","name":"Smooth On","props":[{"p":"payload"},{"p":"CamID","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"SmoothON","payloadType":"str","x":970,"y":520,"wires":[["ea03f2a7.c4a54"]]},{"id":"cb3cac643f333916","type":"inject","z":"7577a0.333b786","name":"Smooth Off","props":[{"p":"payload"},{"p":"CamID","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"SmoothOFF","payloadType":"str","x":970,"y":560,"wires":[["ea03f2a7.c4a54"]]},{"id":"e338060204d64282","type":"inject","z":"7577a0.333b786","name":"Cam 1 Standby LED ON","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,0,2,2,2,255]","payloadType":"bin","x":2890,"y":200,"wires":[["c74fbdb38ef68a7c"]]},{"id":"70af4f3fe8819297","type":"inject","z":"7577a0.333b786","name":"Cam 1 Standby LED OFF","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,0,2,2,3,255]","payloadType":"bin","x":2850,"y":160,"wires":[["c74fbdb38ef68a7c"]]},{"id":"5aa4de7476d6c340","type":"function","z":"7577a0.333b786","name":"6 Byte commands Preset Speed","func":"\nvar byte6 = 255; // EOF\n\n\n\n\nvar command = 2; // default to \"on\" to be used on byte5\n\nvar byte2 = 01; // Always 0x01\n\nvar byte3 = 06; // 0x06\nvar byte4 = 32; // 0x20\n\n// Set preset call speed\nvar byte5 = Number (msg.speed);\n\n\n\n// Camera number\nvar byte1 = 129; // default to Visca Cam 0\nif (msg.id !== null){\nbyte1 = 129 + Number(msg.id)\n    \n}\n\n\n  if (global.get(\"CamID\") == null) {\n //     byte1 = 129;\n      global.set(\"CamID\",0);\n  } \n\n\n\nif (msg.id == null) {\nbyte1 = 129 + Number(global.get(\"CamID\"));\n\n                }\nmsg.CamID = byte1;\n\n\n\n\n\n\n\n msg.payload= Buffer.from([byte1,byte2,byte3,byte4,byte5,byte6]);\nnode.status({fill:\"red\",shape:\"ring\",text:\"Camera =\"+msg.CamID+\"  Speed = \"+byte5});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2030,"y":1380,"wires":[["c74fbdb38ef68a7c"]]},{"id":"3ddb8e427b90dc8c","type":"ui_slider","z":"7577a0.333b786","name":"","label":"Preset Call speed","tooltip":"","group":"597ccc60.341d04","order":4,"width":"6","height":"1","passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":0,"max":"7","step":1,"x":1520,"y":1380,"wires":[["597340fece7648e1"]]},{"id":"597340fece7648e1","type":"change","z":"7577a0.333b786","name":"Preset  speed","rules":[{"t":"set","p":"speed","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1750,"y":1380,"wires":[["5aa4de7476d6c340"]]},{"id":"145d9120198d088d","type":"inject","z":"7577a0.333b786","name":"Pan Swap ON","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"PanSwapON","payloadType":"str","x":970,"y":720,"wires":[["2ff4671e98fb323e"]]},{"id":"17e49f90fdb497bd","type":"inject","z":"7577a0.333b786","name":"Pan Swap OFF","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"PanSwapOFF","payloadType":"str","x":980,"y":760,"wires":[["2ff4671e98fb323e"]]},{"id":"aabbc22e1c44df08","type":"debug","z":"7577a0.333b786","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":2230,"y":640,"wires":[]},{"id":"6f7a2ab42aad958d","type":"inject","z":"7577a0.333b786","name":"Tilt Swap ON","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"TiltSwapON","payloadType":"str","x":970,"y":620,"wires":[["91f01172e025db9f"]]},{"id":"d80cd49f03f7729b","type":"inject","z":"7577a0.333b786","name":"Tilt Swap OFF","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"TiltSwapOFF","payloadType":"str","x":970,"y":660,"wires":[["91f01172e025db9f"]]},{"id":"91f01172e025db9f","type":"ui_switch","z":"7577a0.333b786","name":"","label":"Tilt Flip","tooltip":"","group":"5e61a16263303fdd","order":13,"width":"3","height":"1","passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"TiltSwapON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"TiltSwapOFF","offvalueType":"str","officon":"","offcolor":"","animate":false,"x":1180,"y":620,"wires":[["bf34f5b19b4d0eaf"]]},{"id":"2ff4671e98fb323e","type":"ui_switch","z":"7577a0.333b786","name":"","label":"Pan Flip","tooltip":"","group":"5e61a16263303fdd","order":14,"width":"3","height":"1","passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"PanSwapON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"PanSwapOFF","offvalueType":"str","officon":"","offcolor":"","animate":false,"x":1180,"y":720,"wires":[["bf34f5b19b4d0eaf"]]},{"id":"bf34f5b19b4d0eaf","type":"change","z":"7577a0.333b786","name":"","rules":[{"t":"set","p":"command","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1510,"y":660,"wires":[["2e9a96e0.b0b31a"]]},{"id":"9006023a58c2d0db","type":"ui_slider","z":"7577a0.333b786","name":"","label":"Zoom Speed","tooltip":"","group":"73c5347dac61dd36","order":24,"width":"6","height":"2","passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":0,"max":"7","step":1,"className":"","x":1240,"y":4300,"wires":[["0feb165d363ab47a"]]},{"id":"0feb165d363ab47a","type":"change","z":"7577a0.333b786","name":"","rules":[{"t":"set","p":"ZSpeed","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1500,"y":4300,"wires":[[]]},{"id":"7c8d6b64c43a7e50","type":"inject","z":"7577a0.333b786","name":"Cam 1 Zoom to pos (HEX) max = 2000","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,4,71,3,7,14,0,255]","payloadType":"bin","x":2910,"y":700,"wires":[["c74fbdb38ef68a7c"]]},{"id":"c74fbdb38ef68a7c","type":"function","z":"7577a0.333b786","name":"Just a joint","func":"// All this is used for is so that the OUT node can be changed quickly, \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":3030,"y":1140,"wires":[["2e3f0a74e8a51cf2","721687e4757e071f"]]},{"id":"2cdfd943f37daf9b","type":"tcp out","z":"7577a0.333b786","d":true,"host":"192.168.1.252","port":"1259","beserver":"client","base64":false,"end":false,"name":"Cam ID 0 TCP OUT node Visca Default port","x":4330,"y":880,"wires":[]},{"id":"f770aa4fcd0d3c9d","type":"comment","z":"7577a0.333b786","name":"Configure these nodes to connect with your IP camera","info":"This is un-tested, but should work.\n\n\nThe flow was created for Serial connection to multple cameras.","x":4060,"y":740,"wires":[]},{"id":"c9ddb27d994a977c","type":"comment","z":"7577a0.333b786","name":"Test nodes using HEX commands","info":"","x":2830,"y":100,"wires":[]},{"id":"2e3f0a74e8a51cf2","type":"debug","z":"7577a0.333b786","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":3030,"y":1180,"wires":[]},{"id":"1dfe19d0e985cdec","type":"link in","z":"7577a0.333b786","name":"Reset Trigger","links":["e6e629cf.ea8c78","600d8a536110f06d"],"x":1125,"y":2120,"wires":[["8375c75851aa0759"]]},{"id":"8375c75851aa0759","type":"change","z":"7577a0.333b786","name":"Set to 12","rules":[{"t":"set","p":"payload","pt":"msg","to":"12","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1230,"y":2120,"wires":[["19d4f082.6d1fff","5156883b.c210b8"]]},{"id":"9b11046d3aa99593","type":"function","z":"7577a0.333b786","name":"Direct Zoom Variable speed","func":"// Example\n// Camera Visca 0 (0x81) Zoom stop = 81 01 04 07 00 FF - Where 07 is zoom and following 00 is stop\n// Camera Visca 0 (0x81) Zoom in = 81 01 04 07 02 FF - Where 07 is zoom and 02 is Tele / IN\n// Camera Visca 0 (0x81) zoom out = 81 01 04 07 03 FF - Where 07 is zoom and 03 is Wide / OUT\n\n//   CAM_Zoom\tDirect(Speed Variable)\t8x 01 04 47 0p 0q 0r 0s 0t FF\tpqrs: Zoom Position(0x0000~0x4033(720p)/0x406E(1080p)) , Optical Zoom Tele max position: 0x4000,\n//   Speed set to ZSpeed t:0~7(0 :Low, 7:High)\n\n// 10 byte command\n\nvar byte10 = 255 // EOF\n\n\nvar number = (msg.payload); // Maxinum number 16494\n\nif (number >= 16495)\n{\n  return null;  \n}\n\n\nvar hex = number.toString(16);\n\n\n\nvar padding = 4;\n    while (hex.length < padding) {\n        hex = \"0\" + hex;\n    }\n\n\nvar byte5 = \"0x0\"+hex.substring(0,1);\nvar byte6 = \"0x0\"+hex.substring(1,2);\nvar byte7 = \"0x0\"+hex.substring(2,3);\nvar byte8 = \"0x0\"+hex.substring(3);\n\nif (global.get(\"ZSpeed\") == null){\n       global.set(\"ZSpeed\",4) \n    }\nvar ZSpeed = Number(global.get(\"ZSpeed\"));\nvar byte9 = ZSpeed;\n\n\n// Camera number\nvar byte1 = 129; // default to Visca Cam 0\n\nif (global.get(\"CamID\") == null) {\n //     byte1 = 129;\n      global.set(\"CamID\",0);\n  } \n\nif (msg.CamID == null) {\n    byte1 = 129 + Number(global.get(\"CamID\"));\n    msg.CamID = byte1;\n    }\n\n\n\n\nvar byte2 = 01; // Always 01\n\nvar byte3 = 04; // Always 04\n\nvar byte4 = 0x47; //    Dec 71; // Zoom positional with or without speed\n\n\n\n\nmsg.payload= Buffer.from([byte1,byte2,byte3,byte4,byte5,byte6,byte7,byte8,byte9,byte10]);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2360,"y":3760,"wires":[["c74fbdb38ef68a7c","44f6e8d69c920378"]]},{"id":"070f36505c183874","type":"inject","z":"7577a0.333b786","name":"Cam 1 Zoom to pos (HEX) 1080 max = 0x04 0x00 0x06 0x0e = 406E","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,4,71,4,0,6,14,7,255]","payloadType":"bin","x":2840,"y":760,"wires":[["c74fbdb38ef68a7c"]]},{"id":"44f6e8d69c920378","type":"debug","z":"7577a0.333b786","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":2710,"y":3760,"wires":[]},{"id":"801319286cf10ee6","type":"ui_slider","z":"7577a0.333b786","name":"","label":"Zoom Position","tooltip":"","group":"73c5347dac61dd36","order":25,"width":0,"height":0,"passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":"16494","max":"0","step":1,"x":1740,"y":3760,"wires":[["9b11046d3aa99593"]]},{"id":"09a1388f152501e7","type":"inject","z":"7577a0.333b786","name":"Max zoom","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"16494","payloadType":"num","x":1480,"y":3720,"wires":[["801319286cf10ee6"]]},{"id":"6f179d91db3ce790","type":"inject","z":"7577a0.333b786","name":"50% zoom (4000)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4000","payloadType":"num","x":1450,"y":3760,"wires":[["801319286cf10ee6"]]},{"id":"011c4b13915918b5","type":"inject","z":"7577a0.333b786","name":"Min zoom","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":1480,"y":3800,"wires":[["801319286cf10ee6"]]},{"id":"5cd26f8f70fa9832","type":"change","z":"7577a0.333b786","name":"Just a link","rules":[],"action":"","property":"","from":"","to":"","reg":false,"x":2180,"y":2380,"wires":[["c60530514bc1d300"]]},{"id":"c60530514bc1d300","type":"delay","z":"7577a0.333b786","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":2080,"y":3580,"wires":[["68aa3342ea85aac9"]]},{"id":"8ef4ab3670ee6be0","type":"ui_button","z":"7577a0.333b786","name":"","group":"73c5347dac61dd36","order":22,"width":"3","height":"1","passthru":false,"label":"Reset to Middle","tooltip":"","color":"{{colour}}","bgcolor":"{{BGcolour}}","className":"","icon":"","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","x":1820,"y":3640,"wires":[["68aa3342ea85aac9"]]},{"id":"5b4728c78fab1fe6","type":"link in","z":"7577a0.333b786","name":"PTZ Preset Call","links":["c3b660f884dc4a99","275901ecaa940c3e"],"x":1315,"y":1400,"wires":[["f9fd5e2f.038e6"]]},{"id":"6998b0c0349398f3","type":"inject","z":"7577a0.333b786","name":"Preset 6","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"6","payloadType":"num","x":580,"y":1820,"wires":[["8ea644645e365d22"]]},{"id":"4e4912eaec521b3e","type":"inject","z":"7577a0.333b786","name":"Preset 1","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":280,"y":1680,"wires":[["e1c167c17246508b"]]},{"id":"1baba620d428e438","type":"inject","z":"7577a0.333b786","name":"Preset 2","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":600,"y":1680,"wires":[["ef63e5ef17899ed8"]]},{"id":"2707c485b7aabb91","type":"inject","z":"7577a0.333b786","name":"Preset 3","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3","payloadType":"num","x":900,"y":1680,"wires":[["18eb668ac8eddf6b"]]},{"id":"c33391ac0d90d83b","type":"inject","z":"7577a0.333b786","name":"Preset 5","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"5","payloadType":"num","x":260,"y":1820,"wires":[["af51eff3609edcce"]]},{"id":"d65ad7d6820ab1d5","type":"inject","z":"7577a0.333b786","name":"Preset 4","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4","payloadType":"num","x":1200,"y":1680,"wires":[["94e369c86bb0c194"]]},{"id":"e1c167c17246508b","type":"ui_button","z":"7577a0.333b786","name":"","group":"32ce3d3183b5b4be","order":6,"width":"2","height":"2","passthru":true,"label":"1","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"topic","topicType":"msg","x":410,"y":1680,"wires":[["275901ecaa940c3e"]]},{"id":"ef63e5ef17899ed8","type":"ui_button","z":"7577a0.333b786","name":"","group":"32ce3d3183b5b4be","order":7,"width":"2","height":"2","passthru":true,"label":"2","tooltip":"","color":"","bgcolor":"","icon":"","payload":"2","payloadType":"num","topic":"topic","topicType":"msg","x":730,"y":1680,"wires":[["275901ecaa940c3e"]]},{"id":"18eb668ac8eddf6b","type":"ui_button","z":"7577a0.333b786","name":"","group":"32ce3d3183b5b4be","order":8,"width":"2","height":"2","passthru":true,"label":"3","tooltip":"","color":"","bgcolor":"","icon":"","payload":"3","payloadType":"num","topic":"topic","topicType":"msg","x":1030,"y":1680,"wires":[["275901ecaa940c3e"]]},{"id":"94e369c86bb0c194","type":"ui_button","z":"7577a0.333b786","name":"","group":"32ce3d3183b5b4be","order":9,"width":"2","height":"2","passthru":true,"label":"4","tooltip":"","color":"","bgcolor":"","icon":"","payload":"4","payloadType":"num","topic":"topic","topicType":"msg","x":1330,"y":1680,"wires":[["275901ecaa940c3e"]]},{"id":"af51eff3609edcce","type":"ui_button","z":"7577a0.333b786","name":"","group":"32ce3d3183b5b4be","order":13,"width":"2","height":"2","passthru":true,"label":"5","tooltip":"","color":"","bgcolor":"","icon":"","payload":"5","payloadType":"num","topic":"topic","topicType":"msg","x":390,"y":1820,"wires":[["275901ecaa940c3e"]]},{"id":"8ea644645e365d22","type":"ui_button","z":"7577a0.333b786","name":"","group":"32ce3d3183b5b4be","order":14,"width":"2","height":"2","passthru":true,"label":"6","tooltip":"","color":"","bgcolor":"","icon":"","payload":"6","payloadType":"num","topic":"topic","topicType":"msg","x":730,"y":1820,"wires":[["275901ecaa940c3e"]]},{"id":"8c654430a44b90ae","type":"inject","z":"7577a0.333b786","name":"Preset 8","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"8","payloadType":"num","x":1180,"y":1820,"wires":[["fb9e5dd8d64a851c"]]},{"id":"fb9e5dd8d64a851c","type":"ui_button","z":"7577a0.333b786","name":"","group":"32ce3d3183b5b4be","order":16,"width":"2","height":"2","passthru":true,"label":"8","tooltip":"","color":"","bgcolor":"","icon":"","payload":"8","payloadType":"num","topic":"topic","topicType":"msg","x":1330,"y":1820,"wires":[["275901ecaa940c3e"]]},{"id":"e078b383a571acac","type":"inject","z":"7577a0.333b786","name":"Preset 7","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"7","payloadType":"num","x":880,"y":1820,"wires":[["924307e5e217063e"]]},{"id":"924307e5e217063e","type":"ui_button","z":"7577a0.333b786","name":"","group":"32ce3d3183b5b4be","order":15,"width":"2","height":"2","passthru":true,"label":"7","tooltip":"","color":"","bgcolor":"","icon":"","payload":"7","payloadType":"num","topic":"topic","topicType":"msg","x":1010,"y":1820,"wires":[["275901ecaa940c3e"]]},{"id":"275901ecaa940c3e","type":"link out","z":"7577a0.333b786","name":"PTZ Preset >>>","links":["5b4728c78fab1fe6"],"x":1635,"y":1760,"wires":[]},{"id":"fb7bc77deeb4a24f","type":"comment","z":"7577a0.333b786","name":"Source Group presets","info":"","x":750,"y":1600,"wires":[]},{"id":"2931b854bb0dcd09","type":"inject","z":"7577a0.333b786","name":"Cam 1 Preset speed 0 (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,6,32,0,255]","payloadType":"bin","x":2540,"y":1100,"wires":[["c74fbdb38ef68a7c"]]},{"id":"ace8b3339ab0d392","type":"inject","z":"7577a0.333b786","name":"Cam 1 Preset speed 7 (HEX)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[129,1,6,32,7,255]","payloadType":"bin","x":2540,"y":1160,"wires":[["c74fbdb38ef68a7c"]]},{"id":"04c2dd5c84a3713c","type":"link in","z":"7577a0.333b786","name":"Reset / Startup","links":["e6e629cf.ea8c78","7cb5e4b4d358e786"],"x":85,"y":880,"wires":[["833a9ce7cb7dcf28"]]},{"id":"833a9ce7cb7dcf28","type":"change","z":"7577a0.333b786","name":"Set to Call","rules":[{"t":"set","p":"payload","pt":"msg","to":"call","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":880,"wires":[["e4d06259.1875f"]]},{"id":"600d8a536110f06d","type":"link out","z":"7577a0.333b786","name":"","links":["1dfe19d0e985cdec"],"x":815,"y":2120,"wires":[]},{"id":"721687e4757e071f","type":"switch","z":"7577a0.333b786","name":"","property":"payload[0]","propertyType":"msg","rules":[{"t":"eq","v":"0x81","vt":"str"},{"t":"eq","v":"0x82","vt":"str"},{"t":"eq","v":"0x83","vt":"str"},{"t":"eq","v":"0x84","vt":"str"},{"t":"eq","v":"0x85","vt":"str"},{"t":"eq","v":"0x86","vt":"str"},{"t":"eq","v":"0x87","vt":"str"},{"t":"eq","v":"0x88","vt":"str"},{"t":"eq","v":"0x89","vt":"str"},{"t":"eq","v":"0x8a","vt":"str"}],"checkall":"true","repair":false,"outputs":10,"x":3950,"y":1100,"wires":[["2cdfd943f37daf9b","9dccf21eeb261072"],["f02885ce9a8e5e7e"],["89ce47108bcb634e"],["334811048f4d9cb0"],["d218ade27c52b94d"],["35758e673ebc0b1b"],["65b4f24c28186ad1"],["7c549b3b07dacb20"],["2ad42c0a99d3a162"],["1f72e8242a61111b","2d5db651b67422c0"]],"outputLabels":["Cam ID 0","Cam ID 1","Cam ID 2","Cam ID 3","Cam ID 4","Cam ID 5","Cam ID 6","Cam ID 7","Cam ID 8","Cam ID 9"]},{"id":"6bb6f76f76093d34","type":"tcp out","z":"7577a0.333b786","d":true,"host":"192.168.100.235","port":"1259","beserver":"client","base64":false,"end":false,"name":"Cam ID 1 TCP OUT node Visca Default port","x":4730,"y":940,"wires":[]},{"id":"d77c0225d2b19455","type":"tcp out","z":"7577a0.333b786","d":true,"host":"192.168.100.144","port":"52381","beserver":"client","base64":false,"end":false,"name":"Cam ID 2 TCP OUT node Visca Default port","x":4730,"y":1060,"wires":[]},{"id":"334811048f4d9cb0","type":"tcp out","z":"7577a0.333b786","d":true,"host":"192.168.0.100","port":"3001","beserver":"client","base64":false,"end":false,"name":"Cam ID 3 TCP OUT node Visca Default port","x":4470,"y":1300,"wires":[]},{"id":"d218ade27c52b94d","type":"tcp out","z":"7577a0.333b786","d":true,"host":"192.168.0.100","port":"3001","beserver":"client","base64":false,"end":false,"name":"Cam ID 4 TCP OUT node Visca Default port","x":4390,"y":1340,"wires":[]},{"id":"35758e673ebc0b1b","type":"tcp out","z":"7577a0.333b786","d":true,"host":"192.168.0.100","port":"3001","beserver":"client","base64":false,"end":false,"name":"Cam ID 5 TCP OUT node Visca Default port","x":4470,"y":1380,"wires":[]},{"id":"65b4f24c28186ad1","type":"tcp out","z":"7577a0.333b786","d":true,"host":"192.168.0.100","port":"3001","beserver":"client","base64":false,"end":false,"name":"Cam ID 6 TCP OUT node Visca Default port","x":4390,"y":1420,"wires":[]},{"id":"7c549b3b07dacb20","type":"tcp out","z":"7577a0.333b786","d":true,"host":"192.168.0.100","port":"3001","beserver":"client","base64":false,"end":false,"name":"Cam ID 7 TCP OUT node Visca Default port","x":4470,"y":1460,"wires":[]},{"id":"2ad42c0a99d3a162","type":"tcp out","z":"7577a0.333b786","d":true,"host":"192.168.0.100","port":"3001","beserver":"client","base64":false,"end":false,"name":"Cam ID 8 TCP OUT node Visca Default port","x":4370,"y":1500,"wires":[]},{"id":"1f72e8242a61111b","type":"tcp out","z":"7577a0.333b786","d":true,"host":"192.168.0.100","port":"3001","beserver":"client","base64":false,"end":false,"name":"Cam ID 9 TCP OUT node Visca Default port","x":4450,"y":1540,"wires":[]},{"id":"9dccf21eeb261072","type":"debug","z":"7577a0.333b786","name":"VISCA output","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":3860,"y":960,"wires":[]},{"id":"2d5db651b67422c0","type":"debug","z":"7577a0.333b786","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":4270,"y":1580,"wires":[]},{"id":"7a290f3b332dc721","type":"inject","z":"7577a0.333b786","name":"Preset 9","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"9","payloadType":"num","x":280,"y":1900,"wires":[["cb9fc2cbf65a4a86"]]},{"id":"cb9fc2cbf65a4a86","type":"ui_button","z":"7577a0.333b786","name":"","group":"32ce3d3183b5b4be","order":16,"width":"2","height":"2","passthru":true,"label":"9","tooltip":"","color":"","bgcolor":"","icon":"","payload":"9","payloadType":"num","topic":"topic","topicType":"msg","x":430,"y":1900,"wires":[["275901ecaa940c3e"]]},{"id":"9da327fba4035a4a","type":"function","z":"7577a0.333b786","name":"8 Byte Tally set","func":"//      Tally Mode : 8x 01 7E 01 0A 01 0p FF\n//      p = 0 : OFF\n//      p = 4 : On (half-brightness)\n//      p = 5 : On (full-brightness)\n\n//      Tally Mode\tSet Tally Mode\t8x 01 7E 01 0A 01 0p FF\tp:\n//          p = 0: (Red:OFF)\n//          p = 4: (Red:Low light)   - Tally Lamp must be Enabled\n//          p = 5: (Red:Highlight)   - Tally Lamp must be Enabled\n//\n//      Tally_Lamp\tOn\t8x 01 7E 01 0A 00 02 FF\tTally Lamp ON/OFF\n//              \tOff\t8x 01 7E 01 0A 00 03 FF\t\n\n\n\nvar byte8 = 255; // EOF\n\n\n\n\nvar command = 0; // default to \"off\"  to be used on byte7\nvar tally = \"Off\"; // Default to off\n\nswitch(msg.payload) {\n\n    case \"off\":\n    command = 0x00;\n    tally = \"Off\";\n    break;\n        case 0 :\n    command = 0x03;\n    tally = \"Off\";\n    break;\n            case false :\n    command = 0x00;\n    tally = \"Off\";\n    break;\n    \n    case \"on\":\n    command = 0x02;\n    tally = \"On\";\n    break;\n        case true:\n    command = 0x02;\n    tally = \"On\";\n    break\n    case 5:\n    command = 0x05;\n    tally = \"On\";\n    break\n    \n    \n    case \"half\":\n    command = 0x04;\n    tally = \"Half\";\n    break;\n        case 4:\n    command = 0x04;\n    tally = \"Half\";\n    break;\ndefault:\ncommand = 0x00; // default to OFF\n            }\n            \n            \n\n\nvar byte2 = 0x01; // Always 0x01\n\nvar byte3 = 0x7E; // 0x7E\nvar byte4 = 0x01; // 0x20\n\n\nvar byte5 = 0x0A;\nvar byte6 = 0x01;\nvar byte7 = command ; // Tally state\n\n\n// Camera number\nvar byte1 = 129; // default to Visca Cam 0\nif (msg.id !== null){\nbyte1 = 129 + Number(msg.id)\n    \n}\n\n\n  if (global.get(\"CamID\") == null) {\n //     byte1 = 129;\n      global.set(\"CamID\",0);\n  } \n\n\n\nif (msg.id == null) {\nbyte1 = 129 + Number(global.get(\"CamID\"));\n\n                }\nmsg.CamID = byte1;\n\n\n\n\n\n\n\n msg.payload= Buffer.from([byte1,byte2,byte3,byte4,byte5,byte6,byte7,byte8]);\nnode.status({fill:\"red\",shape:\"ring\",text:\"Tally state of Camera =\"+msg.CamID+\"  State = \"+tally});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2320,"y":1520,"wires":[["c0333c8d733e021b","c74fbdb38ef68a7c"]]},{"id":"c0333c8d733e021b","type":"debug","z":"7577a0.333b786","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":2610,"y":1500,"wires":[]},{"id":"2c39891dbdba3662","type":"inject","z":"7577a0.333b786","name":"ON","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":1980,"y":1500,"wires":[["9da327fba4035a4a"]]},{"id":"e9f9409e4b6a72e1","type":"inject","z":"7577a0.333b786","name":"OFF","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":1970,"y":1600,"wires":[["9da327fba4035a4a"]]},{"id":"52c343683270b0ca","type":"inject","z":"7577a0.333b786","name":"Half","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"half","payloadType":"str","x":1970,"y":1540,"wires":[["9da327fba4035a4a"]]},{"id":"e1446d1a384cec5c","type":"ui_button","z":"7577a0.333b786","d":true,"name":"","group":"5e61a16263303fdd","order":17,"width":0,"height":0,"passthru":false,"label":"Tally ON","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","x":1770,"y":1500,"wires":[["9da327fba4035a4a"]]},{"id":"603831f036afa0c0","type":"ui_button","z":"7577a0.333b786","d":true,"name":"","group":"5e61a16263303fdd","order":17,"width":0,"height":0,"passthru":false,"label":"Tally Half","tooltip":"","color":"","bgcolor":"","icon":"","payload":"half","payloadType":"str","topic":"topic","topicType":"msg","x":1760,"y":1540,"wires":[["9da327fba4035a4a"]]},{"id":"93a1201f4cf07465","type":"ui_button","z":"7577a0.333b786","d":true,"name":"","group":"5e61a16263303fdd","order":17,"width":0,"height":0,"passthru":false,"label":"Tally OFF","tooltip":"","color":"","bgcolor":"","icon":"","payload":"false","payloadType":"bool","topic":"topic","topicType":"msg","x":1760,"y":1580,"wires":[["9da327fba4035a4a"]]},{"id":"0e1642a4eac746c0","type":"change","z":"7577a0.333b786","name":"Set CAM ID to 0 (Zero)","rules":[{"t":"set","p":"payload[0]","pt":"msg","to":"0X81","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":4400,"y":740,"wires":[[]]},{"id":"f02885ce9a8e5e7e","type":"change","z":"7577a0.333b786","name":"Set CAM ID to 0 (Zero)","rules":[{"t":"set","p":"payload[0]","pt":"msg","to":"0X81","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":4380,"y":940,"wires":[["6bb6f76f76093d34"]]},{"id":"89ce47108bcb634e","type":"change","z":"7577a0.333b786","name":"Set CAM ID to 0 (Zero)","rules":[{"t":"set","p":"payload[0]","pt":"msg","to":"0X81","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":4400,"y":1060,"wires":[["d77c0225d2b19455"]]},{"id":"4ce7c4794e76d62c","type":"comment","z":"7577a0.333b786","name":"Auto @ 10:00 Everyday","info":"","x":200,"y":1120,"wires":[]},{"id":"3e04fdc91dbeb778","type":"link in","z":"7577a0.333b786","name":"","links":[],"x":105,"y":1240,"wires":[["da35c5dc.1a3d28"]]},{"id":"b3af84c249ae46b7","type":"ui_joystick","z":"7577a0.333b786","d":true,"name":"Joystick","group":"73c5347dac61dd36","order":16,"width":"7","height":"7","trigger":"all","timeInterval":"300","useThemeColor":false,"color":"#ff3300","threshold":"0.05","directions":"all","shape":"circle","centerAtRelease":true,"x":230,"y":2920,"wires":[["6debcc57d3a76c11","8986a4b50dbeee31","344e443096751a0c","b09f0dd9145504d9","740a40351f0b9102","4c73b6c65d40229d"]]},{"id":"685ecbd76046ad61","type":"debug","z":"7577a0.333b786","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":590,"y":2920,"wires":[]},{"id":"6debcc57d3a76c11","type":"function","z":"7577a0.333b786","name":"Set direction in text","func":"// msg.payload = msg.payload.direction.x+\"\"+msg.payload.direction.y;\nvar threshold = 22;\n\n\n\nif (msg.topic ==\"rested\"){\n    msg.payload=\"stop\"\n    return msg;\n}\n\nif (msg.payload.angle.degree < 315 +threshold  && msg.payload.angle.degree > 315 - threshold){\n       msg.payload=\"downright\"\n    return msg; \n}\n\n\nif (msg.payload.angle.degree < 270 + threshold && msg.payload.angle.degree > 270 - threshold){\n       msg.payload=\"down\"\n    return msg; \n}\n\nif (msg.payload.angle.degree < 225 + threshold && msg.payload.angle.degree > 225 - threshold){\n       msg.payload=\"downleft\"\n    return msg; \n}\n\n\nif (msg.payload.angle.degree < 180 + threshold && msg.payload.angle.degree > 180 - threshold){\n       msg.payload=\"left\"\n    return msg; \n}\n\nif (msg.payload.angle.degree < 135 + threshold && msg.payload.angle.degree > 135 - threshold){\n       msg.payload=\"upleft\"\n    return msg; \n}\n\nif (msg.payload.angle.degree < 90 + threshold && msg.payload.angle.degree > 90 - threshold){\n       msg.payload=\"up\"\n    return msg; \n}\n\nif (msg.payload.angle.degree < 45 + threshold && msg.payload.angle.degree > 45 - threshold){\n       msg.payload=\"upright\"\n    return msg; \n}\n\nif (msg.payload.angle.degree > 0 && msg.payload.angle.degree < threshold){\n       msg.payload=\"right\"\n    return msg; \n}\n\nif (msg.payload.angle.degree > 338 && msg.payload.angle.degree < 361){\n       msg.payload=\"right\"\n    return msg; \n}\n\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":2920,"wires":[["685ecbd76046ad61","43b2cacf.733cf4"]]},{"id":"8986a4b50dbeee31","type":"debug","z":"7577a0.333b786","name":"Joystick full msg","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":180,"y":2420,"wires":[]},{"id":"344e443096751a0c","type":"debug","z":"7577a0.333b786","name":"Joystick Topic","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"topic","statusType":"msg","x":420,"y":2420,"wires":[]},{"id":"b09f0dd9145504d9","type":"debug","z":"7577a0.333b786","name":"Degree","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload.angle.degree","statusType":"msg","x":160,"y":2980,"wires":[]},{"id":"740a40351f0b9102","type":"debug","z":"7577a0.333b786","name":"distance","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload.distance","statusType":"msg","x":160,"y":3040,"wires":[]},{"id":"4c73b6c65d40229d","type":"function","z":"7577a0.333b786","name":"Set both Speeds","func":"// Set maxSpeed to the fastest you want the Pan and Tilt to be\n// Depending on the camera movement resolution, this might be 30 or 64\n\nvar maxSpeed = 30;\n\n\n\nvar multipler = 100 / maxSpeed;\n\nvar distance = msg.payload.distance;\nvar speed = distance / multipler;\nmsg.payload = speed.toFixed(0);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":2440,"wires":[["421ae4a80f5cac9d","19d4f082.6d1fff","5156883b.c210b8"]]},{"id":"421ae4a80f5cac9d","type":"debug","z":"7577a0.333b786","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":830,"y":2340,"wires":[]},{"id":"5b72539c.63192c","type":"serial in","z":"7577a0.333b786","d":true,"name":"UART","serial":"ec13252.94341d8","x":190,"y":3220,"wires":[["954fa243.00c0b8"]]},{"id":"954fa243.00c0b8","type":"function","z":"7577a0.333b786","name":"decode button input","func":"var tId = msg.payload.readUInt8(0);\n\nswitch(tId){\n    case 0x01:\n        return [{}, null, null, null];\n    case 0x02:\n        return [null, {}, null, null];\n    case 0x04:\n        return [null, null, {}, null];\n    case 0x08:\n        return [null, null, null, {}];\n}\n","outputs":4,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":3220,"wires":[[],[],[],[]]},{"id":"a44426193bd81b84","type":"comment","z":"7577a0.333b786","name":"Phyiscal joystick testing","info":"from \n\nhttps://flows.nodered.org/node/node-red-contrib-game_controllerizer#\n\n","x":250,"y":3160,"wires":[]},{"id":"51f46ba87dd289af","type":"function","z":"7577a0.333b786","name":"Set Speed","func":"// Set maxSpeed to the fastest you want the Pan and Tilt to be\n// Depending on the camera movement resolution, this might be 30 or 64\n\nvar maxSpeed = 7;\n\n\n\nvar multipler = 100 / maxSpeed;\n\nvar distance = msg.payload.distance;\nvar speed = distance / multipler;\nmsg.payload = speed.toFixed(0);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1050,"y":4300,"wires":[["9006023a58c2d0db"]]},{"id":"fb3331dc53bce89d","type":"link in","z":"7577a0.333b786","name":"JS Zoom speed","links":["02443e36a20853de"],"x":895,"y":4300,"wires":[["51f46ba87dd289af"]]},{"id":"704fd820a578d3fb","type":"function","z":"7577a0.333b786","name":"Set PAN Speed","func":"// Set maxSpeed to the fastest you want the Pan and Tilt to be\n// Depending on the camera movement resolution, this might be 30 or 64\n\nvar maxSpeed = 30;\n\n\n\nvar multipler = 100 / maxSpeed;\n\nvar distance = msg.payload;\nvar speed = distance / multipler;\nmsg.payload = speed.toFixed(0);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":2040,"wires":[["19d4f082.6d1fff"]]},{"id":"cf59e0a1f1ce7192","type":"function","z":"7577a0.333b786","name":"Set TILT Speed","func":"// Set maxSpeed to the fastest you want the Pan and Tilt to be\n// Depending on the camera movement resolution, this might be 30 or 64\n\nvar maxSpeed = 30;\n\n\n\nvar multipler = 100 / maxSpeed;\n\nvar distance = msg.payload;\nvar speed = distance / multipler;\nmsg.payload = speed.toFixed(0);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":2080,"wires":[["5156883b.c210b8"]]},{"id":"be8e12f88e569e42","type":"link in","z":"7577a0.333b786","name":"PAN Speed","links":["f53100ea2109d3a8"],"x":825,"y":2040,"wires":[["704fd820a578d3fb"]]},{"id":"8d8a562a2176bf13","type":"link in","z":"7577a0.333b786","name":"Tilt Speed","links":["273752c327504260"],"x":815,"y":2080,"wires":[["cf59e0a1f1ce7192"]]},{"id":"393453461c7fd830","type":"link in","z":"7577a0.333b786","name":"PTZ Home button","links":["384baf8f0b236a6c"],"x":1195,"y":2380,"wires":[["88aecc9aa3927c3f"]]},{"id":"3b2def32aa672515","type":"link in","z":"7577a0.333b786","name":"PTZ Zoom Stop","links":["b2eb717e3bddd61c"],"x":1035,"y":4100,"wires":[["b0653c76.aa3cd"]]},{"id":"f8d6fe41a8e37194","type":"link in","z":"7577a0.333b786","name":"PTZ Zoom IN","links":["676c8bbc0f55c8d2"],"x":895,"y":4040,"wires":[["4b4d07b7.fc6f08"]]},{"id":"1092937da844d4bd","type":"link in","z":"7577a0.333b786","name":"PTZ Zoom OUT","links":["f96e9a47ffca73f9"],"x":1495,"y":4000,"wires":[["8d91106.4c685f"]]},{"id":"21ed9c467b6e43ea","type":"link in","z":"7577a0.333b786","name":"PTZ Movement Compass","links":["d19f7d4c3b395b6c"],"x":475,"y":3060,"wires":[["1bc0f0881cf4ea5c"]]},{"id":"1bc0f0881cf4ea5c","type":"switch","z":"7577a0.333b786","name":"","property":"compass","propertyType":"msg","rules":[{"t":"eq","v":"center","vt":"str"},{"t":"eq","v":"up","vt":"str"},{"t":"eq","v":"upright","vt":"str"},{"t":"eq","v":"right","vt":"str"},{"t":"eq","v":"downright","vt":"str"},{"t":"eq","v":"down","vt":"str"},{"t":"eq","v":"downleft","vt":"str"},{"t":"eq","v":"left","vt":"str"},{"t":"eq","v":"upleft","vt":"str"}],"checkall":"false","repair":false,"outputs":9,"x":590,"y":3080,"wires":[["fc68dc8f.d7ade"],["602d173.7fb9be8"],["333942627b0bc5d5"],["17decbfa.3c0c94"],["8b541f2050af962a"],["ba95a64.a876258"],["7b3f91d05dc9df6f"],["87d6f53.dbb3b08"],["284e191355c49204"]]},{"id":"995323c9d0f00716","type":"ui_text","z":"7577a0.333b786","group":"73c5347dac61dd36","order":17,"width":"7","height":"1","name":"","label":"Zoom","format":"{{msg.payload}}","layout":"col-center","className":"","x":1510,"y":3920,"wires":[]},{"id":"870d40b2797a22a9","type":"change","z":"7577a0.333b786","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"home","tot":"str"},{"t":"set","p":"colour","pt":"msg","to":"black","tot":"str"},{"t":"set","p":"BGcolour","pt":"msg","to":"red","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1540,"y":2380,"wires":[["7d766ac5f2499f74","5cd26f8f70fa9832","b1ec4360de6c57f3","7fc002dee45c5e31"]]},{"id":"88aecc9aa3927c3f","type":"switch","z":"7577a0.333b786","name":"","property":"button[2]","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1300,"y":2380,"wires":[["870d40b2797a22a9"],["fe75354d9aa17ce9"]]},{"id":"fe75354d9aa17ce9","type":"change","z":"7577a0.333b786","name":"set to blue","rules":[{"t":"set","p":"colour","pt":"msg","to":"white","tot":"str"},{"t":"set","p":"BGcolour","pt":"msg","to":"blue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1530,"y":2420,"wires":[["7fc002dee45c5e31","b1ec4360de6c57f3"]]},{"id":"b1ec4360de6c57f3","type":"debug","z":"7577a0.333b786","name":"Home PTZ","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":2120,"y":2440,"wires":[]},{"id":"c3b27cefb1ebde33","type":"link in","z":"7577a0.333b786","name":"PTZ Zoom reset to middle","links":["890c705085e28fab"],"x":1295,"y":3640,"wires":[["5c8bdda749904770"]]},{"id":"5c8bdda749904770","type":"switch","z":"7577a0.333b786","name":"","property":"button[2]","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1390,"y":3640,"wires":[["78d8275663c1e60a"],["73c08e199186ff61"]]},{"id":"68aa3342ea85aac9","type":"change","z":"7577a0.333b786","name":"Set to 4000","rules":[{"t":"set","p":"payload","pt":"msg","to":"4000","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":2090,"y":3660,"wires":[["9b11046d3aa99593"]]},{"id":"78d8275663c1e60a","type":"change","z":"7577a0.333b786","name":"","rules":[{"t":"set","p":"colour","pt":"msg","to":"black","tot":"str"},{"t":"set","p":"BGcolour","pt":"msg","to":"red","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1580,"y":3620,"wires":[["8ef4ab3670ee6be0","68aa3342ea85aac9"]]},{"id":"73c08e199186ff61","type":"change","z":"7577a0.333b786","name":"","rules":[{"t":"set","p":"colour","pt":"msg","to":"white","tot":"str"},{"t":"set","p":"BGcolour","pt":"msg","to":"blue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1580,"y":3660,"wires":[["8ef4ab3670ee6be0"]]},{"id":"a5725e03b0fc6b37","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"","order":22,"width":"2","height":1},{"id":"13bad7d479240dce","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"","order":19,"width":"6","height":1},{"id":"5fe9f437be53397b","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"597ccc60.341d04","order":11,"width":"6","height":1},{"id":"11121c74b9bcf9b6","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"597ccc60.341d04","order":5,"width":1,"height":1},{"id":"4de358939eeb109c","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"597ccc60.341d04","order":10,"width":1,"height":1},{"id":"461dc61e89c23bd1","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"597ccc60.341d04","order":12,"width":1,"height":1},{"id":"989e551eecd01b40","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"597ccc60.341d04","order":17,"width":1,"height":1},{"id":"970fcc863f5d8b8c","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"","order":2,"width":"1","height":1},{"id":"c553279a3a64e4a6","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"","order":16,"width":1,"height":"2"},{"id":"7b2e82a983ae4f7a","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"","order":20,"width":1,"height":"2"},{"id":"52425d37899ed851","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"147434ee.a56f9b","order":14,"width":1,"height":1},{"id":"abf005cc37582bba","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"147434ee.a56f9b","order":8,"width":1,"height":1},{"id":"6467ab5435883152","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"147434ee.a56f9b","order":3,"width":1,"height":1},{"id":"e1e099d86cd7abb9","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"147434ee.a56f9b","order":9,"width":"1","height":"1"},{"id":"5cda95c0a2190c82","type":"ui_spacer","z":"7577a0.333b786","name":"spacer","group":"73c5347dac61dd36","order":2,"width":1,"height":1},{"id":"597ccc60.341d04","type":"ui_group","name":"Presets","tab":"c34e359e.fa03f8","order":1,"disp":true,"width":"6","collapse":true},{"id":"5e61a16263303fdd","type":"ui_group","name":"Camera","tab":"c34e359e.fa03f8","order":3,"disp":true,"width":"6","collapse":true},{"id":"73c5347dac61dd36","type":"ui_group","name":"Movement","tab":"c34e359e.fa03f8","order":2,"disp":true,"width":"7","collapse":true},{"id":"32ce3d3183b5b4be","type":"ui_group","name":"PTZ Presets","tab":"d505d7cb.f03068","order":3,"disp":true,"width":"6","collapse":true},{"id":"ec13252.94341d8","type":"serial-port","serialport":"/dev/ttyAMA0","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"bin","out":"char","addchar":false},{"id":"c34e359e.fa03f8","type":"ui_tab","name":"PTZ","icon":"dashboard","order":3,"disabled":false,"hidden":false},{"id":"d505d7cb.f03068","type":"ui_tab","name":"Source Selection","icon":"mi-videocam","order":1,"disabled":false,"hidden":false}]

Flow Info

Created 2 years, 1 month ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x27)
  • comment (x6)
  • debug (x17)
  • delay (x2)
  • function (x16)
  • inject (x102)
  • link in (x13)
  • link out (x2)
  • switch (x5)
  • tcp out (x10)
Other
  • serial in (x1)
  • serial-port (x1)
  • tab (x1)
  • ui_button (x47)
  • ui_dropdown (x1)
  • ui_group (x4)
  • ui_joystick (x1)
  • ui_numeric (x2)
  • ui_slider (x5)
  • ui_spacer (x15)
  • ui_switch (x4)
  • ui_tab (x2)
  • ui_text (x3)
  • ui_text_input (x2)

Tags

  • VISCA
  • PTZ
  • Camera
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option