Just an example flow to make it easier
[{"id":"7bb2d60f.c90478","type":"inject","z":"ff90d3c.832f33","name":"Start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"10","topic":"","payload":"true","payloadType":"bool","x":150,"y":60,"wires":[["f0e57ab4.99c038"]]},{"id":"322becb9.ad3c24","type":"inject","z":"ff90d3c.832f33","name":"Stop","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":150,"y":110,"wires":[["f0e57ab4.99c038"]]},{"id":"988b91a2.8c941","type":"debug","z":"ff90d3c.832f33","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":580,"y":90,"wires":[]},{"id":"f0e57ab4.99c038","type":"function","z":"ff90d3c.832f33","name":"","func":"var usbDetect = global.get('usbDetect');\n\nif(msg.payload){\n usbDetect.startMonitoring();\n node.warn('started usb monitoring');\n \n usbDetect.on('add', function(device) {\n device.state = \"connected\";\n node.send(device);\n });\n \n usbDetect.on('remove', function(device) {\n device.state = \"removed\";\n node.send(device);\n });\n}\n\nif(!msg.payload){\n usbDetect.stopMonitoring();\n node.warn('stopped usb monitoring');\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":90,"wires":[["988b91a2.8c941"]]}]