Created
May 11, 2023 15:43
-
-
Save HaroldPetersInskipp/a292ebb0a2f628e47faeec6c21370a81 to your computer and use it in GitHub Desktop.
Remote Dualshock 4 sharing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "d00b0fc2cbee167f", | |
"type": "tab", | |
"label": "Player 2", | |
"disabled": false, | |
"info": "", | |
"env": [] | |
}, | |
{ | |
"id": "71bd58bf7fd5f298", | |
"type": "group", | |
"z": "d00b0fc2cbee167f", | |
"name": "Keyboard and mouse senders", | |
"style": { | |
"stroke": "#17d14f", | |
"label": true | |
}, | |
"nodes": [ | |
"7bb311f4d0214067", | |
"ebf66b9538b06c63", | |
"7d1005b920b2fa7f", | |
"b101e3f2ef78565a", | |
"48ebb4b63cb5c195", | |
"b801a9ee0094263c", | |
"d907a13f3e2a0a68", | |
"98446e6999b79ee4", | |
"f4485832b711fcb8", | |
"14a86a8f2653f6fb", | |
"6974514d39cca3e6", | |
"d146bd82a868b1ec", | |
"fb2d26037cdec85e", | |
"5dd1f84e3fefa33c", | |
"d1edad5b13083e64", | |
"51bb2f7bf543b51c", | |
"96776e326b3df846", | |
"9ca0f9ab731a6048", | |
"bbdfa6ff35254b61", | |
"b505ea9343b85192" | |
], | |
"x": 14, | |
"y": 19, | |
"w": 832, | |
"h": 322 | |
}, | |
{ | |
"id": "c99ba9839b71f1a4", | |
"type": "group", | |
"z": "d00b0fc2cbee167f", | |
"name": "Main receivers", | |
"style": { | |
"label": true, | |
"stroke": "#0070c0" | |
}, | |
"nodes": [ | |
"31b8b9a0691c85f6", | |
"95527f96dd1f038a", | |
"2c9b9e7ffe96e81e", | |
"f003eee3fa722fdc", | |
"86a8e503690eddb6", | |
"d6a2b04263b591a1", | |
"e122debfd9f2c87c", | |
"75cde94d6e8da5f1", | |
"c9c4f88c931e7c92", | |
"9eeabec62ea6a962", | |
"a35a6b5f09714296", | |
"1605dd46bdf35884", | |
"e5968d1e4d5d8369", | |
"717be6b87ea835dc", | |
"f3ba6a128f934153", | |
"e9f073ea19ee47b3", | |
"d53ac8b7c7e0533c", | |
"e536a16a6f072425", | |
"6db938776bea0a54" | |
], | |
"x": 854, | |
"y": 19, | |
"w": 772, | |
"h": 322 | |
}, | |
{ | |
"id": "4f62f4b5f0b2da29", | |
"type": "group", | |
"z": "d00b0fc2cbee167f", | |
"name": "Network example nodes", | |
"style": { | |
"label": true, | |
"stroke": "#ffff3f" | |
}, | |
"nodes": [ | |
"e936d98b407abe61", | |
"4fdcade32641e03d", | |
"8e0fd4a4c06b3b8b", | |
"40f71b6c3c30a1b7", | |
"089e759c57ac63c6", | |
"3edba8b6eab13528", | |
"ed128e9c944cf464", | |
"11977ba7c63ed8ff", | |
"a3c53070d5029175", | |
"bdfbb5a57e3db465", | |
"df969063761318e8", | |
"c05f26aaa33e500d", | |
"b8f0ce6b1b56d955" | |
], | |
"x": 14, | |
"y": 356.5, | |
"w": 1632, | |
"h": 164.5 | |
}, | |
{ | |
"id": "c2574bbac1f60e53", | |
"type": "group", | |
"z": "d00b0fc2cbee167f", | |
"name": "Scale resolution for mouse coordinates", | |
"style": { | |
"label": true, | |
"stroke": "#6b5020" | |
}, | |
"nodes": [ | |
"d36fb8c0285a0b29", | |
"fd7fb04814110dd0", | |
"076010b551f5151c", | |
"538067c24c9a9406", | |
"2127724cf7469fec", | |
"9b1cb3c5ef3f150d" | |
], | |
"x": 14, | |
"y": 739, | |
"w": 512, | |
"h": 122 | |
}, | |
{ | |
"id": "c5de6dbdebf16c23", | |
"type": "group", | |
"z": "d00b0fc2cbee167f", | |
"name": "Macro example", | |
"style": { | |
"stroke": "#6f2fa0", | |
"label": true | |
}, | |
"nodes": [ | |
"15bb905288f476dc", | |
"c93aeb0bdb4c8ae4", | |
"f7b391654f872f2e", | |
"638feab6b9a0c5f2", | |
"e13d4d9bf68b4df6", | |
"4c674663609f5ba6", | |
"85edede771425f6f" | |
], | |
"x": 934, | |
"y": 539, | |
"w": 672, | |
"h": 162 | |
}, | |
{ | |
"id": "59f21e6a6c471fab", | |
"type": "group", | |
"z": "d00b0fc2cbee167f", | |
"name": "TODO:", | |
"style": { | |
"stroke": "#ff0000", | |
"label": true | |
}, | |
"nodes": [ | |
"35583e319208681a", | |
"4e2be787da255aa9", | |
"dab87ee96e89ea28", | |
"e1b50c78475a108d", | |
"09e322d2cd083499" | |
], | |
"x": 14, | |
"y": 879, | |
"w": 532, | |
"h": 162 | |
}, | |
{ | |
"id": "c092cf444f535173", | |
"type": "group", | |
"z": "d00b0fc2cbee167f", | |
"name": "All in one KB/M listener", | |
"style": { | |
"stroke": "#17d14f", | |
"label": true | |
}, | |
"nodes": [ | |
"fc2c6e33831e6351", | |
"493e4ec5cf0b8f45", | |
"14dc316bc29b59d8", | |
"7fb64340a36bd1c7", | |
"a0ea8092d3e2593e", | |
"58dbce6b12293fd4", | |
"72ace384f1846a5c", | |
"599f89d40f328446", | |
"528e438eb92482f4", | |
"256f47c411c8dcab", | |
"4ffb1f1aa366a1f8" | |
], | |
"x": 14, | |
"y": 539, | |
"w": 912, | |
"h": 182 | |
}, | |
{ | |
"id": "c70fee914fc27762", | |
"type": "group", | |
"z": "d00b0fc2cbee167f", | |
"name": "Gamepad (work in progress)", | |
"style": { | |
"stroke": "#12d5a4", | |
"label": true | |
}, | |
"nodes": [ | |
"942028af5df35c9d", | |
"82549715a4b710ad", | |
"58cdc64daf895b75", | |
"0b4a750f03dbcdef" | |
], | |
"x": 14, | |
"y": 1059, | |
"w": 532, | |
"h": 122 | |
}, | |
{ | |
"id": "868cb58b3acd0d8e", | |
"type": "group", | |
"z": "d00b0fc2cbee167f", | |
"name": "Testing node-hid module", | |
"style": { | |
"label": true | |
}, | |
"nodes": [ | |
"c31337c6d5504cab", | |
"94e7db76828971a6", | |
"edaa84d183c9a0c3", | |
"d098567c9d63ef76", | |
"5e759e9d48056137", | |
"a8fdc08437f87e30", | |
"6fbf69a811a313f3" | |
], | |
"x": 14, | |
"y": 1199, | |
"w": 532, | |
"h": 162 | |
}, | |
{ | |
"id": "db8e3255806f7983", | |
"type": "group", | |
"z": "d00b0fc2cbee167f", | |
"name": "Dualshock 4 controller sender", | |
"style": { | |
"label": true, | |
"stroke": "#003F97" | |
}, | |
"nodes": [ | |
"7ec797914ec41d54", | |
"d75127d784232ce1", | |
"14ee52a67eb55ccf", | |
"867c81b17662016d", | |
"855155141e574072", | |
"e7bca829922c30e9", | |
"c0d70a13d2f78e07", | |
"85018e53725a1df3", | |
"9c0363eb4647080d", | |
"0d6157045e7a2719", | |
"abd7b4f18332ff96", | |
"5bb3fc11f6f53daa", | |
"9c6db5fb438d7466", | |
"c6aa72d096094c12", | |
"76a3afb7cf4a2ef7", | |
"f8ec9647d62cdd8e", | |
"eaa660a8d2ee87f0" | |
], | |
"x": 554, | |
"y": 739, | |
"w": 892, | |
"h": 282 | |
}, | |
{ | |
"id": "7bb311f4d0214067", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "Keys/Clicks", | |
"func": "let uIOhook = uiohookNapi.uIOhook;\nlet UiohookKey = uiohookNapi.UiohookKey;\n\n// starts the listener\nfunction startListener() {\n // handle mouse buttons\n uIOhook.on('click', (e) => {\n let mouseButton = \"\";\n if (e.button === 1) {\n mouseButton = \"leftClick\";\n };\n if (e.button === 2) {\n mouseButton = \"rightClick\";\n };\n if (e.button === 3) {\n mouseButton = \"middleClick\";\n };\n node.send({ \"key\": mouseButton, \"modifiers\": e });\n });\n\n/*\n // handle mouse wheel\n uIOhook.on('wheel', (e) => {\n let mouseWheel = \"\";\n if (e.rotation === 1) {\n mouseWheel = \"mouseWheelDown\";\n };\n if (e.rotation === -1) {\n mouseWheel = \"mouseWheelUp\";\n };\n node.send({ \"key\": mouseWheel, \"modifiers\": e });\n });\n*/\n\n // handle keyboard\n uIOhook.on('keydown', (e) => {\n // handle alphabetical characters\n if (e.keycode === UiohookKey.A) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"A\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"a\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.B) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"B\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"b\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.C) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"C\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"c\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.D) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"D\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"d\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.E) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"E\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"e\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.F) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"F\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"f\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.G) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"G\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"g\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.H) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"H\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"h\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.I) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"I\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"i\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.J) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"J\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"j\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.K) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"K\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"k\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.L) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"L\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"l\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.M) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"M\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"m\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.N) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"N\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"n\", \"modifiers\": e });\n };;\n };\n if (e.keycode === UiohookKey.O) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"O\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"o\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.P) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"P\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"p\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Q) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"Q\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"q\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.R) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"R\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"r\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.S) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"S\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"s\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.T) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"T\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"t\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.U) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"U\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"u\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.V) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"V\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"v\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.W) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"W\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"w\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.X) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"X\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"x\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Y) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"Y\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"y\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Z) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"Z\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"z\", \"modifiers\": e });\n };\n };\n\n // handle numeric characters\n if (e.keycode === UiohookKey[0]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \")\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"0\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[1]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"!\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"1\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[2]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"@\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"2\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[3]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"#\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"3\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[4]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"$\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"4\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[5]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"%\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"5\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[6]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"^\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"6\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[7]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"&\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"7\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[8]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"*\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"8\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[9]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"(\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"9\", \"modifiers\": e });\n };\n };\n\n // handle F keys\n if (e.keycode === UiohookKey.F1) {\n node.send({ \"key\": \"f1\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F2) {\n node.send({ \"key\": \"f2\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F3) {\n node.send({ \"key\": \"f3\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F4) {\n node.send({ \"key\": \"f4\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F5) {\n node.send({ \"key\": \"f5\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F6) {\n node.send({ \"key\": \"f6\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F7) {\n node.send({ \"key\": \"f7\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F8) {\n node.send({ \"key\": \"f8\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F9) {\n node.send({ \"key\": \"f9\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F10) {\n node.send({ \"key\": \"f10\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F11) {\n node.send({ \"key\": \"f11\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F12) {\n node.send({ \"key\": \"f12\", \"modifiers\": e });\n };\n\n // handle numpad\n if (e.keycode === UiohookKey.Numpad0) {\n node.send({ \"key\": \"0\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad1) {\n node.send({ \"key\": \"1\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad2) {\n node.send({ \"key\": \"2\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad3) {\n node.send({ \"key\": \"3\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad4) {\n node.send({ \"key\": \"4\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad5) {\n node.send({ \"key\": \"5\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad6) {\n node.send({ \"key\": \"6\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad7) {\n node.send({ \"key\": \"7\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad8) {\n node.send({ \"key\": \"8\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad9) {\n node.send({ \"key\": \"9\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.NumpadMultiply) {\n node.send({ \"key\": \"*\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.NumpadAdd) {\n node.send({ \"key\": \"+\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.NumpadSubtract) {\n node.send({ \"key\": \"-\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.NumpadDecimal) {\n node.send({ \"key\": \".\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.NumpadDivide) {\n node.send({ \"key\": \"/\", \"modifiers\": e });\n };\n\n // handle special keys\n if (e.keycode === UiohookKey.Backspace) {\n node.send({ \"key\": \"backspace\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Tab) {\n node.send({ \"key\": \"tab\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Enter) {\n node.send({ \"key\": \"enter\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.CapsLock) {\n node.send({ \"key\": \"capsLock\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Escape) {\n node.send({ \"key\": \"escape\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Space) {\n node.send({ \"key\": \" \", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.PageUp) {\n node.send({ \"key\": \"pageup\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.PageDown) {\n node.send({ \"key\": \"pagedown\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.End) {\n node.send({ \"key\": \"end\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Home) {\n node.send({ \"key\": \"home\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ArrowLeft) {\n node.send({ \"key\": \"left\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ArrowUp) {\n node.send({ \"key\": \"up\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ArrowRight) {\n node.send({ \"key\": \"right\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ArrowDown) {\n node.send({ \"key\": \"down\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Insert) {\n node.send({ \"key\": \"insert\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Delete) {\n node.send({ \"key\": \"delete\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ScrollLock) {\n node.send({ \"key\": \"scrollLock\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.PrintScreen) {\n node.send({ \"key\": \"printScreen\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Pause) {\n node.send({ \"key\": \"pause\", \"modifiers\": e });\n };\n\n // handle symbols\n if (e.keycode === UiohookKey.Semicolon) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \":\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \";\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Equal) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"+\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"=\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Comma) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"<\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \",\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Minus) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"_\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"-\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Period) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \">\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \".\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Slash) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"?\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"/\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Backquote) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"~\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"`\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.BracketLeft) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"{\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"[\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Backslash) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"|\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"\\\\\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.BracketRight) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"}\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"]\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Quote) {\n if (e.shiftKey === true) {\n node.send({ \"key\": `\"`, \"modifiers\": e });\n } else {\n node.send({ \"key\": \"'\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Ctrl) {\n node.send({ \"key\": \"control\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.CtrlRight) {\n node.send({ \"key\": \"control\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Alt) {\n node.send({ \"key\": \"alt\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.AltRight) {\n node.send({ \"key\": \"alt\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Shift) {\n //node.send({ \"key\": \"shift\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ShiftRight) {\n //node.send({ \"key\": \"shift\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Meta) {\n node.send({ \"key\": \"command\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.MetaRight) {\n node.send({ \"key\": \"command\", \"modifiers\": e });\n };\n })\n};\n\n\n// controls to turn on and off the listener\nif (msg.payload === \"on\") {\n startListener();\n uIOhook.start();\n // limit max listeners to one\n uIOhook._maxListeners = 1;\n // status output for function node\n node.status({ fill: \"green\", shape: \"dot\", text: \"ON\" });\n};\nif (msg.payload === \"off\") {\n // clear all events\n uIOhook._events.keydown = [];\n uIOhook._events.keyup = [];\n uIOhook._events.mousedown = [];\n uIOhook._events.mouseup = [];\n uIOhook._events.mousemove = [];\n uIOhook._events.click = [];\n uIOhook._events.wheel = [];\n uIOhook.stop();\n // status output for function node\n node.status({ fill: \"red\", shape: \"dot\", text: \"OFF\" });\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "uiohookNapi", | |
"module": "uiohook-napi" | |
} | |
], | |
"x": 270, | |
"y": 180, | |
"wires": [ | |
[ | |
"14a86a8f2653f6fb", | |
"d1edad5b13083e64" | |
] | |
] | |
}, | |
{ | |
"id": "ebf66b9538b06c63", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "on", | |
"payloadType": "str", | |
"x": 110, | |
"y": 160, | |
"wires": [ | |
[ | |
"7bb311f4d0214067" | |
] | |
] | |
}, | |
{ | |
"id": "7d1005b920b2fa7f", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": true, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "off", | |
"payloadType": "str", | |
"x": 110, | |
"y": 200, | |
"wires": [ | |
[ | |
"7bb311f4d0214067" | |
] | |
] | |
}, | |
{ | |
"id": "b101e3f2ef78565a", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "info", | |
"func": "let uIOhook = uiohookNapi.uIOhook;\nlet UiohookKey = uiohookNapi.UiohookKey;\n\nmsg.payload = uiohookNapi;\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "uiohookNapi", | |
"module": "uiohook-napi" | |
} | |
], | |
"x": 250, | |
"y": 60, | |
"wires": [ | |
[ | |
"b801a9ee0094263c" | |
] | |
] | |
}, | |
{ | |
"id": "48ebb4b63cb5c195", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "get", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 110, | |
"y": 60, | |
"wires": [ | |
[ | |
"b101e3f2ef78565a" | |
] | |
] | |
}, | |
{ | |
"id": "b801a9ee0094263c", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "info", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 530, | |
"y": 60, | |
"wires": [] | |
}, | |
{ | |
"id": "d907a13f3e2a0a68", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "Mouse(x,y)", | |
"func": "let uIOhook = uiohookNapi.uIOhook;\nlet UiohookKey = uiohookNapi.UiohookKey;\n// starts the listener\nfunction startListener() {\n uIOhook.on('mousemove', (e) => {\n node.send({ \"key\": \"mousemove\", \"modifiers\": e });\n node.status({ fill: \"green\", shape: \"dot\", text: `${e.x},${e.y}` });\n });\n\n /*\n uIOhook.on('mousedown', (e) => {\n node.send({ \"key\": \"mouseDown\", \"modifiers\": e });\n node.status({ fill: \"green\", shape: \"dot\", text: `${e.x},${e.y}` });\n });\n uIOhook.on('mouseup', (e) => {\n node.send({ \"key\": \"mouseUp\", \"modifiers\": e });\n node.status({ fill: \"green\", shape: \"dot\", text: `${e.x},${e.y}` });\n });\n */\n \n};\n\n\n// controls to turn on and off the listener\nif (msg.payload === \"on\") {\n startListener();\n uIOhook.start();\n // limit max listeners to one\n uIOhook._maxListeners = 1;\n // status output for function node\n node.status({ fill: \"green\", shape: \"dot\", text: \"ON\" });\n};\nif (msg.payload === \"off\") {\n uIOhook._events.keydown = [];\n uIOhook._events.keyup = [];\n uIOhook._events.mousedown = [];\n uIOhook._events.mouseup = [];\n uIOhook._events.mousemove = [];\n uIOhook._events.click = [];\n uIOhook._events.wheel = [];\n uIOhook.stop();\n // status output for function node\n node.status({ fill: \"red\", shape: \"dot\", text: \"OFF\" });\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "uiohookNapi", | |
"module": "uiohook-napi" | |
} | |
], | |
"x": 270, | |
"y": 260, | |
"wires": [ | |
[ | |
"d146bd82a868b1ec" | |
] | |
] | |
}, | |
{ | |
"id": "98446e6999b79ee4", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "on", | |
"payloadType": "str", | |
"x": 110, | |
"y": 240, | |
"wires": [ | |
[ | |
"d907a13f3e2a0a68" | |
] | |
] | |
}, | |
{ | |
"id": "f4485832b711fcb8", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "keys", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 530, | |
"y": 140, | |
"wires": [] | |
}, | |
{ | |
"id": "31b8b9a0691c85f6", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "Click receiver", | |
"func": "// mouseClick([button], [double]);\n\n// controls to turn on and off the receiver\nif (flow.get(\"clickState\", \"file\") === \"on\") {\n // remove \"Click\" from input string\n msg.key = msg.key.substring(0, (msg.key.length - 5));\n if (msg.modifiers.clicks === 1) {\n robot.mouseClick([ msg.key ], [ false ]);\n };\n if (msg.modifiers.clicks === 2) {\n robot.mouseClick([ msg.key ], [ true ]);\n };\n node.status({ fill: \"green\", shape: \"dot\", text: `${msg.key}` });\n return msg;\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "robot", | |
"module": "@jitsi/robotjs" | |
} | |
], | |
"x": 1340, | |
"y": 140, | |
"wires": [ | |
[ | |
"95527f96dd1f038a" | |
] | |
] | |
}, | |
{ | |
"id": "95527f96dd1f038a", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "clicks", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1490, | |
"y": 140, | |
"wires": [] | |
}, | |
{ | |
"id": "14a86a8f2653f6fb", | |
"type": "switch", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "route", | |
"property": "key", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "eq", | |
"v": "leftClick", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "rightClick", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "middleClick", | |
"vt": "str" | |
}, | |
{ | |
"t": "else" | |
} | |
], | |
"checkall": "false", | |
"repair": false, | |
"outputs": 4, | |
"x": 410, | |
"y": 120, | |
"wires": [ | |
[ | |
"6974514d39cca3e6" | |
], | |
[ | |
"6974514d39cca3e6" | |
], | |
[ | |
"6974514d39cca3e6" | |
], | |
[ | |
"f4485832b711fcb8", | |
"96776e326b3df846" | |
] | |
] | |
}, | |
{ | |
"id": "6974514d39cca3e6", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "clicks", | |
"active": false, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 530, | |
"y": 100, | |
"wires": [] | |
}, | |
{ | |
"id": "2c9b9e7ffe96e81e", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "Key receiver", | |
"func": "// Press enter.\n// robot.keyTap(\"enter\");\n// robot.keyTap(key, [modifier]);\n\n// controls to turn on and off the receiver\nif (flow.get(\"keyState\", \"file\") === \"on\") {\n msg.modifier = [];\n if (msg.modifiers.altKey === true) {\n msg.modifier.push(\"alt\");\n };\n if (msg.modifiers.metaKey === true) {\n msg.modifier.push(\"command\");\n };\n if (msg.modifiers.ctrlKey === true) {\n msg.modifier.push(\"control\");\n };\n if (msg.modifiers.shiftKey === true) {\n msg.modifier.push(\"shift\");\n };\n robot.keyTap(msg.key, msg.modifier);\n if (msg.modifier.length === 0) {\n node.status({ fill: \"green\", shape: \"dot\", text: `${msg.key}` });\n } else if (msg.modifier.length > 0) {\n node.status({ fill: \"green\", shape: \"dot\", text: `${msg.key}, ${msg.modifier}` });\n };\n return msg;\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "robot", | |
"module": "@jitsi/robotjs" | |
} | |
], | |
"x": 1330, | |
"y": 260, | |
"wires": [ | |
[ | |
"f003eee3fa722fdc" | |
] | |
] | |
}, | |
{ | |
"id": "f003eee3fa722fdc", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "keys", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1490, | |
"y": 260, | |
"wires": [] | |
}, | |
{ | |
"id": "86a8e503690eddb6", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "Mouse receiver", | |
"func": "// controls to turn on and off the receiver\nif (flow.get(\"mouseState\", \"file\") === \"on\") {\n // Speed up the mouse.\n robot.setMouseDelay(1);\n robot.moveMouse(msg.modifiers.x, msg.modifiers.y);\n node.status({ fill: \"green\", shape: \"dot\", text: `${msg.modifiers.x},${msg.modifiers.y}` });\n return msg;\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "robot", | |
"module": "@jitsi/robotjs" | |
} | |
], | |
"x": 1340, | |
"y": 200, | |
"wires": [ | |
[ | |
"d6a2b04263b591a1" | |
] | |
] | |
}, | |
{ | |
"id": "d6a2b04263b591a1", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "mouse(x,y)", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1510, | |
"y": 200, | |
"wires": [] | |
}, | |
{ | |
"id": "d146bd82a868b1ec", | |
"type": "delay", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "limit", | |
"pauseType": "rate", | |
"timeout": "5", | |
"timeoutUnits": "seconds", | |
"rate": "4", | |
"nbRateUnits": "1", | |
"rateUnits": "second", | |
"randomFirst": "1", | |
"randomLast": "5", | |
"randomUnits": "seconds", | |
"drop": true, | |
"allowrate": false, | |
"outputs": 1, | |
"x": 410, | |
"y": 260, | |
"wires": [ | |
[ | |
"fb2d26037cdec85e", | |
"51bb2f7bf543b51c" | |
] | |
] | |
}, | |
{ | |
"id": "fb2d26037cdec85e", | |
"type": "range", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"minin": "0", | |
"maxin": "3840", | |
"minout": "0", | |
"maxout": "1536", | |
"action": "clamp", | |
"round": true, | |
"property": "modifiers.x", | |
"name": "scale x", | |
"x": 540, | |
"y": 260, | |
"wires": [ | |
[ | |
"5dd1f84e3fefa33c" | |
] | |
] | |
}, | |
{ | |
"id": "5dd1f84e3fefa33c", | |
"type": "range", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"minin": "0", | |
"maxin": "2160", | |
"minout": "0", | |
"maxout": "864", | |
"action": "clamp", | |
"round": true, | |
"property": "modifiers.y", | |
"name": "scale y", | |
"x": 680, | |
"y": 260, | |
"wires": [ | |
[ | |
"d1edad5b13083e64" | |
] | |
] | |
}, | |
{ | |
"id": "e936d98b407abe61", | |
"type": "switch", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "route", | |
"property": "key", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "eq", | |
"v": "leftClick", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "rightClick", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "middleClick", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "mousemove", | |
"vt": "str" | |
}, | |
{ | |
"t": "else" | |
} | |
], | |
"checkall": "false", | |
"repair": false, | |
"outputs": 5, | |
"x": 1190, | |
"y": 420, | |
"wires": [ | |
[ | |
"31b8b9a0691c85f6" | |
], | |
[ | |
"31b8b9a0691c85f6" | |
], | |
[ | |
"31b8b9a0691c85f6" | |
], | |
[ | |
"86a8e503690eddb6" | |
], | |
[ | |
"2c9b9e7ffe96e81e" | |
] | |
] | |
}, | |
{ | |
"id": "d1edad5b13083e64", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "Output all", | |
"func": "node.status({ fill: \"green\", shape: \"dot\", text: `${msg.key}` });\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [], | |
"x": 580, | |
"y": 180, | |
"wires": [ | |
[] | |
] | |
}, | |
{ | |
"id": "51bb2f7bf543b51c", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "mouse(x,y)", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 550, | |
"y": 300, | |
"wires": [] | |
}, | |
{ | |
"id": "4fdcade32641e03d", | |
"type": "http request", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "http request", | |
"method": "POST", | |
"ret": "txt", | |
"paytoqs": "ignore", | |
"url": "{{{link}}}/KM", | |
"tls": "", | |
"persist": false, | |
"proxy": "", | |
"authType": "", | |
"senderr": false, | |
"x": 270, | |
"y": 440, | |
"wires": [ | |
[ | |
"40f71b6c3c30a1b7" | |
] | |
] | |
}, | |
{ | |
"id": "8e0fd4a4c06b3b8b", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "send test", | |
"props": [ | |
{ | |
"p": "payload.key", | |
"v": "a", | |
"vt": "str" | |
}, | |
{ | |
"p": "link", | |
"v": "http://INSERTYOURIPHERE:1880", | |
"vt": "str" | |
}, | |
{ | |
"p": "payload.modifiers", | |
"v": "{\"type\":4,\"altKey\":false,\"ctrlKey\":false,\"metaKey\":false,\"shiftKey\":false,\"keycode\":30}", | |
"vt": "json" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"x": 120, | |
"y": 440, | |
"wires": [ | |
[ | |
"4fdcade32641e03d" | |
] | |
] | |
}, | |
{ | |
"id": "40f71b6c3c30a1b7", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 430, | |
"y": 440, | |
"wires": [] | |
}, | |
{ | |
"id": "089e759c57ac63c6", | |
"type": "http in", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "HTTP receiver", | |
"url": "/KM", | |
"method": "post", | |
"upload": false, | |
"swaggerDoc": "", | |
"x": 710, | |
"y": 440, | |
"wires": [ | |
[ | |
"3edba8b6eab13528", | |
"11977ba7c63ed8ff" | |
] | |
] | |
}, | |
{ | |
"id": "3edba8b6eab13528", | |
"type": "http response", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "HTTP status", | |
"statusCode": "200", | |
"headers": {}, | |
"x": 890, | |
"y": 400, | |
"wires": [] | |
}, | |
{ | |
"id": "ed128e9c944cf464", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "all input data", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1530, | |
"y": 480, | |
"wires": [] | |
}, | |
{ | |
"id": "96776e326b3df846", | |
"type": "change", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "set msg.payload", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "payload.key", | |
"pt": "msg", | |
"to": "key", | |
"tot": "msg" | |
}, | |
{ | |
"t": "set", | |
"p": "payload.modifiers", | |
"pt": "msg", | |
"to": "modifiers", | |
"tot": "msg" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 740, | |
"y": 180, | |
"wires": [ | |
[] | |
] | |
}, | |
{ | |
"id": "e122debfd9f2c87c", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "Screen Size", | |
"func": "msg.payload = robot.getScreenSize();\nnode.status({ fill: \"green\", shape: \"dot\", text: `${msg.payload.width},${msg.payload.height}` });\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "robot", | |
"module": "@jitsi/robotjs" | |
} | |
], | |
"x": 1330, | |
"y": 60, | |
"wires": [ | |
[ | |
"c9c4f88c931e7c92" | |
] | |
] | |
}, | |
{ | |
"id": "75cde94d6e8da5f1", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "get", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 1190, | |
"y": 60, | |
"wires": [ | |
[ | |
"e122debfd9f2c87c" | |
] | |
] | |
}, | |
{ | |
"id": "c9c4f88c931e7c92", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "size", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1490, | |
"y": 60, | |
"wires": [] | |
}, | |
{ | |
"id": "11977ba7c63ed8ff", | |
"type": "change", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "get msg.payload", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "key", | |
"pt": "msg", | |
"to": "payload.key", | |
"tot": "msg" | |
}, | |
{ | |
"t": "set", | |
"p": "modifiers", | |
"pt": "msg", | |
"to": "payload.modifiers", | |
"tot": "msg" | |
}, | |
{ | |
"t": "delete", | |
"p": "payload", | |
"pt": "msg" | |
}, | |
{ | |
"t": "delete", | |
"p": "req", | |
"pt": "msg" | |
}, | |
{ | |
"t": "delete", | |
"p": "res", | |
"pt": "msg" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 1020, | |
"y": 440, | |
"wires": [ | |
[ | |
"e936d98b407abe61", | |
"a3c53070d5029175" | |
] | |
] | |
}, | |
{ | |
"id": "a3c53070d5029175", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "fan", | |
"func": "return msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [], | |
"x": 1190, | |
"y": 480, | |
"wires": [ | |
[ | |
"ed128e9c944cf464" | |
] | |
] | |
}, | |
{ | |
"id": "9eeabec62ea6a962", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "on", | |
"payloadType": "str", | |
"x": 950, | |
"y": 100, | |
"wires": [ | |
[ | |
"e9f073ea19ee47b3" | |
] | |
] | |
}, | |
{ | |
"id": "a35a6b5f09714296", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": true, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "off", | |
"payloadType": "str", | |
"x": 950, | |
"y": 140, | |
"wires": [ | |
[ | |
"e9f073ea19ee47b3" | |
] | |
] | |
}, | |
{ | |
"id": "1605dd46bdf35884", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "on", | |
"payloadType": "str", | |
"x": 950, | |
"y": 180, | |
"wires": [ | |
[ | |
"d53ac8b7c7e0533c" | |
] | |
] | |
}, | |
{ | |
"id": "e5968d1e4d5d8369", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": true, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "off", | |
"payloadType": "str", | |
"x": 950, | |
"y": 220, | |
"wires": [ | |
[ | |
"d53ac8b7c7e0533c" | |
] | |
] | |
}, | |
{ | |
"id": "717be6b87ea835dc", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "on", | |
"payloadType": "str", | |
"x": 950, | |
"y": 260, | |
"wires": [ | |
[ | |
"e536a16a6f072425" | |
] | |
] | |
}, | |
{ | |
"id": "f3ba6a128f934153", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": true, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "off", | |
"payloadType": "str", | |
"x": 950, | |
"y": 300, | |
"wires": [ | |
[ | |
"e536a16a6f072425" | |
] | |
] | |
}, | |
{ | |
"id": "e9f073ea19ee47b3", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "set flow.clickState", | |
"func": "flow.set(\"clickState\", msg.payload, \"file\");\nlet color, displayText;\nif (msg.payload === \"on\") {\n color = \"green\";\n displayText = \"ON\";\n};\nif (msg.payload === \"off\") {\n color = \"red\";\n displayText = \"OFF\";\n};\nnode.status({ fill: color, shape: \"dot\", text: displayText });", | |
"outputs": 0, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [], | |
"x": 1110, | |
"y": 140, | |
"wires": [] | |
}, | |
{ | |
"id": "d53ac8b7c7e0533c", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "set flow.mouseState", | |
"func": "flow.set(\"mouseState\", msg.payload, \"file\");\nlet color, displayText;\nif (msg.payload === \"on\") {\n color = \"green\";\n displayText = \"ON\";\n};\nif (msg.payload === \"off\") {\n color = \"red\";\n displayText = \"OFF\";\n};\nnode.status({ fill: color, shape: \"dot\", text: displayText });", | |
"outputs": 0, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [], | |
"x": 1120, | |
"y": 200, | |
"wires": [] | |
}, | |
{ | |
"id": "e536a16a6f072425", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "set flow.keyState", | |
"func": "flow.set(\"keyState\", msg.payload, \"file\");\nlet color, displayText;\nif (msg.payload === \"on\") {\n color = \"green\";\n displayText = \"ON\";\n};\nif (msg.payload === \"off\") {\n color = \"red\";\n displayText = \"OFF\";\n};\nnode.status({ fill: color, shape: \"dot\", text: displayText });", | |
"outputs": 0, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [], | |
"x": 1110, | |
"y": 260, | |
"wires": [] | |
}, | |
{ | |
"id": "6db938776bea0a54", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "c99ba9839b71f1a4", | |
"name": "Receiver controls", | |
"info": "", | |
"x": 960, | |
"y": 60, | |
"wires": [] | |
}, | |
{ | |
"id": "d36fb8c0285a0b29", | |
"type": "range", | |
"z": "d00b0fc2cbee167f", | |
"g": "c2574bbac1f60e53", | |
"minin": "0", | |
"maxin": "3840", | |
"minout": "0", | |
"maxout": "2194", | |
"action": "clamp", | |
"round": true, | |
"property": "modifiers.x", | |
"name": "scale x", | |
"x": 300, | |
"y": 780, | |
"wires": [ | |
[ | |
"fd7fb04814110dd0" | |
] | |
] | |
}, | |
{ | |
"id": "fd7fb04814110dd0", | |
"type": "range", | |
"z": "d00b0fc2cbee167f", | |
"g": "c2574bbac1f60e53", | |
"minin": "0", | |
"maxin": "2160", | |
"minout": "0", | |
"maxout": "1234", | |
"action": "clamp", | |
"round": true, | |
"property": "modifiers.y", | |
"name": "scale y", | |
"x": 440, | |
"y": 780, | |
"wires": [ | |
[] | |
] | |
}, | |
{ | |
"id": "076010b551f5151c", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "c2574bbac1f60e53", | |
"name": "Desktop resolution", | |
"info": "", | |
"x": 130, | |
"y": 780, | |
"wires": [] | |
}, | |
{ | |
"id": "35583e319208681a", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "59f21e6a6c471fab", | |
"name": "TODO: Handle mouseWheelUp/Down", | |
"info": "Code is commented out in Keys/Clicks to disable", | |
"x": 190, | |
"y": 960, | |
"wires": [] | |
}, | |
{ | |
"id": "538067c24c9a9406", | |
"type": "range", | |
"z": "d00b0fc2cbee167f", | |
"g": "c2574bbac1f60e53", | |
"minin": "0", | |
"maxin": "3840", | |
"minout": "0", | |
"maxout": "1536", | |
"action": "clamp", | |
"round": true, | |
"property": "modifiers.x", | |
"name": "scale x", | |
"x": 300, | |
"y": 820, | |
"wires": [ | |
[ | |
"2127724cf7469fec" | |
] | |
] | |
}, | |
{ | |
"id": "2127724cf7469fec", | |
"type": "range", | |
"z": "d00b0fc2cbee167f", | |
"g": "c2574bbac1f60e53", | |
"minin": "0", | |
"maxin": "2160", | |
"minout": "0", | |
"maxout": "864", | |
"action": "clamp", | |
"round": true, | |
"property": "modifiers.y", | |
"name": "scale y", | |
"x": 440, | |
"y": 820, | |
"wires": [ | |
[] | |
] | |
}, | |
{ | |
"id": "9b1cb3c5ef3f150d", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "c2574bbac1f60e53", | |
"name": "Laptop resolution", | |
"info": "", | |
"x": 140, | |
"y": 820, | |
"wires": [] | |
}, | |
{ | |
"id": "4e2be787da255aa9", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "59f21e6a6c471fab", | |
"name": "scrollMouse(x, y)WIP", | |
"func": "robot.scrollMouse(10, 0);\n//(msg.x, msg.y);\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "robot", | |
"module": "@jitsi/robotjs" | |
} | |
], | |
"x": 280, | |
"y": 1000, | |
"wires": [ | |
[ | |
"e1b50c78475a108d" | |
] | |
] | |
}, | |
{ | |
"id": "dab87ee96e89ea28", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "59f21e6a6c471fab", | |
"name": "x,y", | |
"props": [ | |
{ | |
"p": "x", | |
"v": "380", | |
"vt": "num" | |
}, | |
{ | |
"p": "y", | |
"v": "520", | |
"vt": "num" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"x": 110, | |
"y": 1000, | |
"wires": [ | |
[ | |
"4e2be787da255aa9" | |
] | |
] | |
}, | |
{ | |
"id": "e1b50c78475a108d", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "59f21e6a6c471fab", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 450, | |
"y": 1000, | |
"wires": [] | |
}, | |
{ | |
"id": "15bb905288f476dc", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c5de6dbdebf16c23", | |
"name": "Triforce sender", | |
"func": "const Tri = \"▲\";\nlet uIOhook = uiohookNapi.uIOhook;\nlet UiohookKey = uiohookNapi.UiohookKey;\n\n// starts the listener\nfunction startListener() {\n uIOhook.start();\n // limit max listeners to one\n uIOhook._maxListeners = 1;\n // if pause key is pressed send triforce\n uIOhook.on('keydown', (e) => {\n if (e.keycode === UiohookKey.Pause) {\n node.send({ \"key\": Tri });\n };\n });\n};\n\n// controls to turn on the listener\nif (msg.payload === \"on\") {\n startListener();\n // status output for function node\n node.status({ fill: \"green\", shape: \"dot\", text: \"ON\" });\n};\n\n// controls to turn off the listener\nif (msg.payload === \"off\") {\n // clear all events\n uIOhook._events.keydown = [];\n // stop the listener\n uIOhook.stop();\n // status output for function node\n node.status({ fill: \"red\", shape: \"dot\", text: \"OFF\" });\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "uiohookNapi", | |
"module": "uiohook-napi" | |
}, | |
{ | |
"var": "robot", | |
"module": "@jitsi/robotjs" | |
} | |
], | |
"x": 1180, | |
"y": 620, | |
"wires": [ | |
[ | |
"4c674663609f5ba6" | |
] | |
] | |
}, | |
{ | |
"id": "c93aeb0bdb4c8ae4", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c5de6dbdebf16c23", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "on", | |
"payloadType": "str", | |
"x": 1030, | |
"y": 600, | |
"wires": [ | |
[ | |
"15bb905288f476dc" | |
] | |
] | |
}, | |
{ | |
"id": "f7b391654f872f2e", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c5de6dbdebf16c23", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": true, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "off", | |
"payloadType": "str", | |
"x": 1030, | |
"y": 640, | |
"wires": [ | |
[ | |
"15bb905288f476dc" | |
] | |
] | |
}, | |
{ | |
"id": "638feab6b9a0c5f2", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c5de6dbdebf16c23", | |
"name": "Triforce receiver alt", | |
"func": "let timeInterval;\n// if triforce is received hold alt key and move on\nif (msg.key === \"▲\") {\n robot.keyToggle(\"alt\", \"down\");\n waitXSec();\n};\n// after 20 milliseconds tap numpad 3 and numpad 0 then release alt key\nfunction waitXSec() {\n timeInterval = setTimeout(function () {\n robot.keyTap(\"numpad_3\");\n robot.keyTap(\"numpad_0\");\n robot.keyToggle(\"alt\", \"up\");\n }, 20);\n};\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "robot", | |
"module": "@jitsi/robotjs" | |
} | |
], | |
"x": 1370, | |
"y": 660, | |
"wires": [ | |
[] | |
] | |
}, | |
{ | |
"id": "e13d4d9bf68b4df6", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "c5de6dbdebf16c23", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1510, | |
"y": 620, | |
"wires": [] | |
}, | |
{ | |
"id": "4c674663609f5ba6", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c5de6dbdebf16c23", | |
"name": "Triforce receiver", | |
"func": "// when triforce is received\nif (msg.key === \"▲\") {\n // hold alt key and move on\n robot.keyToggle(\"alt\", \"down\");\n // after 20 milliseconds run keyUp()\n setTimeout(keyUp, 20);\n // tap numpad 3 and numpad 0 then release alt key\n function keyUp() {\n robot.keyTap(\"numpad_3\");\n robot.keyTap(\"numpad_0\");\n robot.keyToggle(\"alt\", \"up\");\n }; \n};\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "robot", | |
"module": "@jitsi/robotjs" | |
} | |
], | |
"x": 1360, | |
"y": 620, | |
"wires": [ | |
[ | |
"e13d4d9bf68b4df6" | |
] | |
] | |
}, | |
{ | |
"id": "85edede771425f6f", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "c5de6dbdebf16c23", | |
"name": "Example of a macro for pause key", | |
"info": "", | |
"x": 1240, | |
"y": 580, | |
"wires": [] | |
}, | |
{ | |
"id": "09e322d2cd083499", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "59f21e6a6c471fab", | |
"name": "TODO: Handle doubleclicks and mouse hold to drag", | |
"info": "", | |
"x": 230, | |
"y": 920, | |
"wires": [] | |
}, | |
{ | |
"id": "9ca0f9ab731a6048", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": true, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "off", | |
"payloadType": "str", | |
"x": 110, | |
"y": 280, | |
"wires": [ | |
[ | |
"d907a13f3e2a0a68" | |
] | |
] | |
}, | |
{ | |
"id": "bbdfa6ff35254b61", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "Sender controls", | |
"info": "", | |
"x": 120, | |
"y": 120, | |
"wires": [] | |
}, | |
{ | |
"id": "b505ea9343b85192", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "71bd58bf7fd5f298", | |
"name": "Output here", | |
"info": "", | |
"x": 750, | |
"y": 140, | |
"wires": [] | |
}, | |
{ | |
"id": "bdfbb5a57e3db465", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "Input here", | |
"info": "", | |
"x": 120, | |
"y": 400, | |
"wires": [] | |
}, | |
{ | |
"id": "df969063761318e8", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "--------->", | |
"info": "", | |
"x": 570, | |
"y": 440, | |
"wires": [] | |
}, | |
{ | |
"id": "c05f26aaa33e500d", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "Sender", | |
"info": "", | |
"x": 270, | |
"y": 400, | |
"wires": [] | |
}, | |
{ | |
"id": "b8f0ce6b1b56d955", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "4f62f4b5f0b2da29", | |
"name": "Receiver", | |
"info": "", | |
"x": 700, | |
"y": 400, | |
"wires": [] | |
}, | |
{ | |
"id": "942028af5df35c9d", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c70fee914fc27762", | |
"name": "Gamepad WIP", | |
"func": "const PlayStationController = gamepadTs.PlayStationController;\nconst ctrl = new PlayStationController();\nvar x;\nfunction startListener() {\n //ctrl.on(\"LStick\", (pos) => { if (pos === \"0\") { node.send({ \"gamepad\": `L2` }) } });\n //ctrl.on(\"RStick\", (pos) => { if (pos === \"0\") { node.send({ \"gamepad\": `R2` }) } });\n //ctrl.on(\"dpad\", (pos) => { if (pos === \"0\") { node.send({ \"gamepad\": `dPad` }) } });\n\n //ctrl.on(\"square\", (pressed) => node.send({ \"gamepad\": \"square\", \"pressed\": pressed }));\n ctrl.on(\"cross\", (x = \"reset\") => node.send({ \"gamepad\": \"cross\"}));\n //ctrl.on(\"circle\", (pressed) => node.send({ \"gamepad\": \"circle\", \"pressed\": pressed }));\n //ctrl.on(\"triangle\", (pressed) => node.send({ \"gamepad\": \"triangle\", \"pressed\": pressed }));\n\n // Setup\n ctrl.on('scan', (devices) => node.send({ \"gamepad\": devices }));\n ctrl.on(\"connected\", () => node.send({ \"gamepad\": \"PS4 controller connected\" }));\n ctrl.on(\"error\", (err) => node.error({ \"gamepad\": err }));\n ctrl.start();\n};\nif (x === \"reset\") {\n msg.payload = \"off\";\n ctrl.off(\"cross\", (x = \"reset\") => {});\n};\n\n// On/Off\nif (msg.payload === \"on\") {\n startListener();\n node.status({ fill: \"green\", shape: \"dot\", text: \"ON\" });\n};\nif (msg.payload === \"off\") {\n ctrl.on(\"cross\", (x = \"reset\") => {});\n node.status({ fill: \"red\", shape: \"dot\", text: \"OFF\" });\n};\n\n/*\nconst pad = new PlayStationController();\npad.on('LStick', (pos) => { }); // Left stick moved event (x, y)\npad.on('RStick', (pos) => { }); // Right stick moved event (x, y)\npad.on('dpad', (pos) => { }); // Digital Pad change event (x, y)\npad.on('LStickBt', (pressed) => { }); // Left stick press\npad.on('RStickBt', (pressed) => { }); // Right stick press\npad.on('square', (pressed) => { }); // Playastation Button\npad.on('cross', (pressed) => { }); // Playastation Button\npad.on('circle', (pressed) => { }); // Playastation Button\npad.on('triangle', (pressed) => { }); // Playastation Button\npad.on('share', (pressed) => { }); // Playstation share\npad.on('options', (pressed) => { }); // Playstation options\npad.on('L1', (pressed) => { }); // playstaton Left Button\npad.on('R1', (pressed) => { }); // playstaton Right Button\npad.on('L2', (pressed) => { }); // playstaton Left trigger\npad.on('R2', (pressed) => { }); // playstaton Right trigger\n*/\n\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "gamepadTs", | |
"module": "gamepad-ts" | |
} | |
], | |
"x": 280, | |
"y": 1100, | |
"wires": [ | |
[ | |
"58cdc64daf895b75" | |
] | |
] | |
}, | |
{ | |
"id": "82549715a4b710ad", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c70fee914fc27762", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "on", | |
"payloadType": "str", | |
"x": 110, | |
"y": 1100, | |
"wires": [ | |
[ | |
"942028af5df35c9d" | |
] | |
] | |
}, | |
{ | |
"id": "58cdc64daf895b75", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "c70fee914fc27762", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 450, | |
"y": 1100, | |
"wires": [] | |
}, | |
{ | |
"id": "0b4a750f03dbcdef", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c70fee914fc27762", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "off", | |
"payloadType": "str", | |
"x": 110, | |
"y": 1140, | |
"wires": [ | |
[ | |
"942028af5df35c9d" | |
] | |
] | |
}, | |
{ | |
"id": "fc2c6e33831e6351", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "c092cf444f535173", | |
"name": "Listener", | |
"func": "let uIOhook = uiohookNapi.uIOhook;\nlet UiohookKey = uiohookNapi.UiohookKey;\nlet throttlePause;\nconst events = new Set([\n // EventHandlers\n \"click\",\n \"wheel\",\n \"keydown\",\n \"keyup\",\n \"mousemove\"//,\n //\"mousedown\",\n //\"mouseup\"\n]);\n\n// starts the listener\nfunction startListener() {\n uIOhook.start();\n // limit max listeners to one\n uIOhook._maxListeners = 1;\n for (let event of events) {\n uIOhook.on(`${event}`, (e) => {\n if (event === \"keydown\") {\n // handle alphabetical characters\n if (e.keycode === UiohookKey.A) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"A\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"a\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.B) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"B\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"b\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.C) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"C\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"c\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.D) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"D\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"d\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.E) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"E\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"e\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.F) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"F\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"f\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.G) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"G\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"g\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.H) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"H\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"h\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.I) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"I\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"i\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.J) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"J\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"j\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.K) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"K\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"k\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.L) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"L\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"l\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.M) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"M\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"m\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.N) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"N\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"n\", \"modifiers\": e });\n };;\n };\n if (e.keycode === UiohookKey.O) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"O\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"o\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.P) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"P\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"p\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Q) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"Q\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"q\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.R) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"R\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"r\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.S) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"S\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"s\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.T) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"T\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"t\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.U) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"U\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"u\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.V) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"V\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"v\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.W) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"W\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"w\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.X) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"X\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"x\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Y) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"Y\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"y\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Z) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"Z\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"z\", \"modifiers\": e });\n };\n };\n\n // handle numeric characters\n if (e.keycode === UiohookKey[0]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \")\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"0\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[1]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"!\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"1\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[2]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"@\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"2\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[3]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"#\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"3\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[4]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"$\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"4\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[5]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"%\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"5\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[6]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"^\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"6\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[7]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"&\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"7\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[8]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"*\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"8\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey[9]) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"(\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"9\", \"modifiers\": e });\n };\n };\n\n // handle F keys\n if (e.keycode === UiohookKey.F1) {\n node.send({ \"key\": \"f1\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F2) {\n node.send({ \"key\": \"f2\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F3) {\n node.send({ \"key\": \"f3\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F4) {\n node.send({ \"key\": \"f4\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F5) {\n node.send({ \"key\": \"f5\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F6) {\n node.send({ \"key\": \"f6\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F7) {\n node.send({ \"key\": \"f7\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F8) {\n node.send({ \"key\": \"f8\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F9) {\n node.send({ \"key\": \"f9\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F10) {\n node.send({ \"key\": \"f10\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F11) {\n node.send({ \"key\": \"f11\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.F12) {\n node.send({ \"key\": \"f12\", \"modifiers\": e });\n };\n\n // handle numpad\n if (e.keycode === UiohookKey.Numpad0) {\n node.send({ \"key\": \"0\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad1) {\n node.send({ \"key\": \"1\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad2) {\n node.send({ \"key\": \"2\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad3) {\n node.send({ \"key\": \"3\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad4) {\n node.send({ \"key\": \"4\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad5) {\n node.send({ \"key\": \"5\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad6) {\n node.send({ \"key\": \"6\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad7) {\n node.send({ \"key\": \"7\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad8) {\n node.send({ \"key\": \"8\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Numpad9) {\n node.send({ \"key\": \"9\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.NumpadMultiply) {\n node.send({ \"key\": \"*\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.NumpadAdd) {\n node.send({ \"key\": \"+\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.NumpadSubtract) {\n node.send({ \"key\": \"-\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.NumpadDecimal) {\n node.send({ \"key\": \".\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.NumpadDivide) {\n node.send({ \"key\": \"/\", \"modifiers\": e });\n };\n\n // handle special keys\n if (e.keycode === UiohookKey.Backspace) {\n node.send({ \"key\": \"backspace\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Tab) {\n node.send({ \"key\": \"tab\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Enter) {\n node.send({ \"key\": \"enter\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.CapsLock) {\n node.send({ \"key\": \"capsLock\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Escape) {\n node.send({ \"key\": \"escape\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Space) {\n node.send({ \"key\": \" \", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.PageUp) {\n node.send({ \"key\": \"pageup\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.PageDown) {\n node.send({ \"key\": \"pagedown\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.End) {\n node.send({ \"key\": \"end\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Home) {\n node.send({ \"key\": \"home\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ArrowLeft) {\n node.send({ \"key\": \"left\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ArrowUp) {\n node.send({ \"key\": \"up\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ArrowRight) {\n node.send({ \"key\": \"right\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ArrowDown) {\n node.send({ \"key\": \"down\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Insert) {\n node.send({ \"key\": \"insert\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Delete) {\n node.send({ \"key\": \"delete\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ScrollLock) {\n node.send({ \"key\": \"scrollLock\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.PrintScreen) {\n node.send({ \"key\": \"printScreen\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Pause) {\n node.send({ \"key\": \"pause\", \"modifiers\": e });\n };\n\n // handle symbols\n if (e.keycode === UiohookKey.Semicolon) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \":\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \";\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Equal) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"+\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"=\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Comma) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"<\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \",\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Minus) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"_\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"-\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Period) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \">\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \".\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Slash) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"?\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"/\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Backquote) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"~\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"`\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.BracketLeft) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"{\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"[\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Backslash) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"|\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"\\\\\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.BracketRight) {\n if (e.shiftKey === true) {\n node.send({ \"key\": \"}\", \"modifiers\": e });\n } else {\n node.send({ \"key\": \"]\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Quote) {\n if (e.shiftKey === true) {\n node.send({ \"key\": `\"`, \"modifiers\": e });\n } else {\n node.send({ \"key\": \"'\", \"modifiers\": e });\n };\n };\n if (e.keycode === UiohookKey.Ctrl) {\n node.send({ \"key\": \"control\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.CtrlRight) {\n node.send({ \"key\": \"control\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Alt) {\n node.send({ \"key\": \"alt\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.AltRight) {\n node.send({ \"key\": \"alt\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Shift) {\n //node.send({ \"key\": \"shift\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.ShiftRight) {\n //node.send({ \"key\": \"shift\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.Meta) {\n node.send({ \"key\": \"command\", \"modifiers\": e });\n };\n if (e.keycode === UiohookKey.MetaRight) {\n node.send({ \"key\": \"command\", \"modifiers\": e });\n };\n };\n\n if (event === \"click\") {\n let mouseButton = \"\";\n if (e.button === 1) {\n mouseButton = \"leftClick\";\n };\n if (e.button === 2) {\n mouseButton = \"rightClick\";\n };\n if (e.button === 3) {\n mouseButton = \"middleClick\";\n };\n node.send({ \"key\": mouseButton, \"modifiers\": e });\n };\n \n if (event === \"wheel\") {\n let mouseWheel = \"\";\n if (e.rotation === 1) {\n mouseWheel = \"mouseWheelDown\";\n };\n if (e.rotation === -1) {\n mouseWheel = \"mouseWheelUp\";\n };\n node.send({ \"key\": mouseWheel, \"modifiers\": e }); \n };\n\n if (event === \"mousemove\") {\n (function throttle() {\n if (throttlePause) return;\n throttlePause = true;\n setTimeout(() => {\n mouseMove();\n throttlePause = false;\n }, 250);\n })();\n\n function mouseMove() {\n node.send({ \"key\": \"mousemove\", \"modifiers\": e });\n node.status({ fill: \"green\", shape: \"dot\", text: `${e.x},${e.y}` });\n };\n };\n });\n };\n};\n\n// controls to turn on the listener\nif (msg.payload === \"on\") {\n startListener();\n // status output for function node\n node.status({ fill: \"green\", shape: \"dot\", text: \"ON\" });\n};\n\n// controls to turn off the listener\nif (msg.payload === \"off\") {\n // clear all events\n uIOhook._events.keydown = [];\n uIOhook._events.keyup = [];\n uIOhook._events.mousedown = [];\n uIOhook._events.mouseup = [];\n uIOhook._events.mousemove = [];\n uIOhook._events.click = [];\n uIOhook._events.wheel = [];\n // stop the listener\n uIOhook.stop();\n // status output for function node\n node.status({ fill: \"red\", shape: \"dot\", text: \"OFF\" });\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "uiohookNapi", | |
"module": "uiohook-napi" | |
}, | |
{ | |
"var": "robot", | |
"module": "@jitsi/robotjs" | |
} | |
], | |
"x": 240, | |
"y": 640, | |
"wires": [ | |
[ | |
"58dbce6b12293fd4" | |
] | |
] | |
}, | |
{ | |
"id": "493e4ec5cf0b8f45", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c092cf444f535173", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": true, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "off", | |
"payloadType": "str", | |
"x": 110, | |
"y": 680, | |
"wires": [ | |
[ | |
"fc2c6e33831e6351" | |
] | |
] | |
}, | |
{ | |
"id": "14dc316bc29b59d8", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "c092cf444f535173", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "on", | |
"payloadType": "str", | |
"x": 110, | |
"y": 640, | |
"wires": [ | |
[ | |
"fc2c6e33831e6351" | |
] | |
] | |
}, | |
{ | |
"id": "7fb64340a36bd1c7", | |
"type": "range", | |
"z": "d00b0fc2cbee167f", | |
"g": "c092cf444f535173", | |
"minin": "0", | |
"maxin": "2160", | |
"minout": "0", | |
"maxout": "864", | |
"action": "clamp", | |
"round": true, | |
"property": "modifiers.y", | |
"name": "scale y", | |
"x": 660, | |
"y": 640, | |
"wires": [ | |
[ | |
"528e438eb92482f4" | |
] | |
] | |
}, | |
{ | |
"id": "a0ea8092d3e2593e", | |
"type": "range", | |
"z": "d00b0fc2cbee167f", | |
"g": "c092cf444f535173", | |
"minin": "0", | |
"maxin": "3840", | |
"minout": "0", | |
"maxout": "1536", | |
"action": "clamp", | |
"round": true, | |
"property": "modifiers.x", | |
"name": "scale x", | |
"x": 520, | |
"y": 640, | |
"wires": [ | |
[ | |
"7fb64340a36bd1c7" | |
] | |
] | |
}, | |
{ | |
"id": "58dbce6b12293fd4", | |
"type": "switch", | |
"z": "d00b0fc2cbee167f", | |
"g": "c092cf444f535173", | |
"name": "route", | |
"property": "key", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "eq", | |
"v": "leftClick", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "rightClick", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "middleClick", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "mousemove", | |
"vt": "str" | |
}, | |
{ | |
"t": "else" | |
} | |
], | |
"checkall": "false", | |
"repair": false, | |
"outputs": 5, | |
"x": 370, | |
"y": 640, | |
"wires": [ | |
[ | |
"72ace384f1846a5c" | |
], | |
[ | |
"72ace384f1846a5c" | |
], | |
[ | |
"72ace384f1846a5c" | |
], | |
[ | |
"a0ea8092d3e2593e" | |
], | |
[ | |
"599f89d40f328446" | |
] | |
] | |
}, | |
{ | |
"id": "72ace384f1846a5c", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "c092cf444f535173", | |
"name": "clicks", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 510, | |
"y": 600, | |
"wires": [] | |
}, | |
{ | |
"id": "599f89d40f328446", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "c092cf444f535173", | |
"name": "keys", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 510, | |
"y": 680, | |
"wires": [] | |
}, | |
{ | |
"id": "528e438eb92482f4", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "c092cf444f535173", | |
"name": "mouse(x,y)", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 810, | |
"y": 640, | |
"wires": [] | |
}, | |
{ | |
"id": "c31337c6d5504cab", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "868cb58b3acd0d8e", | |
"name": "node-hid", | |
"func": "msg.payload = HID.devices();\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "HID", | |
"module": "node-hid" | |
} | |
], | |
"x": 260, | |
"y": 1240, | |
"wires": [ | |
[ | |
"edaa84d183c9a0c3" | |
] | |
] | |
}, | |
{ | |
"id": "94e7db76828971a6", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "868cb58b3acd0d8e", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 110, | |
"y": 1240, | |
"wires": [ | |
[ | |
"c31337c6d5504cab" | |
] | |
] | |
}, | |
{ | |
"id": "edaa84d183c9a0c3", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "868cb58b3acd0d8e", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 450, | |
"y": 1240, | |
"wires": [] | |
}, | |
{ | |
"id": "d098567c9d63ef76", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "868cb58b3acd0d8e", | |
"name": "node-hid", | |
"func": "msg.list = HID.devices();\nlet device = new HID.HID(39046,1);\n\n// controls to turn on the listener\nif (msg.payload === \"on\") {\n device.on('data', function (data) {\n node.send({\"payload\":data});\n });\n\n // status output for function node\n node.status({ fill: \"green\", shape: \"dot\", text: \"ON\" });\n};\n\n// controls to turn off the listener\nif (msg.payload === \"off\") {\n device.close();\n\n // status output for function node\n node.status({ fill: \"red\", shape: \"dot\", text: \"OFF\" });\n};\n\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "HID", | |
"module": "node-hid" | |
} | |
], | |
"x": 260, | |
"y": 1300, | |
"wires": [ | |
[ | |
"5e759e9d48056137" | |
] | |
] | |
}, | |
{ | |
"id": "5e759e9d48056137", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "868cb58b3acd0d8e", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 450, | |
"y": 1300, | |
"wires": [] | |
}, | |
{ | |
"id": "a8fdc08437f87e30", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "868cb58b3acd0d8e", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "off", | |
"payloadType": "str", | |
"x": 110, | |
"y": 1320, | |
"wires": [ | |
[ | |
"d098567c9d63ef76" | |
] | |
] | |
}, | |
{ | |
"id": "6fbf69a811a313f3", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "868cb58b3acd0d8e", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "on", | |
"payloadType": "str", | |
"x": 110, | |
"y": 1280, | |
"wires": [ | |
[ | |
"d098567c9d63ef76" | |
] | |
] | |
}, | |
{ | |
"id": "7ec797914ec41d54", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "Dualshock", | |
"func": "function filterDeadZone(data, side) {\n if (data.x >= 145 || data.x <= 115 || data.y >= 145 || data.y <= 115) {\n node.send({ \"payload\": `${side}Stick move: (${data.x},${data.y})`, \"controller\": controller, \"topic\": `${side}Stick`});\n } else {\n return;\n };\n};\n\n// controls to turn on the listener\nif (msg.payload === \"on\") {\n // pass options to create the controller.\n var controller = dualShock({\n // you can use a ds4 by uncommenting this line.\n config: \"dualshock4-generic-driver\",\n\n // if the above configuration doesn\"t work for you,\n // try uncommenting the following line instead.\n //config: \"dualshock4-alternate-driver\",\n\n // if using ds4 comment this line.\n //config: \"dualShock3\",\n\n // smooths the output from the acelerometers (moving averages) defaults to true\n accelerometerSmoothing: true,\n\n // smooths the output from the analog sticks (moving averages) defaults to false\n analogStickSmoothing: false,\n });\n\n // set the maximum number of listeners\n controller._maxListeners = 50;\n\n // make sure you add an error event handler\n controller.on(\"error\", err => node.error({ \"error\": err }));\n\n // analog stick handlers:\n controller.on(\"left:move\", data => filterDeadZone(data, \"left\"));\n controller.on(\"right:move\", data => filterDeadZone(data, \"right\"));\n //controller.on(\"left:move\", data => node.send({ \"payload\": `leftStick move: (${data.x},${data.y})`, \"controller\": controller}));\n //controller.on(\"right:move\", data => node.send({ \"payload\": `rightStick move: (${data.x},${data.y})`, \"controller\": controller}));\n\n // square, triangle, circle, and cross event handlers:\n controller.on(\"square:press\", () => node.send({ \"payload\": \"square press\", \"controller\": controller }));\n controller.on(\"square:release\", () => node.send({ \"payload\": \"square release\", \"controller\": controller }));\n controller.on(\"triangle:press\", () => node.send({ \"payload\": \"triangle press\", \"controller\": controller }));\n controller.on(\"triangle:release\", () => node.send({ \"payload\": \"triangle release\", \"controller\": controller }));\n controller.on(\"circle:press\", () => node.send({ \"payload\": \"circle press\", \"controller\": controller }));\n controller.on(\"circle:release\", () => node.send({ \"payload\": \"circle release\", \"controller\": controller }));\n controller.on(\"x:press\", () => node.send({ \"payload\": \"cross press\", \"controller\": controller }));\n controller.on(\"x:release\", () => node.send({ \"payload\": \"cross release\", \"controller\": controller }));\n\n // dpad event handlers:\n controller.on(\"dpadUp:press\", () => node.send({ \"payload\": \"dpadUp press\", \"controller\": controller }));\n controller.on(\"dpadUp:release\", () => node.send({ \"payload\": \"dpadUp release\", \"controller\": controller }));\n controller.on(\"dpadUpRight:press\", () => node.send({ \"payload\": \"dpadUpRight press\", \"controller\": controller }));\n controller.on(\"dpadUpRight:release\", () => node.send({ \"payload\": \"dpadUpRight release\", \"controller\": controller }));\n controller.on(\"dpadRight:press\", () => node.send({ \"payload\": \"dpadRight press\", \"controller\": controller }));\n controller.on(\"dpadRight:release\", () => node.send({ \"payload\": \"dpadRight release\", \"controller\": controller }));\n controller.on(\"dpadDownRight:press\", () => node.send({ \"payload\": \"dpadDownRight press\", \"controller\": controller }));\n controller.on(\"dpadDownRight:release\", () => node.send({ \"payload\": \"dpadDownRight release\", \"controller\": controller }));\n controller.on(\"dpadDown:press\", () => node.send({ \"payload\": \"dpadDown press\", \"controller\": controller }));\n controller.on(\"dpadDown:release\", () => node.send({ \"payload\": \"dpadDown release\", \"controller\": controller }));\n controller.on(\"dpadDownLeft:press\", () => node.send({ \"payload\": \"dpadDownLeft press\", \"controller\": controller }));\n controller.on(\"dpadDownLeft:release\", () => node.send({ \"payload\": \"dpadDownLeft release\", \"controller\": controller }));\n controller.on(\"dpadLeft:press\", () => node.send({ \"payload\": \"dpadLeft press\", \"controller\": controller }));\n controller.on(\"dpadLeft:release\", () => node.send({ \"payload\": \"dpadLeft release\", \"controller\": controller }));\n controller.on(\"dpadUpLeft:press\", () => node.send({ \"payload\": \"dpadUpLeft press\", \"controller\": controller }));\n controller.on(\"dpadUpLeft:release\", () => node.send({ \"payload\": \"dpadUpLeft release\", \"controller\": controller }));\n \n // share, options, and PS Button handlers:\n controller.on(\"share:press\", () => node.send({ \"payload\": \"share press\", \"controller\": controller }));\n controller.on(\"share:release\", () => node.send({ \"payload\": \"share release\", \"controller\": controller }));\n controller.on(\"options:press\", () => node.send({ \"payload\": \"options press\", \"controller\": controller }));\n controller.on(\"options:release\", () => node.send({ \"payload\": \"options release\", \"controller\": controller }));\n controller.on(\"psxButton:press\", () => node.send({ \"payload\": \"PS Button press\", \"controller\": controller }));\n controller.on(\"psxButton:release\", () => node.send({ \"payload\": \"PS Button release\", \"controller\": controller }));\n \n // L/R handlers:\n controller.on(\"l1:press\", () => node.send({ \"payload\": \"L1 press\", \"controller\": controller }));\n controller.on(\"l1:release\", () => node.send({ \"payload\": \"L1 release\", \"controller\": controller }));\n controller.on(\"r1:press\", () => node.send({ \"payload\": \"R1 press\", \"controller\": controller }));\n controller.on(\"r1:release\", () => node.send({ \"payload\": \"R1 release\", \"controller\": controller }));\n controller.on(\"l2:press\", () => node.send({ \"payload\": \"L2 press\", \"controller\": controller }));\n controller.on(\"l2:release\", () => node.send({ \"payload\": \"L2 release\", \"controller\": controller }));\n //controller.on(\"l2:analog\", () => node.send({ \"payload\": \"L2 analog\", \"controller\": controller }));\n controller.on(\"r2:press\", () => node.send({ \"payload\": \"R2 press\", \"controller\": controller }));\n controller.on(\"r2:release\", () => node.send({ \"payload\": \"R2 release\", \"controller\": controller }));\n //controller.on(\"r2:analog\", () => node.send({ \"payload\": \"R2 analog\", \"controller\": controller }));\n //controller.on(\"leftAnalogBump:press\", () => node.send({ \"payload\": \"L2 press\", \"controller\": controller }));\n //controller.on(\"leftAnalogBump:release\", () => node.send({ \"payload\": \"L2 release\", \"controller\": controller }));\n //controller.on(\"rightAnalogBump:press\", () => node.send({ \"payload\": \"R2 press\", \"controller\": controller }));\n //controller.on(\"rightAnalogBump:release\", () => node.send({ \"payload\": \"R2 release\", \"controller\": controller }));\n controller.on(\"leftStick:press\", () => node.send({ \"payload\": \"L3 press\", \"controller\": controller }));\n controller.on(\"leftStick:release\", () => node.send({ \"payload\": \"L3 release\", \"controller\": controller }));\n controller.on(\"rightStick:press\", () => node.send({ \"payload\": \"R3 press\", \"controller\": controller }));\n controller.on(\"rightStick:release\", () => node.send({ \"payload\": \"R3 release\", \"controller\": controller }));\n\n // touchpad handlers:\n controller.on(\"touchpad:press\", () => node.send({ \"payload\": \"touchpad press\", \"controller\": controller }));\n controller.on(\"touchpad:release\", () => node.send({ \"payload\": \"touchpad release\", \"controller\": controller }));\n //finger 1 is x1 finger 2 is x2\n //controller.on(\"touchpad:x1:active\", () => node.send({ \"payload\": \"touchpad one finger active\" }));\n //controller.on(\"touchpad:x2:active\", () => node.send({ \"payload\": \"touchpad two fingers active\" }));\n //controller.on(\"touchpad:x2:inactive\", () => node.send({ \"payload\": \"touchpad back to single finger\" }));\n //controller.on(\"touchpad:x1\", data => node.send({ \"payload\": `touchpad x1: ${data.x}, ${data.y}`, \"controller\": controller, \"topic\": \"touchpad\" }));\n //controller.on(\"touchpad:x2\", data => node.send({ \"payload\": `touchpad x2: ${data.x}, ${data.y}`, \"controller\": controller, \"topic\": \"touchpad\" }));\n\n // motion control handlers:\n //controller.on(\"rightLeft:motion\", data => node.send({ \"payload\": data, \"topic\": \"motion\", \"controller\": controller }))\n //controller.on(\"forwardBackward:motion\", data => node.send({ \"payload\": data, \"topic\": \"motion\", \"controller\": controller }))\n //controller.on(\"upDown:motion\", data => node.send({ \"payload\": data, \"topic\": \"motion\", \"controller\": controller }))\n\n // status handlers:\n //controller.on(\"connected\", () => node.send({ \"payload\": \"connected\", \"topic\": \"status\", \"controller\": controller }));\n //controller.on(\"battery:change\", data => node.send({ \"payload\": data, \"topic\": \"status\", \"controller\": controller }));\n //controller.on(\"connection:change\", data => node.send({ \"payload\": data, \"topic\": \"status\", \"controller\": controller }));\n //controller.on(\"charging:change\", data => node.send({ \"payload\": data, \"topic\": \"status\", \"controller\": controller }));\n\n // send startup message\n node.send({ \"payload\": \"Listeners turned on\", \"controller\": controller });\n\n // save controller\n flow.set(\"controller\", controller);\n \n // status output for function node\n node.status({ fill: \"green\", shape: \"dot\", text: \"ON\" });\n};\n\n// controls to turn off the listener\nif (msg.payload === \"off\") {\n // get our saved controller\n let controller = flow.get(\"controller\");\n\n // set the maximum number of listeners\n controller._maxListeners = 0;\n\n // clear event listeners\n controller._events[\"error\"] = [];\n controller._events[\"left:move\"] = [];\n controller._events[\"right:move\"] = [];\n controller._events[\"square:press\"] = [];\n controller._events[\"square:release\"] = [];\n controller._events[\"triangle:press\"] = [];\n controller._events[\"triangle:release\"] = [];\n controller._events[\"circle:press\"] = [];\n controller._events[\"circle:release\"] = [];\n controller._events[\"x:press\"] = [];\n controller._events[\"x:release\"] = [];\n controller._events[\"dpadUp:press\"] = [];\n controller._events[\"dpadUp:release\"] = [];\n controller._events[\"dpadUpRight:press\"] = [];\n controller._events[\"dpadUpRight:release\"] = [];\n controller._events[\"dpadRight:press\"] = [];\n controller._events[\"dpadRight:release\"] = [];\n controller._events[\"dpadDownRight:press\"] = [];\n controller._events[\"dpadDownRight:release\"] = [];\n controller._events[\"dpadDown:press\"] = [];\n controller._events[\"dpadDown:release\"] = [];\n controller._events[\"dpadDownLeft:press\"] = [];\n controller._events[\"dpadDownLeft:release\"] = [];\n controller._events[\"dpadLeft:press\"] = [];\n controller._events[\"dpadLeft:release\"] = [];\n controller._events[\"dpadUpLeft:press\"] = [];\n controller._events[\"dpadUpLeft:release\"] = [];\n controller._events[\"options:press\"] = [];\n controller._events[\"options:release\"] = [];\n controller._events[\"share:press\"] = [];\n controller._events[\"share:release\"] = [];\n controller._events[\"psxButton:press\"] = [];\n controller._events[\"psxButton:release\"] = [];\n controller._events[\"l1:press\"] = [];\n controller._events[\"l1:release\"] = [];\n controller._events[\"r1:press\"] = [];\n controller._events[\"r1:release\"] = [];\n controller._events[\"l2:press\"] = [];\n controller._events[\"l2:release\"] = [];\n controller._events[\"r2:press\"] = [];\n controller._events[\"r2:release\"] = [];\n controller._events[\"leftStick:press\"] = [];\n controller._events[\"leftStick:release\"] = [];\n controller._events[\"rightStick:press\"] = [];\n controller._events[\"rightStick:release\"] = [];\n controller._events[\"touchpad:press\"] = [];\n controller._events[\"touchpad:release\"] = [];\n\n // send final closing message\n node.send({ \"payload\": \"Listeners turned off\", \"controller\": controller });\n\n // save controller\n flow.set(\"controller\", controller);\n\n // status output for function node\n node.status({ fill: \"red\", shape: \"dot\", text: \"OFF\" });\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "dualShock", | |
"module": "node-dualshock-controller" | |
} | |
], | |
"x": 810, | |
"y": 880, | |
"wires": [ | |
[ | |
"c0d70a13d2f78e07" | |
] | |
] | |
}, | |
{ | |
"id": "d75127d784232ce1", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "rightStick(x,y)", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1320, | |
"y": 860, | |
"wires": [] | |
}, | |
{ | |
"id": "14ee52a67eb55ccf", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "on", | |
"payloadType": "str", | |
"x": 650, | |
"y": 860, | |
"wires": [ | |
[ | |
"7ec797914ec41d54" | |
] | |
] | |
}, | |
{ | |
"id": "867c81b17662016d", | |
"type": "catch", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "", | |
"scope": [ | |
"7ec797914ec41d54" | |
], | |
"uncaught": false, | |
"x": 650, | |
"y": 960, | |
"wires": [ | |
[ | |
"e7bca829922c30e9" | |
] | |
] | |
}, | |
{ | |
"id": "855155141e574072", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "errors", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 950, | |
"y": 960, | |
"wires": [] | |
}, | |
{ | |
"id": "e7bca829922c30e9", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "warn", | |
"func": "if (msg.error) {\n node.warn(\"Don't forget to check that the controller hasn't lost connection first.\")\n};\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [], | |
"x": 790, | |
"y": 960, | |
"wires": [ | |
[ | |
"855155141e574072" | |
] | |
] | |
}, | |
{ | |
"id": "c0d70a13d2f78e07", | |
"type": "switch", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "", | |
"property": "topic", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "eq", | |
"v": "hold", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "leftStick", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "rightStick", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "motion", | |
"vt": "str" | |
}, | |
{ | |
"t": "eq", | |
"v": "status", | |
"vt": "str" | |
}, | |
{ | |
"t": "else" | |
} | |
], | |
"checkall": "true", | |
"repair": false, | |
"outputs": 6, | |
"x": 950, | |
"y": 880, | |
"wires": [ | |
[ | |
"c6aa72d096094c12" | |
], | |
[ | |
"0d6157045e7a2719" | |
], | |
[ | |
"abd7b4f18332ff96" | |
], | |
[ | |
"9c6db5fb438d7466" | |
], | |
[ | |
"5bb3fc11f6f53daa" | |
], | |
[ | |
"9c0363eb4647080d" | |
] | |
] | |
}, | |
{ | |
"id": "85018e53725a1df3", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "leftStick(x,y)", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1310, | |
"y": 820, | |
"wires": [] | |
}, | |
{ | |
"id": "9c0363eb4647080d", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "other", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1130, | |
"y": 980, | |
"wires": [] | |
}, | |
{ | |
"id": "0d6157045e7a2719", | |
"type": "delay", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "", | |
"pauseType": "rate", | |
"timeout": "5", | |
"timeoutUnits": "seconds", | |
"rate": "5", | |
"nbRateUnits": "1", | |
"rateUnits": "second", | |
"randomFirst": "1", | |
"randomLast": "5", | |
"randomUnits": "seconds", | |
"drop": true, | |
"allowrate": false, | |
"outputs": 1, | |
"x": 1150, | |
"y": 820, | |
"wires": [ | |
[ | |
"85018e53725a1df3" | |
] | |
] | |
}, | |
{ | |
"id": "abd7b4f18332ff96", | |
"type": "delay", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "", | |
"pauseType": "rate", | |
"timeout": "5", | |
"timeoutUnits": "seconds", | |
"rate": "5", | |
"nbRateUnits": "1", | |
"rateUnits": "second", | |
"randomFirst": "1", | |
"randomLast": "5", | |
"randomUnits": "seconds", | |
"drop": true, | |
"allowrate": false, | |
"outputs": 1, | |
"x": 1150, | |
"y": 860, | |
"wires": [ | |
[ | |
"d75127d784232ce1" | |
] | |
] | |
}, | |
{ | |
"id": "5bb3fc11f6f53daa", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "controller status", | |
"active": false, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1160, | |
"y": 940, | |
"wires": [] | |
}, | |
{ | |
"id": "9c6db5fb438d7466", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "motion", | |
"active": false, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1130, | |
"y": 900, | |
"wires": [] | |
}, | |
{ | |
"id": "c6aa72d096094c12", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "hold", | |
"active": false, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 1130, | |
"y": 780, | |
"wires": [] | |
}, | |
{ | |
"id": "8e9a19afca3c8aa9", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"name": "(0,0)", | |
"info": "", | |
"x": 1550, | |
"y": 800, | |
"wires": [] | |
}, | |
{ | |
"id": "285ccea34e319f1b", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"name": "(0,255)", | |
"info": "", | |
"x": 1550, | |
"y": 840, | |
"wires": [] | |
}, | |
{ | |
"id": "8f64d25ffba3f841", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"name": "(255,0)", | |
"info": "", | |
"x": 1670, | |
"y": 800, | |
"wires": [] | |
}, | |
{ | |
"id": "39a4285bb47ae1c0", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"name": "(255,255)", | |
"info": "", | |
"x": 1680, | |
"y": 840, | |
"wires": [] | |
}, | |
{ | |
"id": "76a3afb7cf4a2ef7", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "Sender controls", | |
"info": "", | |
"x": 660, | |
"y": 820, | |
"wires": [] | |
}, | |
{ | |
"id": "f8ec9647d62cdd8e", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "Output here", | |
"info": "", | |
"x": 950, | |
"y": 800, | |
"wires": [] | |
}, | |
{ | |
"id": "256f47c411c8dcab", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "c092cf444f535173", | |
"name": "Sender controls", | |
"info": "", | |
"x": 120, | |
"y": 600, | |
"wires": [] | |
}, | |
{ | |
"id": "4ffb1f1aa366a1f8", | |
"type": "comment", | |
"z": "d00b0fc2cbee167f", | |
"g": "c092cf444f535173", | |
"name": "Output here", | |
"info": "", | |
"x": 370, | |
"y": 580, | |
"wires": [] | |
}, | |
{ | |
"id": "eaa660a8d2ee87f0", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"g": "db8e3255806f7983", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": true, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payload": "off", | |
"payloadType": "str", | |
"x": 650, | |
"y": 900, | |
"wires": [ | |
[ | |
"7ec797914ec41d54" | |
] | |
] | |
}, | |
{ | |
"id": "7e0dc15615a88786", | |
"type": "debug", | |
"z": "d00b0fc2cbee167f", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"statusVal": "", | |
"statusType": "auto", | |
"x": 990, | |
"y": 1180, | |
"wires": [] | |
}, | |
{ | |
"id": "b2e255cb4d0f380f", | |
"type": "function", | |
"z": "d00b0fc2cbee167f", | |
"name": "node-hid", | |
"func": "msg.payload = HID.devices();\nreturn msg;", | |
"outputs": 1, | |
"noerr": 0, | |
"initialize": "", | |
"finalize": "", | |
"libs": [ | |
{ | |
"var": "HID", | |
"module": "node-hid" | |
} | |
], | |
"x": 800, | |
"y": 1180, | |
"wires": [ | |
[ | |
"7e0dc15615a88786" | |
] | |
] | |
}, | |
{ | |
"id": "9f842bfb0e569893", | |
"type": "inject", | |
"z": "d00b0fc2cbee167f", | |
"name": "", | |
"props": [ | |
{ | |
"p": "payload" | |
} | |
], | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"topic": "", | |
"payloadType": "str", | |
"x": 650, | |
"y": 1180, | |
"wires": [ | |
[ | |
"b2e255cb4d0f380f" | |
] | |
] | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment