Hi Guys,
I’ve been trying to make a node-red flow which captures images from my ip camera and feeds the result int watson visual recognition. To do this I am using the webshot node (node-red-contrib-webshot) the results are then displayed on the node-red dashboard. The flow works however whenever I need to restart the server I must use the command “node-red new_file.js” as by just using the command “node red” the flow immediately starts which causes the webshot node to capture multiple images simultaneously and subsequently stop the flow and cause the server to crash. Starting the flow from a new file causes the watson visual recognition api key to be reset and a new credential has to be made. Would you be able to advise me if there is anyway of either starting Node-red without instantly deploying or starting it with a file name that does not require the watson API key to be reset.
A copy of my flow with some information removed for security purposes:
[{"id":"3c1ef878.c21fb8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"d2f5e764.89c8e8","type":"ui_template","z":"3c1ef878.c21fb8","group":"dd3a7c7a.5c76b","name":"","order":0,"width":"20","height":"16","format":"<img ng-src=\"{{msg.payload}}\">","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":695,"y":246.77777099609375,"wires":[[]],"inputLabels":["{{msg.template}}"]},{"id":"cd493c2b.45cd3","type":"trigger","z":"3c1ef878.c21fb8","op1":"","op2":"0","op1type":"str","op2type":"str","duration":"-1.5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":248,"y":171.77777099609375,"wires":[["3a93e9c0.5383e6","4b9bb4d5.43691c"]]},{"id":"5f437fbf.f6d57","type":"base64","z":"3c1ef878.c21fb8","name":"","action":"","property":"payload","x":692,"y":173.77777099609375,"wires":[["c48bda24.b3bac8"]]},{"id":"c48bda24.b3bac8","type":"visual-recognition-v3","z":"3c1ef878.c21fb8","name":"","apikey":"","vr-service-endpoint":"https://gateway.watsonplatform.net/visual-recognition/api","image-feature":"classifyImage","lang":"en","x":927,"y":173.77777099609375,"wires":[["6f956fc9.77b7","f687f359.0f11e","7936f7ee.983c28","9f6ab1c1.e5132","64b61c83.3c2dd4","5e90582.994e8a8","e3f05977.414608","3da3ee0d.e3b442","572173a.c0ffa8c","cb592bf5.80a148"]]},{"id":"2c2f0b89.525304","type":"ui_text_input","z":"3c1ef878.c21fb8","name":"","label":"","group":"7f8ae726.209db8","order":1,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":68.33334350585938,"y":20,"wires":[["c1a534ab.72ac28"]]},{"id":"c1a534ab.72ac28","type":"function","z":"3c1ef878.c21fb8","name":"Set SP1","func":"global.set(\"Search_Parameter_1\",msg.payload);","outputs":1,"noerr":0,"x":287,"y":20.77777099609375,"wires":[[]]},{"id":"8caf1810.a58958","type":"function","z":"3c1ef878.c21fb8","name":"Set Sp2","func":"global.set(\"Search_Parameter_2\",msg.payload);","outputs":1,"noerr":0,"x":289,"y":59.77777099609375,"wires":[[]]},{"id":"5fd3c6b0.74a538","type":"function","z":"3c1ef878.c21fb8","name":"Set SP3","func":"global.set(\"Search_Parameter_3\",msg.payload);","outputs":1,"noerr":0,"x":290,"y":97.77777099609375,"wires":[[]]},{"id":"8c3f0292.68611","type":"ui_text_input","z":"3c1ef878.c21fb8","name":"","label":"","group":"7f8ae726.209db8","order":2,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":65,"y":59.77777099609375,"wires":[["8caf1810.a58958"]]},{"id":"a21616ec.be7ba8","type":"ui_text_input","z":"3c1ef878.c21fb8","name":"","label":"","group":"7f8ae726.209db8","order":3,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":66.11114501953125,"y":97.77777099609375,"wires":[["5fd3c6b0.74a538"]]},{"id":"3a93e9c0.5383e6","type":"WebShot","z":"3c1ef878.c21fb8","name":"","url":"","x":528,"y":173.77777099609375,"wires":[["5f437fbf.f6d57"]]},{"id":"30bdf622.3db27a","type":"ui_button","z":"3c1ef878.c21fb8","name":"","group":"93e547ed.4ede68","order":0,"width":0,"height":0,"passthru":false,"label":"button","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"","x":58,"y":171.77777099609375,"wires":[["cd493c2b.45cd3"]]},{"id":"4b9bb4d5.43691c","type":"function","z":"3c1ef878.c21fb8","name":"timestamp","func":"msg.payload += \"&ts=\"+Date.now();\nreturn msg;","outputs":1,"noerr":0,"x":538,"y":247.77777099609375,"wires":[["d2f5e764.89c8e8"]]},{"id":"8ff82533.878558","type":"ui_text","z":"3c1ef878.c21fb8","group":"b78cc302.eb06d","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1233,"y":241,"wires":[]},{"id":"abab9214.a74d5","type":"ui_text","z":"3c1ef878.c21fb8","group":"b78cc302.eb06d","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1233,"y":313,"wires":[]},{"id":"7fc62e95.b9e52","type":"ui_text","z":"3c1ef878.c21fb8","group":"b78cc302.eb06d","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1230,"y":376,"wires":[]},{"id":"e4c2f3e6.f99fe","type":"ui_text","z":"3c1ef878.c21fb8","group":"b78cc302.eb06d","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1231,"y":439,"wires":[]},{"id":"e665c4fd.712bb8","type":"ui_text","z":"3c1ef878.c21fb8","group":"b78cc302.eb06d","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1228,"y":505,"wires":[]},{"id":"288cfa4d.5bbc36","type":"ui_text","z":"3c1ef878.c21fb8","group":"b78cc302.eb06d","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1226,"y":568,"wires":[]},{"id":"6bc65a5a.3471b4","type":"ui_text","z":"3c1ef878.c21fb8","group":"b78cc302.eb06d","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1224,"y":633,"wires":[]},{"id":"8eed9a9a.3fb7f8","type":"ui_text","z":"3c1ef878.c21fb8","group":"b78cc302.eb06d","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1223,"y":696,"wires":[]},{"id":"e21e828a.545b8","type":"ui_text","z":"3c1ef878.c21fb8","group":"b78cc302.eb06d","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1225,"y":758,"wires":[]},{"id":"b19acddf.029e8","type":"ui_text","z":"3c1ef878.c21fb8","group":"b78cc302.eb06d","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1225,"y":821,"wires":[]},{"id":"6f956fc9.77b7","type":"function","z":"3c1ef878.c21fb8","name":"F1","func":"var msgtext=msg.result.images[0].classifiers[0].classes[0].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":1108,"y":239,"wires":[["8ff82533.878558","34b1072.7d03bf8","bc26d90b.396578","40a4951a.63539c"]]},{"id":"f687f359.0f11e","type":"function","z":"3c1ef878.c21fb8","name":"F2","func":"var msgtext=msg.result.images[0].classifiers[0].classes[1].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":1107,"y":313,"wires":[["abab9214.a74d5","34b1072.7d03bf8","bc26d90b.396578","40a4951a.63539c"]]},{"id":"7936f7ee.983c28","type":"function","z":"3c1ef878.c21fb8","name":"F3","func":"var msgtext=msg.result.images[0].classifiers[0].classes[2].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":1103,"y":376,"wires":[["7fc62e95.b9e52","34b1072.7d03bf8","bc26d90b.396578","40a4951a.63539c"]]},{"id":"9f6ab1c1.e5132","type":"function","z":"3c1ef878.c21fb8","name":"F4","func":"var msgtext=msg.result.images[0].classifiers[0].classes[3].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":1103,"y":439,"wires":[["e4c2f3e6.f99fe","34b1072.7d03bf8","bc26d90b.396578","40a4951a.63539c"]]},{"id":"64b61c83.3c2dd4","type":"function","z":"3c1ef878.c21fb8","name":"F5","func":"var msgtext=msg.result.images[0].classifiers[0].classes[4].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":1103,"y":505,"wires":[["e665c4fd.712bb8","34b1072.7d03bf8","bc26d90b.396578","40a4951a.63539c"]]},{"id":"5e90582.994e8a8","type":"function","z":"3c1ef878.c21fb8","name":"F6","func":"var msgtext=msg.result.images[0].classifiers[0].classes[5].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":1100,"y":568,"wires":[["288cfa4d.5bbc36","34b1072.7d03bf8","bc26d90b.396578","40a4951a.63539c"]]},{"id":"e3f05977.414608","type":"function","z":"3c1ef878.c21fb8","name":"F7","func":"var msgtext=msg.result.images[0].classifiers[0].classes[6].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":1101,"y":633,"wires":[["6bc65a5a.3471b4","34b1072.7d03bf8","bc26d90b.396578","40a4951a.63539c"]]},{"id":"3da3ee0d.e3b442","type":"function","z":"3c1ef878.c21fb8","name":"F8","func":"var msgtext=msg.result.images[0].classifiers[0].classes[7].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":1103,"y":697,"wires":[["8eed9a9a.3fb7f8","34b1072.7d03bf8","bc26d90b.396578","40a4951a.63539c"]]},{"id":"572173a.c0ffa8c","type":"function","z":"3c1ef878.c21fb8","name":"F9","func":"var msgtext=msg.result.images[0].classifiers[0].classes[8].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":1104,"y":759,"wires":[["e21e828a.545b8","34b1072.7d03bf8","bc26d90b.396578","40a4951a.63539c"]]},{"id":"cb592bf5.80a148","type":"function","z":"3c1ef878.c21fb8","name":"F10","func":"var msgtext=msg.result.images[0].classifiers[0].classes[9].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":1104,"y":822,"wires":[["b19acddf.029e8","34b1072.7d03bf8","bc26d90b.396578","40a4951a.63539c"]]},{"id":"34b1072.7d03bf8","type":"function","z":"3c1ef878.c21fb8","name":"SP1","func":"var Search_Parameter_1 = global.get(\"Search_Parameter_1\");\nvar date = Date().toString();\nif (msg.payload==Search_Parameter_1){\n msg.payload = (\"Search Result \").concat(Search_Parameter_1.concat(\" found on \")).concat(date);\n return msg;\n}\nelse\n{\n return null\n}","outputs":1,"noerr":0,"x":1597.2222900390625,"y":234,"wires":[["6e5665d8.e8206c"]]},{"id":"bc26d90b.396578","type":"function","z":"3c1ef878.c21fb8","name":"SP2","func":"var Search_Parameter_2 = global.get(\"Search_Parameter_2\");\nvar date = Date().toString();\nif (msg.payload==Search_Parameter_2){\n msg.payload = (\"Search Result \").concat(Search_Parameter_2.concat(\" found on \")).concat(date);\n return msg;\n}\nelse\n{\n return null\n}","outputs":1,"noerr":0,"x":1591.2222290039062,"y":550.2222290039062,"wires":[["1ac957a2.b3e378"]]},{"id":"40a4951a.63539c","type":"function","z":"3c1ef878.c21fb8","name":"SP3","func":"var Search_Parameter_3 = global.get(\"Search_Parameter_3\");\nvar date = Date().toString();\nif (msg.payload==Search_Parameter_3){\n msg.payload = (\"Search Result \").concat(Search_Parameter_3.concat(\" found on \")).concat(date);\n return msg;\n}\nelse\n{\n return null\n}","outputs":1,"noerr":0,"x":1588.22216796875,"y":822.2222290039062,"wires":[["538734b4.e7b4bc"]]},{"id":"6e5665d8.e8206c","type":"ui_text","z":"3c1ef878.c21fb8","group":"502d2fb8.ec561","order":0,"width":"10","height":"5","name":"","label":"{{global.get(Search_Parameter_1)}}","format":"{{msg.payload}}","layout":"col-center","x":1768,"y":237,"wires":[]},{"id":"1ac957a2.b3e378","type":"ui_text","z":"3c1ef878.c21fb8","group":"502d2fb8.ec561","order":0,"width":"10","height":"5","name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1770,"y":551,"wires":[]},{"id":"538734b4.e7b4bc","type":"ui_text","z":"3c1ef878.c21fb8","group":"502d2fb8.ec561","order":0,"width":"10","height":"5","name":"","label":"{{global.get(Search_Parameter_1)}}","format":"{{msg.payload}}","layout":"col-center","x":1763,"y":824,"wires":[]},{"id":"dd3a7c7a.5c76b","type":"ui_group","z":"","name":"JPEG Feed","tab":"649403ae.94a0dc","order":1,"disp":true,"width":"20","collapse":true},{"id":"7f8ae726.209db8","type":"ui_group","z":"","name":"Search Parameters","tab":"649403ae.94a0dc","order":5,"disp":true,"width":"4","collapse":false},{"id":"93e547ed.4ede68","type":"ui_group","z":"","name":"Start Process","tab":"649403ae.94a0dc","order":3,"disp":true,"width":"4","collapse":false},{"id":"b78cc302.eb06d","type":"ui_group","z":"","name":"Watson Analysis","tab":"649403ae.94a0dc","order":4,"disp":true,"width":"4","collapse":false},{"id":"502d2fb8.ec561","type":"ui_group","z":"","name":"Log","tab":"649403ae.94a0dc","order":2,"disp":true,"width":"10","collapse":false},{"id":"649403ae.94a0dc","type":"ui_tab","z":"","name":"image Recognition","icon":"dashboard"}]