Picture triggered from barcode scan shown on dashboard & stored in azure storage blob

Hope this helps others out there. This is a complete working application that takes a picture from a webcam via FFMPEG. This application is triggered via a barcode scan and the name of the picture is what ever is scanned. The picture is automatically displayed in the dashboard and stored in an azure storage blob. This is currently running on a raspberry pi 3b running in kiosk mode that displays the dashboard picture.

[{"id":"fd4603cb.5a873","type":"tab","label":"Get Barcode Value","disabled":false,"info":""},{"id":"40cd43ca.d9a6ac","type":"tab","label":"Take Picture, Store in Azure, delete local file","disabled":false,"info":""},{"id":"c285d68f.a8ffb8","type":"HIDConfig","z":"","vid":"1504","pid":"4608","name":""},{"id":"d7234f55.d6f6f","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":200,"sy":200,"gx":0,"gy":0,"cx":0,"cy":0,"px":0,"py":0}}},{"id":"78dd38b7.1d4588","type":"ui_group","z":"","name":"Default","tab":"92364e51.d5ab9","disp":false,"width":"6","collapse":false},{"id":"92364e51.d5ab9","type":"ui_tab","z":"","name":"Picture Details","icon":"dashboard"},{"id":"dc348fab.16c77","type":"exec","z":"40cd43ca.d9a6ac","command":"ffmpeg","addpay":true,"append":"","useSpawn":"false","timer":"10","oldrc":false,"name":"Capture Picture","x":745.6001586914062,"y":109.60000562667847,"wires":[["d4d708ee.20e5b8"],["a8339a78.f4d818"],["cc3e4e02.e8429","a35c35a1.6a4da8"]]},{"id":"61ecbe51.5d33b","type":"inject","z":"40cd43ca.d9a6ac","name":"Press this button for manual capture with filename test (set above)","topic":"","payload":"test","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":307.0000305175781,"y":98.25000858306885,"wires":[["b5a72e49.45e65"]]},{"id":"d4d708ee.20e5b8","type":"debug","z":"40cd43ca.d9a6ac","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1070.4500122070312,"y":20,"wires":[]},{"id":"a8339a78.f4d818","type":"debug","z":"40cd43ca.d9a6ac","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1060.9502182006836,"y":110.25001668930054,"wires":[]},{"id":"cc3e4e02.e8429","type":"debug","z":"40cd43ca.d9a6ac","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1070.7002182006836,"y":163.7500352859497,"wires":[]},{"id":"621dac85.691b74","type":"debug","z":"40cd43ca.d9a6ac","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":682.6002006530762,"y":301.85013914108276,"wires":[]},{"id":"b5a72e49.45e65","type":"function","z":"40cd43ca.d9a6ac","name":"Set video Capture options and file name from input","func":"flow.set("filename", msg.payload.replace(/[\n\r]+/g, '').trim() + '.jpeg');\nmsg.payload = '-hide_banner -video_size 2304x1536 -i /dev/video0 -vframes 1 -y ' + msg.payload.replace(/[\n\r]+/g, '').trim() + '.jpeg'\nreturn msg;\n","outputs":1,"noerr":0,"x":539.1001586914062,"y":180.2500171661377,"wires":[["621dac85.691b74","dc348fab.16c77"]]},{"id":"88e4d70.a28ed28","type":"debug","z":"40cd43ca.d9a6ac","name":"If says undefined then success!","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":972.1250457763672,"y":508.2500247955322,"wires":[]},{"id":"a35c35a1.6a4da8","type":"switch","z":"40cd43ca.d9a6ac","name":"Make sure picture capture is successful","property":"payload.code","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1011.375114440918,"y":213.25006353855133,"wires":[["4fb2e0de.7d7e6"]]},{"id":"20a0557a.d664aa","type":"Save Blob","z":"40cd43ca.d9a6ac","name":"Azure Save Blob Storage","x":795.1251068115234,"y":412.2500615119934,"wires":[["88e4d70.a28ed28","4e51d4f5.cbb35c"]],"outputLabels":["TEST"]},{"id":"4fb2e0de.7d7e6","type":"change","z":"40cd43ca.d9a6ac","name":"Set filename to value stored earlier","rules":[{"t":"set","p":"payload","pt":"msg","to":"filename","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000.1250152587891,"y":321.00002241134644,"wires":[["20a0557a.d664aa","6162c282.d4587c"]]},{"id":"ec31c14b.a3f72","type":"link in","z":"40cd43ca.d9a6ac","name":"Barcode value from flow1","links":["6e0b042b.2bc8ec"],"x":51.500003814697266,"y":239.00000667572021,"wires":[["fb491fbd.26666"]]},{"id":"784801c1.3bebd","type":"getHIDdevices","z":"fd4603cb.5a873","name":"","x":306.1000061035156,"y":60.200008392333984,"wires":[["b52ab58f.5a8688"]]},{"id":"6c0e97c8.23d848","type":"inject","z":"fd4603cb.5a873","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":146.10000610351562,"y":52.000000953674316,"wires":[["784801c1.3bebd"]]},{"id":"b52ab58f.5a8688","type":"debug","z":"fd4603cb.5a873","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":551.1000366210938,"y":86.80000305175781,"wires":[]},{"id":"6d0633d6.29179c","type":"HIDdevice","z":"fd4603cb.5a873","connection":"c285d68f.a8ffb8","name":"Get Barcode Value","x":113.10000991821289,"y":119.60000514984131,"wires":[["ae181f10.ec5f9"],[]]},{"id":"435b0516.a7129c","type":"debug","z":"fd4603cb.5a873","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":640.3700561523438,"y":153.4700164794922,"wires":[]},{"id":"698eefd8.05436","type":"function","z":"fd4603cb.5a873","name":"Translate","func":"keymap = [\n '', '', '', '',\n 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',\n 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',\n '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\n', '^]', '^H',\n '^I', ' ', '-', '=', '[', ']', '\\', '>', ';', "'", '`', ',', '.',\n '/', 'CapsLock', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12',\n 'PS', 'SL', 'Pause', 'Ins', 'Home', 'PU', '^D', 'End', 'PD', '->', '<-', '-v', '-^', 'NL',\n 'KP/', 'KP*', 'KP-', 'KP+', 'KPE', 'KP1', 'KP2', 'KP3', 'KP4', 'KP5', 'KP6', 'KP7', 'KP8',\n 'KP9', 'KP0', '\\', 'App', 'Pow', 'KP=', 'F13', 'F14'\n]\nvar replacechars = function(c){\n return keymap[c] || c;\n};\nmsg.payload = replacechars(msg.payload)\n\nreturn msg;","outputs":1,"noerr":0,"x":234.10008239746094,"y":297.2000102996826,"wires":[["b37b04a2.54f2b8"]]},{"id":"ae181f10.ec5f9","type":"function","z":"fd4603cb.5a873","name":"FilterValuesOnly","func":"msg.payload = msg.payload[2]\nreturn msg;","outputs":1,"noerr":0,"x":335.1000061035156,"y":146.20001602172852,"wires":[["91dea02.7c41b6"]]},{"id":"b37b04a2.54f2b8","type":"join","z":"fd4603cb.5a873","name":"JoinDigits","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"str","accumulate":false,"timeout":".2","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":433.1000633239746,"y":268.200008392334,"wires":[["435b0516.a7129c","6e0b042b.2bc8ec"]]},{"id":"91dea02.7c41b6","type":"switch","z":"fd4603cb.5a873","name":"removeblanks","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"5","vt":"num","v2":"39","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":242.10000610351562,"y":217.40000808238983,"wires":[["698eefd8.05436"]]},{"id":"6e0b042b.2bc8ec","type":"link out","z":"fd4603cb.5a873","name":"Send to capture picture","links":["ec31c14b.a3f72"],"x":647.1000366210938,"y":280.8000183105469,"wires":[]},{"id":"3f00c7c4.8c5648","type":"file","z":"40cd43ca.d9a6ac","name":"Delete Local file after upload to Azure","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"delete","x":825.000072479248,"y":703.0000076293945,"wires":[["29d5343e.253fcc"]]},{"id":"4e51d4f5.cbb35c","type":"function","z":"40cd43ca.d9a6ac","name":"Create new msg object containing file name ","func":"var newMsg = { payload: "Test" };\nnewMsg.filename = flow.get("filename")\nreturn newMsg;","outputs":1,"noerr":0,"x":729.3001098632812,"y":608.4000043869019,"wires":[["3f00c7c4.8c5648"]]},{"id":"29d5343e.253fcc","type":"debug","z":"40cd43ca.d9a6ac","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"filename","x":862.1001281738281,"y":781.4000110626221,"wires":[]},{"id":"da40a856.18d9a8","type":"ui_template","z":"40cd43ca.d9a6ac","group":"78dd38b7.1d4588","name":"Show Picture on Webpage","order":2,"width":"6","height":"6","format":"<div ng-bind-html="msg.payload">\n<img src={{msg.payload}}\n width='290' \n height='220' \n id='img'\n alt='Getting Image'\n>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":1522.1251373291016,"y":810.7501211166382,"wires":[[]]},{"id":"6162c282.d4587c","type":"hostip","z":"40cd43ca.d9a6ac","name":"Host IP","x":1236.6250534057617,"y":483.2500720024109,"wires":[["7cfa0dad.096144"]]},{"id":"7cfa0dad.096144","type":"split","z":"40cd43ca.d9a6ac","name":"","splt":"\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":1239.1251525878906,"y":550.0000762939453,"wires":[["41432ded.c18a44"]]},{"id":"b47ac02e.8838","type":"change","z":"40cd43ca.d9a6ac","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.address","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1217.8750534057617,"y":672.5001282691956,"wires":[["8a289017.84de7"]]},{"id":"41432ded.c18a44","type":"switch","z":"40cd43ca.d9a6ac","name":"","property":"payload.family","propertyType":"msg","rules":[{"t":"eq","v":"IPv4","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1209.1251525878906,"y":605.0000772476196,"wires":[["b47ac02e.8838"]]},{"id":"8a289017.84de7","type":"function","z":"40cd43ca.d9a6ac","name":"Send Values to Webpage","func":"msg.payload = "http://"+msg.payload + ":1880" + "/"+ flow.get("filename")\nvar msg2 = {payload:flow.get("filename")}\nreturn [[msg],[msg2]];","outputs":2,"noerr":0,"x":1367.6250610351562,"y":719.5000705718994,"wires":[["da40a856.18d9a8"],[]],"outputLabels":["msg","msg2"]},{"id":"fb491fbd.26666","type":"function","z":"40cd43ca.d9a6ac","name":"Make File Name Unique","func":"value = flow.get("count")||1\nvalue = value +1\nif (value > 999) {\n value = 1\n}\nflow.set("count",value)\nmsg.payload = msg.payload+"~"+value\nreturn msg;","outputs":1,"noerr":0,"x":229.99998474121094,"y":239.99996852874756,"wires":[["b5a72e49.45e65"]]},{"id":"671978c2.acca08","type":"inject","z":"40cd43ca.d9a6ac","name":"Press to get Camera Options","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":179,"y":324.00000953674316,"wires":[["2029a9f1.0ee6d6"]]},{"id":"2029a9f1.0ee6d6","type":"exec","z":"40cd43ca.d9a6ac","command":"v4l2-ctl --list-formats-ext","addpay":false,"append":"","useSpawn":"false","timer":"10","oldrc":false,"name":"Get options","x":278.0000228881836,"y":406.00000262260437,"wires":[["e1cebfc.808534"],[],[]]},{"id":"e1cebfc.808534","type":"debug","z":"40cd43ca.d9a6ac","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","x":403.1000099182129,"y":482.00001525878906,"wires":[]}]

Please re-paste the code between back-ticks. As it stands, people won't be able to copy/paste it.

Please also consider putting this on the flows site. Thanks.