-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathupdate_mini.json
1 lines (1 loc) · 122 KB
/
update_mini.json
1
[{"id":"68819360.7e7a7c","type":"tab","label":"Home","disabled":false,"info":""},{"id":"9dc0cf34.3aae4","type":"tab","label":"SCAN","disabled":false,"info":""},{"id":"67f0d11b.66aa4","type":"tab","label":"Settings","disabled":false,"info":""},{"id":"c23f7f4e.33171","type":"tab","label":"Files","disabled":false,"info":""},{"id":"4aee81d.130dd8","type":"tab","label":"Update","disabled":false,"info":""},{"id":"e4b4ade8.5763e","type":"subflow","name":"List Files","info":"","in":[{"x":180,"y":80,"wires":[{"id":"5024ed86.4c84c4"}]}],"out":[{"x":680,"y":60,"wires":[{"id":"d0eb6be8.eda228","port":0}]}]},{"id":"449b7301.e9f22c","type":"subflow","name":"FIle Upload (3)","info":"","category":"","in":[],"out":[],"env":[],"color":"#DDAA99"},{"id":"742aa8b9.f0ccc8","type":"subflow","name":"FIle Upload (3) (2)","info":"","category":"","in":[],"out":[],"env":[],"color":"#DDAA99"},{"id":"f15aaf51.f4429","type":"ui_base","theme":{"name":"theme-dark","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":true,"reset":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","reset":false},"themeState":{"base-color":{"default":"#097479","value":"#097479","edited":false},"page-titlebar-backgroundColor":{"value":"#097479","edited":false},"page-backgroundColor":{"value":"#111111","edited":false},"page-sidebar-backgroundColor":{"value":"#000000","edited":false},"group-textColor":{"value":"#0eb8c0","edited":false},"group-borderColor":{"value":"#555555","edited":false},"group-backgroundColor":{"value":"#333333","edited":false},"widget-textColor":{"value":"#eeeeee","edited":false},"widget-backgroundColor":{"value":"#097479","edited":false},"widget-borderColor":{"value":"#333333","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"OpenScan Pi","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":46,"sy":46,"gx":10,"gy":10,"cx":6,"cy":6,"px":6,"py":6}}},{"id":"c19e2c9e.f4b99","type":"ui_spacer","name":"spacer","group":"","order":8,"width":8,"height":1},{"id":"75afd9cb.6a3ed8","type":"ui_spacer","name":"spacer","group":"","order":2,"width":1,"height":1},{"id":"e49ddca1.744a","type":"ui_spacer","name":"spacer","group":"","order":4,"width":1,"height":1},{"id":"987b4012.f9a07","type":"ui_spacer","name":"spacer","group":"","order":5,"width":6,"height":1},{"id":"caea0d6c.4e75","type":"ui_spacer","name":"spacer","group":"","order":6,"width":1,"height":1},{"id":"3fadc6db.3997ea","type":"ui_spacer","name":"spacer","group":"","order":8,"width":1,"height":1},{"id":"f5864201.8e5ff","type":"ui_spacer","name":"spacer","group":"","order":9,"width":1,"height":1},{"id":"9c6a04ac.e760a8","type":"ui_spacer","name":"spacer","group":"","order":11,"width":1,"height":1},{"id":"bb5bfba5.b3b7b8","type":"ui_spacer","name":"spacer","group":"","order":11,"width":8,"height":1},{"id":"ddd1a14a.d7351","type":"ui_group","z":"","name":"Settings","tab":"","order":1,"disp":true,"width":"6","collapse":false},{"id":"79b73861.bb6048","type":"ui_spacer","name":"spacer","group":"","order":11,"width":8,"height":1},{"id":"a2b83ddb.6a2ee","type":"ui_group","z":"","name":"Camera Settings","tab":"","order":3,"disp":true,"width":"6","collapse":false},{"id":"1ecaa9e9.4192e6","type":"ui_spacer","name":"spacer","group":"","order":3,"width":1,"height":1},{"id":"e58f9de6.10904","type":"ui_spacer","name":"spacer","group":"","order":3,"width":1,"height":1},{"id":"924edf62.f208d","type":"ui_spacer","name":"spacer","group":"","order":3,"width":1,"height":1},{"id":"1303ee2a.fd44f2","type":"ui_spacer","name":"spacer","group":"","order":3,"width":1,"height":1},{"id":"5d12f9cd.9c4a88","type":"ui_spacer","name":"spacer","group":"a2b83ddb.6a2ee","order":5,"width":6,"height":1},{"id":"35a0e31e.2cf06c","type":"ui_group","z":"","name":"Advanced Pin & Motor Settings","tab":"","order":2,"disp":true,"width":9,"collapse":true},{"id":"6bdd5033.f67e","type":"ui_group","z":"","name":"Node Red Update","tab":"","order":1,"disp":true,"width":"6","collapse":false},{"id":"88a2f658.ac2378","type":"ui_spacer","name":"spacer","group":"6bdd5033.f67e","order":3,"width":6,"height":1},{"id":"d25e08b4.5b27e8","type":"ui_tab","z":"","name":"Update & Info","icon":"dashboard","order":5,"disabled":false,"hidden":false},{"id":"ddbd496e.93a288","type":"ui_group","z":"","name":"Manage Updates","tab":"d25e08b4.5b27e8","order":1,"disp":true,"width":"6","collapse":false},{"id":"3ce32450.e0cffc","type":"ui_group","z":"","name":"Changelog","tab":"d25e08b4.5b27e8","order":2,"disp":true,"width":16,"collapse":false},{"id":"191e6406.b089ec","type":"ui_group","z":"","name":"Info","tab":"d25e08b4.5b27e8","order":3,"disp":true,"width":"6","collapse":false},{"id":"6c07aa26.f11494","type":"ui_group","z":"","name":"Preview","tab":"","order":2,"disp":true,"width":11,"collapse":false},{"id":"8a897c8e.d858c","type":"ui_group","z":"","name":"Run","tab":"","order":3,"disp":true,"width":"6","collapse":false},{"id":"436c5312.8bd37c","type":"ui_spacer","name":"spacer","group":"6c07aa26.f11494","order":2,"width":3,"height":1},{"id":"76c2902a.e0813","type":"ui_spacer","name":"spacer","group":"6c07aa26.f11494","order":4,"width":3,"height":1},{"id":"e3c989ac.ead728","type":"ui_spacer","name":"spacer","group":"8a897c8e.d858c","order":4,"width":6,"height":1},{"id":"3aee2d1a.bc7412","type":"ui_group","z":"","name":"Main","tab":"","order":1,"disp":false,"width":"6","collapse":false},{"id":"b0cc7e63.5b5b3","type":"ui_group","z":"","name":"Preview RPi","tab":"","order":6,"disp":false,"width":15,"collapse":false},{"id":"b9e9bd43.5257f","type":"ui_spacer","name":"spacer","group":"d77de880.1a5308","order":3,"width":1,"height":1},{"id":"2da4bd3.c2b1042","type":"ui_spacer","name":"spacer","group":"ddd1a14a.d7351","order":4,"width":6,"height":1},{"id":"9f0a90cb.629f4","type":"ui_spacer","name":"spacer","group":"ddd1a14a.d7351","order":7,"width":6,"height":1},{"id":"120b6320.a5e22d","type":"ui_spacer","name":"spacer","group":"35a0e31e.2cf06c","order":9,"width":9,"height":1},{"id":"1b856f2d.ee2f81","type":"ui_spacer","name":"spacer","group":"35a0e31e.2cf06c","order":20,"width":9,"height":1},{"id":"fb2c4085.a4745","type":"ui_spacer","name":"spacer","group":"3aee2d1a.bc7412","order":2,"width":6,"height":1},{"id":"45252825.fee608","type":"ui_spacer","name":"spacer","group":"3aee2d1a.bc7412","order":9,"width":6,"height":1},{"id":"ad9b6a27.771fb8","type":"ui_spacer","name":"spacer","group":"3aee2d1a.bc7412","order":12,"width":6,"height":1},{"id":"b69edebc.8b32b","type":"ui_spacer","name":"spacer","group":"3aee2d1a.bc7412","order":19,"width":6,"height":1},{"id":"453edabd.318834","type":"ui_spacer","name":"spacer","group":"","order":3,"width":6,"height":1},{"id":"31161d86.3baa62","type":"ui_spacer","name":"spacer","group":"","order":8,"width":6,"height":1},{"id":"feedb515.8ba2a8","type":"ui_spacer","name":"spacer","group":"","order":2,"width":6,"height":1},{"id":"58ec052e.d6a8ec","type":"ui_spacer","name":"spacer","group":"","order":7,"width":6,"height":1},{"id":"ebb9ea9b.845978","type":"ui_spacer","name":"spacer","group":"b0cc7e63.5b5b3","order":5,"width":5,"height":1},{"id":"404f41e6.f5a04","type":"ui_spacer","name":"spacer","group":"b0cc7e63.5b5b3","order":7,"width":5,"height":1},{"id":"10d8d56.f5d9f2b","type":"ui_spacer","name":"spacer","group":"","order":2,"width":1,"height":1},{"id":"c3ea9d05.8cf78","type":"ui_spacer","name":"spacer","group":"","order":4,"width":1,"height":1},{"id":"8df9a49e.afb168","type":"ui_spacer","name":"spacer","group":"","order":6,"width":1,"height":1},{"id":"faa2aaa7.b50e98","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"3be89360.d049cc","type":"ui_group","z":"","name":"Home","tab":"faa2aaa7.b50e98","order":1,"disp":false,"width":10,"collapse":false},{"id":"6b6cb101.c1d69","type":"ui_tab","z":"","name":"Scan","icon":"dashboard","order":2,"disabled":false,"hidden":false},{"id":"a6b29266.ae242","type":"ui_group","z":"","name":"Main","tab":"6b6cb101.c1d69","order":1,"disp":false,"width":6,"collapse":false},{"id":"82fa21b6.fb85e","type":"ui_tab","z":"","name":"Settings","icon":"dashboard","order":4,"disabled":false,"hidden":false},{"id":"bb1dd00e.a62b9","type":"ui_group","z":"","name":"General","tab":"82fa21b6.fb85e","order":1,"disp":true,"width":"6","collapse":false},{"id":"6a63d9e3.95e668","type":"ui_group","z":"","name":"Network","tab":"82fa21b6.fb85e","order":2,"disp":true,"width":"6","collapse":false},{"id":"61d79297.21257c","type":"ui_spacer","name":"spacer","group":"b961bcf7.823e3","order":2,"width":1,"height":1},{"id":"e6f493e3.fca36","type":"ui_spacer","name":"spacer","group":"69964d6a.08a804","order":3,"width":1,"height":1},{"id":"6c1b4ac6.22fbe4","type":"ui_group","z":"","name":"Preview","tab":"6b6cb101.c1d69","order":2,"disp":false,"width":10,"collapse":false},{"id":"b04ca899.8c11a8","type":"ui_tab","z":"","name":"Files","icon":"dashboard","order":3,"disabled":false,"hidden":false},{"id":"828432c0.98256","type":"ui_group","z":"","name":"Group 1","tab":"b04ca899.8c11a8","order":1,"disp":false,"width":"14","collapse":false},{"id":"220f75d6.08e65a","type":"ui_spacer","name":"spacer","group":"828432c0.98256","order":2,"width":4,"height":1},{"id":"a971fedc.d5701","type":"ui_spacer","name":"spacer","group":"828432c0.98256","order":4,"width":4,"height":1},{"id":"8f687dea.5dbd8","type":"ui_group","z":"","name":"CameraSettings","tab":"6b6cb101.c1d69","order":3,"disp":false,"width":"6","collapse":false},{"id":"dfb37d1c.a9524","type":"ui_spacer","name":"spacer","group":"bb1dd00e.a62b9","order":5,"width":6,"height":1},{"id":"4d25c9c3.206d28","type":"ui_spacer","name":"spacer","group":"bb1dd00e.a62b9","order":8,"width":6,"height":1},{"id":"d84aee95.dfdb3","type":"ui_spacer","name":"spacer","group":"6a63d9e3.95e668","order":4,"width":6,"height":1},{"id":"a7f797e4.5f7b38","type":"ui_spacer","name":"spacer","group":"a6b29266.ae242","order":2,"width":6,"height":1},{"id":"603823f.40db8dc","type":"ui_spacer","name":"spacer","group":"a6b29266.ae242","order":11,"width":6,"height":1},{"id":"5f012bfe.8bdc84","type":"ui_spacer","name":"spacer","group":"a6b29266.ae242","order":14,"width":1,"height":1},{"id":"43033434.c05f8c","type":"ui_spacer","name":"spacer","group":"a6b29266.ae242","order":16,"width":1,"height":1},{"id":"69f35eec.78ab","type":"ui_spacer","name":"spacer","group":"a6b29266.ae242","order":17,"width":6,"height":1},{"id":"87b6c55b.05bef8","type":"ui_spacer","name":"spacer","group":"a6b29266.ae242","order":18,"width":1,"height":1},{"id":"46212d51.836294","type":"ui_spacer","name":"spacer","group":"a6b29266.ae242","order":21,"width":1,"height":1},{"id":"ff4ce27d.b7887","type":"ui_spacer","name":"spacer","group":"8f687dea.5dbd8","order":4,"width":6,"height":1},{"id":"67b24dbe.5809e4","type":"ui_spacer","name":"spacer","group":"8f687dea.5dbd8","order":5,"width":1,"height":1},{"id":"18d83701.34d109","type":"ui_spacer","name":"spacer","group":"8f687dea.5dbd8","order":7,"width":1,"height":1},{"id":"b4fcae9.3fcff5","type":"ui_spacer","name":"spacer","group":"8f687dea.5dbd8","order":8,"width":1,"height":1},{"id":"28545e78.5f0042","type":"ui_spacer","name":"spacer","group":"8f687dea.5dbd8","order":10,"width":1,"height":1},{"id":"9316ed60.87ba","type":"ui_spacer","name":"spacer","group":"8f687dea.5dbd8","order":11,"width":1,"height":1},{"id":"76ee959b.e2077c","type":"ui_spacer","name":"spacer","group":"8f687dea.5dbd8","order":13,"width":1,"height":1},{"id":"56194d68.6c75a4","type":"ui_spacer","name":"spacer","group":"8f687dea.5dbd8","order":14,"width":1,"height":1},{"id":"dadf79f4.768348","type":"ui_spacer","name":"spacer","group":"8f687dea.5dbd8","order":16,"width":1,"height":1},{"id":"b1d1ec2b.66f8d","type":"ui_spacer","name":"spacer","group":"ddbd496e.93a288","order":4,"width":6,"height":1},{"id":"6bccf6c3.88dec8","type":"ui_spacer","name":"spacer","group":"ddbd496e.93a288","order":7,"width":6,"height":1},{"id":"341b458a.9d94ba","type":"ui_spacer","name":"spacer","group":"191e6406.b089ec","order":2,"width":6,"height":1},{"id":"32757f72.bb3a7","type":"ui_spacer","name":"spacer","group":"191e6406.b089ec","order":3,"width":6,"height":1},{"id":"503058e6.382dd8","type":"ui_group","z":"","name":"Start","tab":"c4d57e31.553ef","order":1,"disp":false,"width":10,"collapse":false},{"id":"c4d57e31.553ef","type":"ui_tab","z":"","name":"Start","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"5aba434e.1a84bc","type":"ui_spacer","name":"spacer","group":"3be89360.d049cc","order":4,"width":10,"height":1},{"id":"3d37c809.75f688","type":"ui_spacer","name":"spacer","group":"3be89360.d049cc","order":5,"width":2,"height":1},{"id":"7c872a36.989e44","type":"ui_spacer","name":"spacer","group":"3be89360.d049cc","order":8,"width":2,"height":1},{"id":"69865c51.03b6f4","type":"ui_spacer","name":"spacer","group":"3be89360.d049cc","order":9,"width":2,"height":1},{"id":"334ec44d.6c229c","type":"ui_spacer","name":"spacer","group":"3be89360.d049cc","order":10,"width":2,"height":1},{"id":"278d96fb.62b97a","type":"ui_spacer","name":"spacer","group":"3be89360.d049cc","order":11,"width":2,"height":1},{"id":"406586aa.0d5758","type":"ui_spacer","name":"spacer","group":"3be89360.d049cc","order":14,"width":2,"height":1},{"id":"d3800368.fcc1b","type":"ui_spacer","name":"spacer","group":"3be89360.d049cc","order":15,"width":2,"height":1},{"id":"1deb325.751f8ce","type":"ui_spacer","name":"spacer","group":"3be89360.d049cc","order":16,"width":2,"height":1},{"id":"d80a0814.d198d8","type":"ui_spacer","name":"spacer","group":"3be89360.d049cc","order":17,"width":2,"height":1},{"id":"127cc398.3dac2c","type":"ui_spacer","name":"spacer","group":"3be89360.d049cc","order":19,"width":2,"height":1},{"id":"5024ed86.4c84c4","type":"exec","z":"e4b4ade8.5763e","command":"ls","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":310,"y":80,"wires":[["d0eb6be8.eda228"],[],[]]},{"id":"d0eb6be8.eda228","type":"change","z":"e4b4ade8.5763e","name":"split","rules":[{"t":"set","p":"payload","pt":"msg","to":"$split(payload, '\\n')[$ != \"\"]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":60,"wires":[[]]},{"id":"a3a12a62.452ab8","type":"ui_text","z":"4aee81d.130dd8","group":"ddbd496e.93a288","order":2,"width":0,"height":0,"name":"update text","label":"","format":"<font color= {{msg.color}} > {{msg.payload}} </font>","layout":"row-center","x":170,"y":560,"wires":[]},{"id":"db31530a.7735b","type":"ui_button","z":"4aee81d.130dd8","name":"","group":"ddbd496e.93a288","order":3,"width":0,"height":0,"passthru":false,"label":"Check for Updates","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":170,"y":180,"wires":[["7600f12d.cf32e","501a81c3.027e5"]]},{"id":"51433c54.55af44","type":"link in","z":"4aee81d.130dd8","name":"update","links":["c803000f.cec2e","babe2a6.c6c27d8","29352168.95ba2e","d33997e3.7b5128","1a32f672.50fafa","629556b9.c99758","e4b7a78b.af9278","b039b421.71ff38","d08d2313.3d81c","eb1b989b.411858","bac9b0cb.79a11","bb2e44d.554e4b8","130354ce.aee30b","946280a5.09db7","4c3f489f.1d5368","611f2d91.2c4414","62f44ebe.150c7"],"x":35,"y":560,"wires":[["a3a12a62.452ab8","5a50b653.49be68"]]},{"id":"29e275a2.469eea","type":"ui_template","z":"4aee81d.130dd8","group":"191e6406.b089ec","name":"Open Manual (EN)","order":1,"width":6,"height":1,"format":"<md-button style=\"width:100%; height:100%;\" target=\"_blank\" ng-href=\"/ui/data/Manual_en.pdf\">\n <div class=\"center\" style=\"position: relative;\n top: 30%;\">\n User Manual (EN)\n</div></md-button>\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":110,"y":1020,"wires":[[]]},{"id":"ebf60ed3.4c254","type":"python3-function","z":"4aee81d.130dd8","name":"Compare Versions","func":"import os\n\n\nfile = '/home/pi/shared2/ui/data/update.log'\nurl = 'https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/update_mini.log'\ntry:\n os.remove(file)\nexcept OSError:\n pass\nos.system('wget -O'+file+' '+url+' >/dev/null 2>&1')\n\n\nwith open(\"/home/pi/shared2/ui/data/update.log\", \"r\") as file:\n versionserver=str(file.read())[:16]\nwith open(\"/home/pi/shared2/log/currentversion.log\", \"r\") as file:\n versionpi=str(file.read())[:16]\n\nmsg['payload']=\"you are up to date\"\n\nif versionpi!=versionserver:\n file=\"/home/pi/.node-red/flows_raspberrypi_download.json\"\n url=\"https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/update_mini.json\"\n try:\n os.remove(file)\n except OSError:\n pass\n os.system('wget -O'+file+' '+url+' >/dev/null 2>&1')\n\n with open(\"/home/pi/shared2/log/currentserverversion.log\", \"w\") as file:\n file.write(versionserver)\n os.rename(\"/home/pi/.node-red/flows_raspberrypi_download.json\",\"/home/pi/shared2/ui/data/old_flows/\"+versionserver+\".json\")\n msg['payload']=\"new updates available\"\n\nreturn msg","outputs":1,"x":690,"y":180,"wires":[["d08d2313.3d81c","ccefcc90.280d9","da63f320.75bcc"]]},{"id":"a068495.e7347b8","type":"python3-function","z":"4aee81d.130dd8","name":"autoupdate checker","func":"\nwith open(\"/home/pi/shared2/log/autoupdatestate.log\", \"r\") as file:\n autoupdate=file.read()\nmsg['payload']=False\nif autoupdate==\"true\":\n msg['payload']=True\nreturn msg","outputs":1,"x":310,"y":40,"wires":[["4757554e.08088c"]]},{"id":"4757554e.08088c","type":"ui_switch","z":"4aee81d.130dd8","name":"","label":"Auto-check for updates","tooltip":"Enable the auto-update check after starting the device. (Internet connection required)","group":"ddbd496e.93a288","order":1,"width":6,"height":1,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":530,"y":40,"wires":[["8266379e.ed1bb8"]]},{"id":"8266379e.ed1bb8","type":"file","z":"4aee81d.130dd8","name":"","filename":"/home/pi/shared2/log/autoupdatestate.log","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"none","x":820,"y":40,"wires":[[]]},{"id":"69253358.bf412c","type":"inject","z":"4aee81d.130dd8","name":"","topic":"","payload":"Started!","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"60","x":100,"y":40,"wires":[["a068495.e7347b8","302f3bb7.a86654","954bf550.aa5088"]]},{"id":"302f3bb7.a86654","type":"python3-function","z":"4aee81d.130dd8","name":"update check on?","func":"\nwith open(\"/home/pi/shared2/log/autoupdatestate.log\", \"r\") as file:\n autoupdate=file.read()\nif autoupdate==\"true\":\n msg['payload']=\"on\"\n return msg\n","outputs":1,"x":310,"y":80,"wires":[["501a81c3.027e5"]]},{"id":"d08d2313.3d81c","type":"link out","z":"4aee81d.130dd8","name":"","links":["51433c54.55af44"],"x":935,"y":140,"wires":[]},{"id":"7600f12d.cf32e","type":"function","z":"4aee81d.130dd8","name":"msg","func":"msg.payload =\"checking for updates\"\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":220,"wires":[["eb1b989b.411858"]]},{"id":"eb1b989b.411858","type":"link out","z":"4aee81d.130dd8","name":"","links":["51433c54.55af44"],"x":475,"y":220,"wires":[]},{"id":"ba6a944f.28fbf8","type":"ui_text","z":"4aee81d.130dd8","group":"3ce32450.e0cffc","order":1,"width":0,"height":0,"name":"Your version:","label":"Your version:","format":"{{msg.payload}}","layout":"row-spread","x":330,"y":300,"wires":[]},{"id":"147a8c8b.02d703","type":"ui_text","z":"4aee81d.130dd8","group":"3ce32450.e0cffc","order":2,"width":0,"height":0,"name":"","label":"Most recent version:","format":"{{msg.payload}}","layout":"row-spread","x":360,"y":340,"wires":[]},{"id":"78fe77ae.637248","type":"python3-function","z":"4aee81d.130dd8","name":"msg","func":"\nwith open(\"/home/pi/shared2/log/currentversion.log\", \"r\") as file:\n msg['payload']=file.read()\nreturn msg","outputs":1,"x":190,"y":300,"wires":[["ba6a944f.28fbf8"]]},{"id":"8f30cdc7.d8d0a","type":"python3-function","z":"4aee81d.130dd8","name":"msg","func":"\nwith open(\"/home/pi/shared2/log/currentserverversion.log\", \"r\") as file:\n msg['payload']=file.read()\nreturn msg","outputs":1,"x":190,"y":340,"wires":[["147a8c8b.02d703"]]},{"id":"53d30b48.e7c2b4","type":"function","z":"4aee81d.130dd8","name":"msg","func":"msg.payload =\"installing new version\"\nreturn msg\n\n","outputs":1,"noerr":0,"x":910,"y":580,"wires":[["bb2e44d.554e4b8"]]},{"id":"7e517945.e751d8","type":"exec","z":"4aee81d.130dd8","command":"","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"install update","x":910,"y":480,"wires":[["c7dea90b.5b6478"],[],[]]},{"id":"bb2e44d.554e4b8","type":"link out","z":"4aee81d.130dd8","name":"","links":["51433c54.55af44"],"x":1055,"y":580,"wires":[]},{"id":"130354ce.aee30b","type":"link out","z":"4aee81d.130dd8","name":"","links":["51433c54.55af44"],"x":1055,"y":500,"wires":[]},{"id":"59489284.99141c","type":"python3-function","z":"4aee81d.130dd8","name":"msg","func":"from time import sleep\nwith open(\"/home/pi/shared2/log/currentversion.log\", \"w\") as file:\n file.write(msg['payload2'])\n\nsleep(2)\nmsg['payload']=\"rebooting...\"\nreturn msg","outputs":1,"x":910,"y":540,"wires":[["130354ce.aee30b","fdbb71b7.ca9b4","a5ed604d.e6933"]]},{"id":"da63f320.75bcc","type":"link out","z":"4aee81d.130dd8","name":"","links":["fdb965c8.f9e728","e5e35ad0.2dbfd8","e0e065cb.b8d888","e6ce1ce5.31d35","88b5807b.a0959","8745d44c.1a61c8"],"x":935,"y":220,"wires":[]},{"id":"a5ed604d.e6933","type":"link out","z":"4aee81d.130dd8","name":"","links":["772edab5.39d4f4","8277274b.2a6b68"],"x":1055,"y":540,"wires":[]},{"id":"7aae1e89.08d37","type":"function","z":"4aee81d.130dd8","name":"t/f","func":"if (msg.payload === true){\n msg.payload=true\n return [msg,null]\n}\nmsg.payload=\"no internet connection\"\nreturn [null,msg]\n","outputs":2,"noerr":0,"x":510,"y":180,"wires":[["ebf60ed3.4c254"],["eb1b989b.411858"]]},{"id":"f1bbe902.de5cd8","type":"link in","z":"4aee81d.130dd8","name":"Version","links":["ccefcc90.280d9","954bf550.aa5088","fdbb71b7.ca9b4"],"x":55,"y":300,"wires":[["78fe77ae.637248","8f30cdc7.d8d0a","f1199151.89ef6"]]},{"id":"ccefcc90.280d9","type":"link out","z":"4aee81d.130dd8","name":"","links":["f1bbe902.de5cd8","3a8b7430.734eec","d3eaeac4.a1c968"],"x":935,"y":180,"wires":[]},{"id":"954bf550.aa5088","type":"link out","z":"4aee81d.130dd8","name":"","links":["f1bbe902.de5cd8","3a8b7430.734eec","d3eaeac4.a1c968"],"x":175,"y":80,"wires":[]},{"id":"f1199151.89ef6","type":"python3-function","z":"4aee81d.130dd8","name":"display changelog","func":"with open(\"/home/pi/shared2/ui/data/update.log\", \"r\") as file:\n text=file.read()\nmsg['payload']=text\nreturn msg","outputs":1,"x":230,"y":380,"wires":[["e084eb09.ccf548"]]},{"id":"e084eb09.ccf548","type":"ui_template","z":"4aee81d.130dd8","group":"3ce32450.e0cffc","name":"changelog","order":3,"width":16,"height":7,"format":"<style>\n #mylog {\n min-height: 100px;\n padding: 0;\n white-space: pre;\n }\n</style>\n\n<div id=\"mylog\" ng-bind=\"msg.payload\">\n <!-- file contents will go here -->\n</div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":410,"y":380,"wires":[[]]},{"id":"8dd53d39.02c9e","type":"inject","z":"4aee81d.130dd8","name":"","topic":"Repeater","payload":"0.1","payloadType":"str","repeat":"5","crontab":"","once":true,"onceDelay":"0.1","x":120,"y":460,"wires":[["f1375b38.dc3fa8"]]},{"id":"f1375b38.dc3fa8","type":"function","z":"4aee81d.130dd8","name":"","func":"msg.path = \"shared2/ui/data/old_flows\"\n\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":460,"wires":[["44261472.44725c"]]},{"id":"44261472.44725c","type":"fs-ops-dir","z":"4aee81d.130dd8","name":"/media/pi/","path":"path","pathType":"msg","filter":"*","filterType":"str","dir":"files","dirType":"msg","x":420,"y":460,"wires":[["ddda14d1.b827e8"]]},{"id":"ddda14d1.b827e8","type":"ui_template","z":"4aee81d.130dd8","group":"ddbd496e.93a288","name":"File List + Install Version","order":6,"width":6,"height":6,"format":"<script>\n \nthis.scope.action = function(opt) {\n var playFile = opt || \"no data passed to function\";\n// console.warn(playFile)\n return playFile; } \n</script>\n\n\n<div style=\"max-width:500px;\">\n <ul>\n <li ng-repeat=\"file in msg.files track by $index\" style=\"list-style-type: none;\">\n <label>\n <input type=\"radio\" ng-model=\"$parent.file\" name=\"data\" value=\"{{file}}\" required />{{file}}\n </label>\n </li>\n </ul>\n\n<md-button style=\"width:100%; height:37px;color:red;background-color:lightblue;\" ng-click=\"send({file})\">\n <div class=\"center\" style=\"position: relative;\n top: 30%;\">\n install version\n</div></md-button>\n\n</div>\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":410,"y":500,"wires":[["44261472.44725c","7d89da4a.3689b4"]]},{"id":"c8844641.814568","type":"python3-function","z":"4aee81d.130dd8","name":"init exec","func":"if msg['payload']!=\"Yes\":\n return\npayload=msg['file']\n\nif payload==\"saved.json\":\n msg['payload']=\"sudo \\cp /home/pi/shared2/ui/data/old_flows/\"+payload+\" /home/pi/.node-red/flows_raspberrypi_mini.json\"\nelse:\n msg['payload']=\"sudo \\cp /home/pi/.node-red/flows_raspberrypi_mini.json /home/pi/shared2/ui/data/old_flows/saved.json && sudo \\cp /home/pi/shared2/ui/data/old_flows/\"+payload+\" /home/pi/.node-red/flows_raspberrypi_mini.json\"\n\nmsg['payload2']=payload[:16]\nreturn msg\n\n","outputs":1,"x":780,"y":540,"wires":[["7e517945.e751d8","59489284.99141c","53d30b48.e7c2b4"]]},{"id":"fdbb71b7.ca9b4","type":"link out","z":"4aee81d.130dd8","name":"","links":["f1bbe902.de5cd8","3a8b7430.734eec","d3eaeac4.a1c968"],"x":1055,"y":460,"wires":[]},{"id":"501a81c3.027e5","type":"is online","z":"4aee81d.130dd8","name":"","url":"www.google.com","action":"0","x":360,"y":180,"wires":[["7aae1e89.08d37","3bc9635e.c9683c"]]},{"id":"b9a7fb02.25c808","type":"ui_template","z":"4aee81d.130dd8","group":"191e6406.b089ec","name":"Syslog","order":5,"width":0,"height":0,"format":"<md-button ng-disabled=\"msg.disable\" style=\"background-color:{{msg.backgroundcolor}};color:{{msg.color}};width:100%; height:100%;\" target=\"_blank\" ng-href=\"/ui/data/syslog.txt\">\n <div class=\"center\" style=\"position: relative;\n top: 30%;\">\n Download Syslog\n</div></md-button>\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":690,"y":900,"wires":[[]]},{"id":"19c289e1.e54d16","type":"ui_switch","z":"4aee81d.130dd8","name":"","label":"Open Syslog","tooltip":"","group":"191e6406.b089ec","order":4,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":230,"y":900,"wires":[["4d9394a.735df6c"]]},{"id":"4d9394a.735df6c","type":"function","z":"4aee81d.130dd8","name":"","func":"var msg2 = { payload: \"sudo \\cp /var/log/syslog /home/pi/shared2/ui/data/syslog.txt && sudo chmod a+rwx /home/pi/shared2/ui/data/syslog.txt\"};\nif (msg.payload===true){\n msg.color = \"white\"\n msg.backgroundcolor=\"default\"\n msg.disable=false\n return [msg,msg2];\n}\nmsg.color = \"transparent\"\nmsg.backgroundcolor =\"transparent\"\nmsg.disable=true\nreturn [msg,null];","outputs":2,"noerr":0,"x":370,"y":900,"wires":[["bd3f9d51.4a861"],["11654c19.ec7f24"]]},{"id":"11654c19.ec7f24","type":"exec","z":"4aee81d.130dd8","command":"","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"get syslog","x":500,"y":960,"wires":[[],[],["d1c636fb.679d28"]]},{"id":"bd3f9d51.4a861","type":"delay","z":"4aee81d.130dd8","name":"","pauseType":"delay","timeout":"0.5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":530,"y":900,"wires":[["b9a7fb02.25c808"]]},{"id":"d1c636fb.679d28","type":"python3-function","z":"4aee81d.130dd8","name":"msg","func":"\nwith open(\"/home/pi/shared2/log/currentversion.log\", \"r\") as file:\n msg['payload']=\">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Version in use: \"+file.read()\nreturn msg","outputs":1,"x":630,"y":960,"wires":[["172470f8.a4b5af"]]},{"id":"172470f8.a4b5af","type":"file","z":"4aee81d.130dd8","name":"","filename":"/home/pi/shared2/ui/data/syslog.txt","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":840,"y":960,"wires":[[]]},{"id":"873c1379.6273d","type":"inject","z":"4aee81d.130dd8","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":true,"onceDelay":"","x":90,"y":900,"wires":[["19c289e1.e54d16"]]},{"id":"424a81dd.252ca","type":"ui_button","z":"4aee81d.130dd8","name":"","group":"ddbd496e.93a288","order":5,"width":0,"height":0,"passthru":false,"label":"Save current Version","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":120,"y":680,"wires":[["ed696308.dfe92"]]},{"id":"ed696308.dfe92","type":"python3-function","z":"4aee81d.130dd8","name":"save","func":"import time\nimport shutil\ntimestamp =time.strftime(\"20%y-%m-%d_%H.%M.\")\nsource = \"/home/pi/.node-red/flows_raspberrypi_mini.json\"\ndestination = \"/home/pi/shared2/ui/data/old_flows/saved-\"+timestamp+\"json\"\ndest = shutil.copyfile(source, destination) \n","outputs":1,"x":310,"y":680,"wires":[[]]},{"id":"3bc9635e.c9683c","type":"python3-function","z":"4aee81d.130dd8","name":"manual en","func":"import os.path\nimport os\n\nif msg['payload']!=True:\n return\n\nfile = '/home/pi/shared2/log/manual_en_new.log'\nurl = ' https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/Manual_en.log'\nos.system('wget -q -O'+file+url)\n\nwith open(\"/home/pi/shared2/log/manual_en_new.log\", \"r\") as file:\n newversion=file.read()\nwith open(\"/home/pi/shared2/log/manual_en.log\", \"r\") as file:\n oldversion=file.read()\n\nif oldversion==newversion:\n return\n \nfile = '/home/pi/shared2/ui/data/Manual_en.pdf'\nurl = ' /~https://github.com/OpenScanEu/OpenScan/raw/master/Manual_en.pdf'\ntry:\n os.remove(file)\nexcept OSError:\n pass\nos.system('wget -q -O'+file+url)\nstatinfo=os.stat(file)\nif(os.path.exists(file)==False) or statinfo.st_size==0:\n return\n\n\nwith open(\"/home/pi/shared2/log/manual_en.log\", \"w\") as file:\n file.write(newversion)\nmsg['payload']=\"New Manual downloaded (see Info-Tab)\"\nreturn msg\n\n\n\n","outputs":1,"x":530,"y":140,"wires":[["c180d6dd.40f2d8"]]},{"id":"c180d6dd.40f2d8","type":"ui_toast","z":"4aee81d.130dd8","position":"dialog","displayTime":"5","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","topic":"","name":"","x":690,"y":140,"wires":[[]]},{"id":"7d89da4a.3689b4","type":"python3-function","z":"4aee81d.130dd8","name":"Confirm","func":"msg['payload']=\"Install new Version?\"\nreturn msg\n","outputs":1,"x":620,"y":480,"wires":[["9f31e928.e6aa48"]]},{"id":"9f31e928.e6aa48","type":"ui_toast","z":"4aee81d.130dd8","position":"dialog","displayTime":"5","highlight":"","sendall":true,"outputs":1,"ok":"No","cancel":"Yes","raw":false,"topic":"","name":"","x":630,"y":540,"wires":[["c8844641.814568"]]},{"id":"5a50b653.49be68","type":"python3-function","z":"4aee81d.130dd8","name":"PopUp new Version","func":"from time import sleep\nsleep (1)\n\nif msg['payload']==\"new updates available\":\n msg['payload']=\"-- New Updates Available --- Install & reboot now?\"\n return msg","outputs":1,"x":190,"y":600,"wires":[["f8c24f06.ee9ec"]]},{"id":"f8c24f06.ee9ec","type":"ui_toast","z":"4aee81d.130dd8","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"No","cancel":"Yes","raw":false,"topic":"","name":"","x":490,"y":600,"wires":[["fc87e670.3212f8"]]},{"id":"fc87e670.3212f8","type":"python3-function","z":"4aee81d.130dd8","name":"msg","func":"import os\n\nif msg['payload']!=\"Yes\":\n return\nwith open(\"/home/pi/shared2/log/currentserverversion.log\", \"r\") as file:\n msg['file']=file.read()+\".json\"\n\nif os.stat(\"/home/pi/shared2/ui/data/old_flows/\"+msg['file']).st_size==0:\n return\n\nreturn msg","outputs":1,"x":630,"y":600,"wires":[["c8844641.814568"]]},{"id":"2fd3bdd7.2139e2","type":"ui_template","z":"68819360.7e7a7c","group":"3be89360.d049cc","name":"Background","order":1,"width":0,"height":0,"format":"<style>\n body {\n background-image: url(\"/ui/data/logosmall.jpg\");\n background-repeat: no-repeat;\n background-attachment: fixed;\n background-position: center;\n\n }\n #Home_Home {\n background-color: #cccccc00 !important;\n border-color: #cccccc00 !important;\n }\n\n \n</style>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":210,"y":180,"wires":[[]]},{"id":"8284268a.5399e8","type":"inject","z":"68819360.7e7a7c","name":"","topic":"","payload":"Started!","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"0","x":140,"y":460,"wires":[["61578186.d7bfe"]]},{"id":"964602a5.ecf32","type":"exec","z":"68819360.7e7a7c","command":"sudo chmod -R 777 /home/pi/shared2/","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"set privileges","x":710,"y":400,"wires":[[],[],[]]},{"id":"340d59b9.52d586","type":"python3-function","z":"68819360.7e7a7c","name":"download files","func":"import os.path\nimport os\nfrom time import sleep\n# Download background\n\nflag=False\n\nsleep(2)\n\ndef download(file,url):\n if(os.path.exists(file)==False or os.stat(file)==0):\n try:\n os.system('wget -O'+file+' '+url)\n flag=True\n except:\n pass\n return\n statinfo=os.stat(file)\n if(statinfo.st_size==0):\n try:\n os.system('wget -O'+file+' '+url)\n flag=True\n except:\n pass \n return\n\n\nfile = '/home/pi/shared2/ui/data/bmc-new-btn-logo.svg'\nurl = 'https://cdn.buymeacoffee.com/buttons/bmc-new-btn-logo.svg'\ndownload(file,url)\n\nfile = '/home/pi/.node-red/settings_openscan_mini.js'\nurl = 'https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/settings_mini.js'\ndownload(file,url)\n\nfile = '/home/pi/.node-red/settings_openscan.js'\nurl = 'https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/settings.js'\ndownload(file,url)\n\nfile = '/home/pi/shared2/ui/data/logosmall.jpg'\nurl = 'https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/temp/Logosmall.jpg'\ndownload(file,url)\n\nfile = '/home/pi/shared2/ui/data/Manual_en.pdf'\nurl = ' /~https://github.com/OpenScanEu/OpenScan/raw/master/Manual_en.pdf'\ndownload(file,url)\n\nif flag==True:\n os.system(\"sudo systemctl restart nodered\")\nreturn msg\n","outputs":1,"x":720,"y":460,"wires":[["b13c2178.49023"]]},{"id":"61578186.d7bfe","type":"python3-function","z":"68819360.7e7a7c","name":"create path","func":"import os.path\nimport os\nflag=False\n\ndef new_path(path):\n if(os.path.exists(path)==False):\n os.mkdir(path)\n flag=True\n else:\n pass\n\nnew_path(\"/home/pi/shared2/\")\nnew_path(\"/home/pi/shared2/ui\")\nnew_path(\"/home/pi/shared2/ui/data\")\nnew_path(\"/home/pi/shared2/ui/data/old_flows\")\nnew_path(\"/home/pi/shared2/ui/data/zip\")\nnew_path(\"/home/pi/shared2/log\")\n\n\nif flag==True:\n os.system(\"sudo systemctl restart nodered\")\nreturn msg","outputs":1,"x":290,"y":460,"wires":[["7dcc8efb.55029"]]},{"id":"4468f691.103eb8","type":"ui_button","z":"68819360.7e7a7c","name":"","group":"3be89360.d049cc","order":6,"width":3,"height":2,"passthru":false,"label":"SCAN","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"","x":190,"y":260,"wires":[["62cd5288.2805fc"]]},{"id":"6560dd25.9e76c4","type":"ui_button","z":"68819360.7e7a7c","name":"","group":"3be89360.d049cc","order":12,"width":3,"height":2,"passthru":false,"label":"Settings","tooltip":"","color":"","bgcolor":"","icon":"","payload":"3","payloadType":"num","topic":"","x":200,"y":340,"wires":[["62cd5288.2805fc"]]},{"id":"62cd5288.2805fc","type":"ui_ui_control","z":"68819360.7e7a7c","name":"","events":"all","x":440,"y":320,"wires":[[]]},{"id":"71e72293.91c6fc","type":"ui_button","z":"68819360.7e7a7c","name":"","group":"3be89360.d049cc","order":7,"width":3,"height":2,"passthru":false,"label":"Files","tooltip":"","color":"","bgcolor":"","icon":"","payload":"2","payloadType":"num","topic":"","x":190,"y":300,"wires":[["62cd5288.2805fc"]]},{"id":"e7306ef2.3b4df","type":"ui_button","z":"68819360.7e7a7c","name":"","group":"3be89360.d049cc","order":13,"width":3,"height":2,"passthru":false,"label":"Update&Info","tooltip":"","color":"","bgcolor":"","icon":"","payload":"4","payloadType":"num","topic":"","x":210,"y":380,"wires":[["62cd5288.2805fc"]]},{"id":"4bfb5998.ef1028","type":"exec","z":"67f0d11b.66aa4","command":"sudo reboot","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":530,"y":100,"wires":[[],[],[]]},{"id":"b856e02b.b64f3","type":"exec","z":"67f0d11b.66aa4","command":"sudo shutdown -h now","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":560,"y":180,"wires":[[],[],[]]},{"id":"c7945868.ab9be8","type":"ui_button","z":"67f0d11b.66aa4","name":"","group":"bb1dd00e.a62b9","order":10,"width":6,"height":1,"passthru":false,"label":"Reboot","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"","x":120,"y":120,"wires":[["3e9d2ca4.953d44","19bc6938.44e717"]]},{"id":"d3faa358.9c4ef","type":"ui_button","z":"67f0d11b.66aa4","name":"","group":"bb1dd00e.a62b9","order":9,"width":6,"height":1,"passthru":false,"label":"Shutdown","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"","x":120,"y":160,"wires":[["bc8e5552.04ba68","19bc6938.44e717"]]},{"id":"bc8e5552.04ba68","type":"delay","z":"67f0d11b.66aa4","name":"","pauseType":"delay","timeout":"1.5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":350,"y":180,"wires":[["b856e02b.b64f3"]]},{"id":"3e9d2ca4.953d44","type":"delay","z":"67f0d11b.66aa4","name":"","pauseType":"delay","timeout":"1.5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":350,"y":100,"wires":[["4bfb5998.ef1028"]]},{"id":"19bc6938.44e717","type":"python3-function","z":"67f0d11b.66aa4","name":"blink","func":"from time import sleep\nimport RPi.GPIO as GPIO\n\nsleeptime = 0.05\n\nwith open(\"/home/pi/shared2/log/pin_ringlight1.log\", \"r\") as file:\n ringlightpin1=int(file.read())\nwith open(\"/home/pi/shared2/log/pin_ringlight2.log\", \"r\") as file:\n ringlightpin2=int(file.read())\n\nGPIO.setwarnings(False)\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(ringlightpin1, GPIO.OUT)\nGPIO.setup(ringlightpin2, GPIO.OUT)\nGPIO.output(ringlightpin2, GPIO.LOW)\n\nwith open(\"/home/pi/shared2/log/ringlightstatus1.log\", \"w\") as file:\n file.write(\"off\")\nwith open(\"/home/pi/shared2/log/ringlightstatus2.log\", \"w\") as file:\n file.write(\"off\")\n\nfor x in range(10):\n GPIO.output(ringlightpin1, GPIO.HIGH)\n sleep(sleeptime)\n GPIO.output(ringlightpin1, GPIO.LOW)\n sleep(sleeptime)\nmsg['payload']=\"off\"\nreturn msg","outputs":1,"x":310,"y":140,"wires":[["e2c98417.753298"]]},{"id":"e2c98417.753298","type":"link out","z":"67f0d11b.66aa4","name":"","links":["673d8724.9543c8"],"x":395,"y":140,"wires":[]},{"id":"118a6113.30ceef","type":"link in","z":"67f0d11b.66aa4","name":"reboot","links":["c7dea90b.5b6478","2e855701.980d58","d39ec6b5.59f828","b049eb75.c59518","a9a7c713.2e51b8"],"x":215,"y":60,"wires":[["3e9d2ca4.953d44","19bc6938.44e717"]]},{"id":"b8ef7981.8e81d8","type":"link in","z":"67f0d11b.66aa4","name":"shutdown","links":["ed11f34c.e784"],"x":215,"y":220,"wires":[["bc8e5552.04ba68","19bc6938.44e717"]]},{"id":"52440334.0fa80c","type":"file","z":"67f0d11b.66aa4","name":"","filename":"/home/pi/shared2/log/ssh.log","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"none","x":720,"y":320,"wires":[[]]},{"id":"596b6655.6f8c18","type":"ui_switch","z":"67f0d11b.66aa4","name":"","label":"SSH Off/On","tooltip":"Start/Stop SSH Service, which allows remote access to the device","group":"bb1dd00e.a62b9","order":3,"width":6,"height":1,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":470,"y":320,"wires":[["52440334.0fa80c","f493cf3d.8cb4a"]]},{"id":"33383870.fb78e8","type":"exec","z":"67f0d11b.66aa4","command":"sudo /etc/init.d/ssh stop ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":990,"y":400,"wires":[[],[],[]]},{"id":"f493cf3d.8cb4a","type":"function","z":"67f0d11b.66aa4","name":"exec","func":"if (msg.payload === true){\n return [msg,null]\n}\nif (msg.payload ===false){\n return [null,msg]\n}","outputs":2,"noerr":0,"x":650,"y":360,"wires":[["9bc0f8b9.3b1738"],["33383870.fb78e8"]]},{"id":"9bc0f8b9.3b1738","type":"exec","z":"67f0d11b.66aa4","command":"sudo /etc/init.d/ssh start","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":990,"y":340,"wires":[[],[],[]]},{"id":"b5fd55b5.a6ae18","type":"inject","z":"67f0d11b.66aa4","name":"","topic":"","payload":"Started!","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":120,"y":320,"wires":[["e1c7c026.bf90c","35f7bc9e.5f2d74","30eb4a0d.032de6","88a22dc7.342eb","468cbf31.112a2"]]},{"id":"7e0d26a0.e32c08","type":"file","z":"67f0d11b.66aa4","name":"","filename":"/home/pi/shared2/log/samba.log","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"none","x":730,"y":460,"wires":[[]]},{"id":"1e8187ab.c4a128","type":"ui_switch","z":"67f0d11b.66aa4","name":"","label":"Samba Off/On","tooltip":"Start/Stop Samba Filesharing Server to remotely access the Pi's filesystem","group":"bb1dd00e.a62b9","order":2,"width":6,"height":1,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":480,"y":460,"wires":[["7e0d26a0.e32c08","686dc68e.f6e288"]]},{"id":"31c3fea3.6d1bd2","type":"exec","z":"67f0d11b.66aa4","command":"sudo /etc/init.d/smbd stop","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":990,"y":540,"wires":[[],[],[]]},{"id":"686dc68e.f6e288","type":"function","z":"67f0d11b.66aa4","name":"exec","func":"if (msg.payload === true){\n return [msg,null]\n}\nreturn [null,msg]\n","outputs":2,"noerr":0,"x":650,"y":500,"wires":[["9afad387.0e93f"],["31c3fea3.6d1bd2"]]},{"id":"9afad387.0e93f","type":"exec","z":"67f0d11b.66aa4","command":"sudo /etc/init.d/smbd start","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":990,"y":480,"wires":[[],[],[]]},{"id":"e1c7c026.bf90c","type":"python3-function","z":"67f0d11b.66aa4","name":"check ssh","func":"\nwith open(\"/home/pi/shared2/log/ssh.log\", \"r\") as file:\n state=file.read()\nmsg['payload']=False\nif state==\"true\":\n msg['payload']=True\nreturn msg","outputs":1,"x":300,"y":320,"wires":[["596b6655.6f8c18"]]},{"id":"35f7bc9e.5f2d74","type":"python3-function","z":"67f0d11b.66aa4","name":"check samba","func":"\nwith open(\"/home/pi/shared2/log/samba.log\", \"r\") as file:\n state=file.read()\nmsg['payload']=False\nif state==\"true\":\n msg['payload']=True\nreturn msg","outputs":1,"x":310,"y":460,"wires":[["1e8187ab.c4a128"]]},{"id":"2ca648be.6ecc18","type":"ui_dropdown","z":"67f0d11b.66aa4","name":"Pi Camera","label":"Pi Camera","tooltip":"","place":"Select option","group":"bb1dd00e.a62b9","order":4,"width":0,"height":0,"passthru":false,"options":[{"label":"v1 (5mpx)","value":"v1","type":"str"},{"label":"v2 (8mpx)","value":"v2","type":"str"},{"label":"HQ (12.3mpx)","value":"HQ","type":"str"}],"payload":"","topic":"","x":470,"y":560,"wires":[["a4e86041.3c58f"]]},{"id":"7dcc8efb.55029","type":"python3-function","z":"68819360.7e7a7c","name":"create new files + content","func":"import os.path\nfrom time import sleep\nimport os\n\nflag=False\n\ndef new_file(filepath,content):\n if os.path.isfile(filepath):\n pass\n else:\n with open(filepath, \"w\") as file:\n file.write(content)\n flag=True\n\nnew_file('/home/pi/shared2/log/camera_resolution_x.log',\"3280\")\nnew_file('/home/pi/shared2/log/camera_resolution_y.log',\"2464\")\nnew_file('/home/pi/shared2/log/camera_type.log',\"v2\")\n\nnew_file('/home/pi/shared2/log/rotor_acc.log',\"1\")\nnew_file('/home/pi/shared2/log/rotor_accramp.log',\"200\")\nnew_file('/home/pi/shared2/log/rotor_angle.log',\"5\")\nnew_file('/home/pi/shared2/log/rotor_delay.log',\"0.0005\")\nnew_file('/home/pi/shared2/log/rotor_stepsperrotation.log',\"17067\")\nnew_file('/home/pi/shared2/log/pin_rotor_dir.log',\"5\")\nnew_file('/home/pi/shared2/log/pin_rotor_step.log',\"6\")\n\nnew_file('/home/pi/shared2/log/turntable_acc.log',\"1\")\nnew_file('/home/pi/shared2/log/turntable_accramp.log',\"200\")\nnew_file('/home/pi/shared2/log/turntable_angle.log',\"10\")\nnew_file('/home/pi/shared2/log/turntable_delay.log',\"0.0005\")\nnew_file('/home/pi/shared2/log/turntable_stepsperrotation.log',\"3200\")\nnew_file('/home/pi/shared2/log/pin_turntable_dir.log',\"9\")\nnew_file('/home/pi/shared2/log/pin_turntable_step.log',\"11\")\n\nnew_file('/home/pi/shared2/log/ringlightstatus1.log',\"10\")\nnew_file('/home/pi/shared2/log/ringlightstatus2.log',\"10\")\nnew_file('/home/pi/shared2/log/pin_ringlight1.log',\"17\")\nnew_file('/home/pi/shared2/log/pin_ringlight2.log',\"27\")\n\nnew_file('/home/pi/shared2/log/ssh.log',\"true\")\nnew_file('/home/pi/shared2/log/samba.log',\"true\")\nnew_file('/home/pi/shared2/log/currentstatus_rpi.log',\"--READY--\")\nnew_file('/home/pi/shared2/log/cropx.log',\"0\")\nnew_file('/home/pi/shared2/log/cropy.log',\"0\")\nnew_file('/home/pi/shared2/log/shutterspeed.log',\"300\")\nnew_file('/home/pi/shared2/log/stopstate.log',\"run\")\nnew_file('/home/pi/shared2/log/updatepreview.log',\"start\")\n\nnew_file('/home/pi/shared2/log/feedback_status.log',\"\")\nnew_file('/home/pi/shared2/log/openscan_model.log',\"OpenScanMini\")\nnew_file('/home/pi/shared2/log/autoupdatestate.log',\"true\")\nnew_file('/home/pi/shared2/log/currentserverversion.log',\"1;\")\nnew_file('/home/pi/shared2/log/currentversion.log',\"1\")\nnew_file('/home/pi/shared2/ui/data/update.log',\"1\")\nnew_file('/home/pi/shared2/log/manual_en.log',\"1\")\nnew_file('/home/pi/shared2/log/manual_en_new.log',\"1\")\n#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nnew_file('/home/pi/shared2/log/feedback_terms.log',\"False\")\n\nif flag==True:\n os.system(\"sudo systemctl restart nodered\")\nreturn msg","outputs":1,"x":490,"y":460,"wires":[["964602a5.ecf32","340d59b9.52d586"]]},{"id":"30eb4a0d.032de6","type":"python3-function","z":"67f0d11b.66aa4","name":"load var","func":"with open(\"/home/pi/shared2/log/camera_type.log\", \"r\") as file:\n camera=file.read()\n\nmsg['payload']=camera\nreturn msg","outputs":1,"x":300,"y":560,"wires":[["2ca648be.6ecc18"]]},{"id":"a4e86041.3c58f","type":"python3-function","z":"67f0d11b.66aa4","name":"save var","func":"camera=msg['payload']\n\nif camera==\"HQ\":\n resx=4056\n resy=3040\nif camera==\"v1\":\n resx=2592\n resy=1944\nif camera==\"v2\":\n resx=3280\n resy=2464\n \nwith open(\"/home/pi/shared2/log/camera_resolution_x.log\", \"w\") as file:\n file.write(str(resx))\nwith open(\"/home/pi/shared2/log/camera_resolution_y.log\", \"w\") as file:\n file.write(str(resy))\n\nwith open(\"/home/pi/shared2/log/camera_type.log\", \"w\") as file:\n file.write(camera)\n","outputs":1,"x":660,"y":560,"wires":[[]]},{"id":"903d7ae1.04e6b8","type":"exec","z":"67f0d11b.66aa4","command":"sudo iwlist wlan0 scan | grep ESSID | sed 's/ESSID://g;s/\"//g;s/^ *//;s/ *$//'","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"scan","x":410,"y":1020,"wires":[["3d378aa1.ee5556"],[],[]]},{"id":"3d378aa1.ee5556","type":"function","z":"67f0d11b.66aa4","name":"parseOptions","func":"var ssids = msg.payload.split('\\n').filter(s => !!s)\n\nssids = [...new Set(ssids)];\n\nmsg.options = ssids\nmsg.payload = null\n\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":1000,"wires":[["8bcc312a.62bdd"]]},{"id":"8bcc312a.62bdd","type":"ui_dropdown","z":"67f0d11b.66aa4","name":"","label":"Wifi","tooltip":"","place":"Select a WIFI","group":"6a63d9e3.95e668","order":6,"width":0,"height":0,"passthru":false,"options":[],"payload":"","topic":"","x":730,"y":1000,"wires":[["17cbe304.02596d"]]},{"id":"1b7bd51.ec9b82b","type":"ui_button","z":"67f0d11b.66aa4","name":"","group":"6a63d9e3.95e668","order":5,"width":0,"height":0,"passthru":false,"label":"Scan","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":110,"y":1060,"wires":[["389d2a21.b2b3f6"]]},{"id":"fb8dcaaf.e5f688","type":"ui_form","z":"67f0d11b.66aa4","name":"","label":"","group":"6a63d9e3.95e668","order":7,"width":6,"height":4,"options":[{"label":"SSID","value":"ssid","type":"text","required":true,"rows":null},{"label":"Password","value":"password","type":"password","required":true,"rows":null},{"label":"Country Code (ISO/IEC)","value":"country","type":"text","required":true,"rows":null}],"formValue":{"ssid":"","password":"","country":""},"payload":"","submit":"UPDATE","cancel":"RESET","topic":"","x":110,"y":1180,"wires":[["1c6011e1.303cbe","5320ad4.6d7cb54"]]},{"id":"17cbe304.02596d","type":"function","z":"67f0d11b.66aa4","name":"","func":"\nmsg.payload = {ssid: msg.payload}\n\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":1000,"wires":[["fb8dcaaf.e5f688"]]},{"id":"1c6011e1.303cbe","type":"function","z":"67f0d11b.66aa4","name":"getPassphrase","func":"var data = msg.payload\n\nvar command = `wpa_passphrase \"${data.ssid}\" \"${data.password}\" | sed '/#psk=\".*\"/d'`\n \nmsg.payload = command\nmsg.status = \"updating Wifi settings\"\nreturn msg","outputs":1,"noerr":0,"x":260,"y":1180,"wires":[["d8d225a7.1ad2f8","3cf3f356.3b000c"]]},{"id":"d8d225a7.1ad2f8","type":"exec","z":"67f0d11b.66aa4","command":"","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":410,"y":1180,"wires":[["1597f7d6.477dc8"],[],[]]},{"id":"c08fc408.ba9478","type":"function","z":"67f0d11b.66aa4","name":"updateWpasupplicant","func":"var template = `sudo tee /etc/wpa_supplicant/wpa_supplicant.conf <<EOF\nctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev\nupdate_config=1\ncountry=${msg.country}\n\n${msg.payload}\nEOF\\n\n`\n\nmsg.payload = template\n\nreturn msg;","outputs":1,"noerr":0,"x":609,"y":1173,"wires":[["d00f3990.d59908"]]},{"id":"d00f3990.d59908","type":"exec","z":"67f0d11b.66aa4","command":"","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"updateConf","x":810,"y":1180,"wires":[["ebbe2ff6.91f6"],[],[]]},{"id":"ebbe2ff6.91f6","type":"exec","z":"67f0d11b.66aa4","command":"sudo wpa_cli -i wlan0 reconfigure","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"reconfigure","x":970,"y":1180,"wires":[["8dd4616d.3d017"],[],[]]},{"id":"8dd4616d.3d017","type":"function","z":"67f0d11b.66aa4","name":"showMessage","func":"\nmsg.payload = msg.payload.trim() === 'OK' ? \"Wifi configuration updated successfully\" : \"Error while updating wifi configuration\"\n\nreturn msg;","outputs":1,"noerr":0,"x":1140,"y":1180,"wires":[["501e226d.98a19c"]]},{"id":"501e226d.98a19c","type":"ui_toast","z":"67f0d11b.66aa4","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":1130,"y":1220,"wires":[[]]},{"id":"b18db489.54c168","type":"switch","z":"67f0d11b.66aa4","name":"ifWifi","property":"name","propertyType":"msg","rules":[{"t":"eq","v":"Wifi","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":210,"y":1020,"wires":[["903d7ae1.04e6b8","f393400.d87dcc"]]},{"id":"5320ad4.6d7cb54","type":"change","z":"67f0d11b.66aa4","name":"","rules":[{"t":"set","p":"country","pt":"global","to":"payload.country","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":1220,"wires":[[]]},{"id":"1597f7d6.477dc8","type":"change","z":"67f0d11b.66aa4","name":"","rules":[{"t":"set","p":"country","pt":"msg","to":"country","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":549,"y":1213,"wires":[["c08fc408.ba9478"]]},{"id":"f393400.d87dcc","type":"python3-function","z":"67f0d11b.66aa4","name":"check ip address","func":"import socket\nimport subprocess\n\nrouting = subprocess.check_output(\"route | grep '^default' | grep -o '[^ ]*$'\", shell=True)\nif routing==\"wlan0\\n\":\n routing=\"Wifi\"\nelif routing==\"eth0\\n\":\n routing=\"Ethernet\"\nelif routing==\"eth0\\nwlan0\\n\" or routing==\"wlan0\\neth0\\n\":\n routing=\"Ethernet+Wifi\"\nelse:\n routing=\"none\"\n\n\ntestIP = \"8.8.8.8\"\ns = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\ns.connect((testIP, 0))\nipaddr = s.getsockname()[0]\nhost = socket.gethostname()\n\n\n\nmsg['routing']=routing\nmsg['ip']=ipaddr\nmsg['hostname']=host\n\nreturn msg","outputs":1,"x":450,"y":960,"wires":[["3c9df58c.5f38aa","bb789eed.9f73c","ebc8cbc7.fc79e8"]]},{"id":"3c9df58c.5f38aa","type":"ui_text","z":"67f0d11b.66aa4","group":"6a63d9e3.95e668","order":3,"width":0,"height":0,"name":"","label":"Hostname:","format":"{{msg.hostname}}","layout":"row-spread","x":630,"y":960,"wires":[]},{"id":"bb789eed.9f73c","type":"ui_text","z":"67f0d11b.66aa4","group":"6a63d9e3.95e668","order":1,"width":0,"height":0,"name":"","label":"Your local IP:","format":"{{msg.ip}}","layout":"row-spread","x":630,"y":920,"wires":[]},{"id":"6bc729ef.ed6838","type":"inject","z":"67f0d11b.66aa4","name":"","topic":"","payload":"Started!","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":220,"y":960,"wires":[["903d7ae1.04e6b8","f393400.d87dcc"]]},{"id":"577ed26b.27d3ac","type":"python3-function","z":"67f0d11b.66aa4","name":"","func":"msg['payload']=\"This is a free piece of software and it is provided 'as is', without any warranty. There might be functions that need a connection to the internet: By pressing 'GET FEATURES' you agree that the shown preview image will be transfered, stored and processed via SFTP. By pressing 'UPLOAD FILES&GET FEEDBACK' you agree, that the following data will be transmitted, stored and processed via SFTP to my (Thomas Megel, OpenScan, Halle, Germany) server: three compressed images of the chosen photo-set, routine parameters, email address, IP address. I will use those information to create a detailed feedback on the image quality/scan settings and send a response to the given email address. The email address and IP will be deleted after 7 days. The images and routine parameters might be used for further experiments (e.g. machine learning to automate the process). If you have any questions you can contact me at info@openscan.eu. The connection used, is a direct, encrypted line between your device and my server - no AWS, no Google analytics, no Facebook whatsoever ... THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE\"\nreturn msg","outputs":1,"x":450,"y":680,"wires":[["74f9bf59.355c2"]]},{"id":"74f9bf59.355c2","type":"ui_toast","z":"67f0d11b.66aa4","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":670,"y":680,"wires":[[]]},{"id":"f3bc73a0.82622","type":"ui_button","z":"67f0d11b.66aa4","name":"","group":"bb1dd00e.a62b9","order":6,"width":6,"height":1,"passthru":false,"label":"Terms of Use","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":310,"y":680,"wires":[["577ed26b.27d3ac"]]},{"id":"cedbd18.437723","type":"ui_switch","z":"67f0d11b.66aa4","name":"","label":"Read&Agree:","tooltip":"","group":"bb1dd00e.a62b9","order":7,"width":6,"height":1,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":480,"y":640,"wires":[["cdca8cce.5565c"]]},{"id":"cdca8cce.5565c","type":"python3-function","z":"67f0d11b.66aa4","name":"Terms of Use","func":"with open(\"/home/pi/shared2/log/feedback_terms.log\", \"w+\") as file:\n file.write(str(msg['payload']))\n\nreturn msg","outputs":1,"x":670,"y":640,"wires":[[]]},{"id":"88a22dc7.342eb","type":"python3-function","z":"67f0d11b.66aa4","name":"Terms of Use","func":"with open(\"/home/pi/shared2/log/feedback_terms.log\", \"r\") as file:\n terms=file.read()\n if terms==\"True\":\n msg['payload']=True\n else:\n msg['payload']=False\nreturn msg","outputs":1,"x":310,"y":640,"wires":[["cedbd18.437723"]]},{"id":"2a0f9919.4c9a86","type":"comment","z":"67f0d11b.66aa4","name":"WIFI","info":"","x":90,"y":900,"wires":[]},{"id":"ebc8cbc7.fc79e8","type":"ui_text","z":"67f0d11b.66aa4","group":"6a63d9e3.95e668","order":2,"width":0,"height":0,"name":"","label":"Connected by","format":"{{msg.routing}}","layout":"row-spread","x":640,"y":880,"wires":[]},{"id":"389d2a21.b2b3f6","type":"ui_ui_control","z":"67f0d11b.66aa4","name":"onTab","events":"all","x":230,"y":1060,"wires":[["903d7ae1.04e6b8","f393400.d87dcc","a49f0248.f0fd5"]]},{"id":"3cf3f356.3b000c","type":"ui_text","z":"67f0d11b.66aa4","group":"6a63d9e3.95e668","order":8,"width":0,"height":0,"name":"","label":"","format":"{{msg.status}}","layout":"row-spread","x":680,"y":1080,"wires":[]},{"id":"a49f0248.f0fd5","type":"python3-function","z":"67f0d11b.66aa4","name":"check ip address","func":"msg['status']=\"\"\nreturn msg","outputs":1,"x":450,"y":1060,"wires":[["3cf3f356.3b000c"]]},{"id":"cac4bb0d.2f52d8","type":"ui_button","z":"9dc0cf34.3aae4","name":"","group":"a6b29266.ae242","order":7,"width":2,"height":1,"passthru":false,"label":"⇐","tooltip":"Move turntable right","color":"","bgcolor":"","icon":"","payload":"200","payloadType":"num","topic":"","x":590,"y":100,"wires":[["629be1e.cc5c12"]]},{"id":"181cf31b.474c9d","type":"ui_button","z":"9dc0cf34.3aae4","name":"","group":"a6b29266.ae242","order":8,"width":2,"height":1,"passthru":false,"label":"⇒","tooltip":"Move turntable left","color":"","bgcolor":"","icon":"","payload":"200","payloadType":"num","topic":"","x":590,"y":140,"wires":[["1071456b.e198eb"]]},{"id":"4a9ddf31.415eb","type":"ui_button","z":"9dc0cf34.3aae4","name":"","group":"a6b29266.ae242","order":4,"width":2,"height":1,"passthru":false,"label":"⇑","tooltip":"Move rotor up","color":"","bgcolor":"","icon":"","payload":"500","payloadType":"num","topic":"","x":90,"y":100,"wires":[["abe15458.1d6ba8"]]},{"id":"4274aa22.a8ea04","type":"ui_button","z":"9dc0cf34.3aae4","name":"","group":"a6b29266.ae242","order":5,"width":2,"height":1,"passthru":false,"label":"⇓","tooltip":"Move rotor down","color":"","bgcolor":"","icon":"","payload":"200","payloadType":"num","topic":"","x":90,"y":140,"wires":[["a321acea.e4b76"]]},{"id":"783602dc.aa9fcc","type":"ui_text","z":"9dc0cf34.3aae4","group":"a6b29266.ae242","order":6,"width":2,"height":1,"name":"","label":"Turntable","format":"{{\"\"}}","layout":"row-center","x":580,"y":60,"wires":[]},{"id":"8e3a903b.ea3b3","type":"ui_text","z":"9dc0cf34.3aae4","group":"a6b29266.ae242","order":3,"width":2,"height":1,"name":"","label":"Rotor","format":"{{\"\"}}","layout":"row-center","x":90,"y":60,"wires":[]},{"id":"455c9b67.5b88a4","type":"python3-function","z":"9dc0cf34.3aae4","name":"TT left","func":"from time import sleep\nimport RPi.GPIO as GPIO\nGPIO.setwarnings(False)\n\nwith open(\"/home/pi/shared2/log/pin_turntable_step.log\", \"r\") as file:\n STEP=int(file.read())\nwith open(\"/home/pi/shared2/log/pin_turntable_dir.log\", \"r\") as file:\n DIR=int(file.read())\nwith open(\"/home/pi/shared2/log/turntable_stepsperrotation.log\", \"r\") as file:\n step_count=int(file.read())\nwith open(\"/home/pi/shared2/log/turntable_delay.log\", \"r\") as file:\n delaytt=float(file.read())\nwith open(\"/home/pi/shared2/log/turntable_angle.log\", \"r\") as file:\n angle=float(file.read())\nwith open(\"/home/pi/shared2/log/turntable_accramp.log\", \"r\") as file:\n ramp=int(file.read())\nwith open(\"/home/pi/shared2/log/turntable_acc.log\", \"r\") as file:\n acc=ramp*float(file.read()) \n\n\nstep_count=int(step_count*angle/360)\n\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(DIR, GPIO.OUT)\nGPIO.setup(STEP, GPIO.OUT)\nGPIO.output(DIR, 0)\ndelay=delaytt\n\nfor x in range(step_count):\n GPIO.output(STEP, GPIO.HIGH)\n if x<=ramp and x<=step_count/2:\n delay=delaytt+(ramp-x)*delaytt/acc\n elif step_count-x<=ramp and x>step_count/2:\n delay=delaytt+(ramp-step_count+x)*delaytt/acc\n sleep(delay)\n GPIO.output(STEP, GPIO.LOW)\n sleep(delay)\nGPIO.cleanup()\n\nreturn msg\n","outputs":1,"x":851,"y":100,"wires":[["fd86cde7.a001f"]]},{"id":"d5790a3c.695078","type":"python3-function","z":"9dc0cf34.3aae4","name":"TT right","func":"from time import sleep\nimport RPi.GPIO as GPIO\nGPIO.setwarnings(False)\n\nwith open(\"/home/pi/shared2/log/pin_turntable_step.log\", \"r\") as file:\n STEP=int(file.read())\nwith open(\"/home/pi/shared2/log/pin_turntable_dir.log\", \"r\") as file:\n DIR=int(file.read())\nwith open(\"/home/pi/shared2/log/turntable_stepsperrotation.log\", \"r\") as file:\n step_count=int(file.read())\nwith open(\"/home/pi/shared2/log/turntable_delay.log\", \"r\") as file:\n delaytt=float(file.read())\nwith open(\"/home/pi/shared2/log/turntable_angle.log\", \"r\") as file:\n angle=float(file.read())\nwith open(\"/home/pi/shared2/log/turntable_accramp.log\", \"r\") as file:\n ramp=int(file.read())\nwith open(\"/home/pi/shared2/log/turntable_acc.log\", \"r\") as file:\n acc=ramp*float(file.read()) \n\nstep_count=int(step_count*angle/360)\n\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(DIR, GPIO.OUT)\nGPIO.setup(STEP, GPIO.OUT)\nGPIO.output(DIR, 1)\ndelay=delaytt\n\nfor x in range(step_count):\n GPIO.output(STEP, GPIO.HIGH)\n if x<=ramp and x<=step_count/2:\n delay=delaytt+(ramp-x)*delaytt/acc\n elif step_count-x<=ramp and x>step_count/2:\n delay=delaytt+(ramp-step_count+x)*delaytt/acc\n sleep(delay)\n GPIO.output(STEP, GPIO.LOW)\n sleep(delay)\nGPIO.cleanup()\n\nreturn msg\n","outputs":1,"x":860,"y":140,"wires":[["fd86cde7.a001f"]]},{"id":"1b297116.fe275f","type":"python3-function","z":"9dc0cf34.3aae4","name":"Rotor left","func":"from time import sleep\nimport RPi.GPIO as GPIO\nGPIO.setwarnings(False)\n\nwith open(\"/home/pi/shared2/log/pin_rotor_step.log\", \"r\") as file:\n STEP=int(file.read())\nwith open(\"/home/pi/shared2/log/pin_rotor_dir.log\", \"r\") as file:\n DIR=int(file.read())\nwith open(\"/home/pi/shared2/log/rotor_stepsperrotation.log\", \"r\") as file:\n step_count=int(file.read())\nwith open(\"/home/pi/shared2/log/rotor_delay.log\", \"r\") as file:\n delaytt=float(file.read())\n\nwith open(\"/home/pi/shared2/log/rotor_angle.log\", \"r\") as file:\n angle=float(file.read())\nwith open(\"/home/pi/shared2/log/rotor_accramp.log\", \"r\") as file:\n ramp=int(file.read())\nwith open(\"/home/pi/shared2/log/rotor_acc.log\", \"r\") as file:\n acc=ramp*float(file.read()) \n\nstep_count=int(step_count*angle/360)\n\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(DIR, GPIO.OUT)\nGPIO.setup(STEP, GPIO.OUT)\nGPIO.output(DIR, 0)\n\nfor x in range(step_count):\n GPIO.output(STEP, GPIO.HIGH)\n if x<=ramp and x<=step_count/2:\n delay=delaytt+(ramp-x)*delaytt/acc\n elif step_count-x<=ramp and x>step_count/2:\n delay=delaytt+(ramp-step_count+x)*delaytt/acc\n sleep(delay)\n GPIO.output(STEP, GPIO.LOW)\n sleep(delay)\nGPIO.cleanup()\n\nreturn msg\n","outputs":1,"x":360,"y":100,"wires":[["7d837f2b.4beee"]]},{"id":"15617fb7.4d65e","type":"python3-function","z":"9dc0cf34.3aae4","name":"Rotor right","func":"from time import sleep\nimport RPi.GPIO as GPIO\nGPIO.setwarnings(False)\n\nwith open(\"/home/pi/shared2/log/pin_rotor_step.log\", \"r\") as file:\n STEP=int(file.read())\nwith open(\"/home/pi/shared2/log/pin_rotor_dir.log\", \"r\") as file:\n DIR=int(file.read())\nwith open(\"/home/pi/shared2/log/rotor_stepsperrotation.log\", \"r\") as file:\n step_count=int(file.read())\nwith open(\"/home/pi/shared2/log/rotor_delay.log\", \"r\") as file:\n delaytt=float(file.read())\nwith open(\"/home/pi/shared2/log/rotor_angle.log\", \"r\") as file:\n angle=float(file.read())\nwith open(\"/home/pi/shared2/log/rotor_accramp.log\", \"r\") as file:\n ramp=int(file.read())\nwith open(\"/home/pi/shared2/log/rotor_acc.log\", \"r\") as file:\n acc=ramp*float(file.read()) \n\nstep_count=int(step_count*angle/360)\n\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(DIR, GPIO.OUT)\nGPIO.setup(STEP, GPIO.OUT)\nGPIO.output(DIR, 1)\n\nfor x in range(step_count):\n GPIO.output(STEP, GPIO.HIGH)\n if x<=ramp and x<=step_count/2:\n delay=delaytt+(ramp-x)*delaytt/acc\n elif step_count-x<=ramp and x>step_count/2:\n delay=delaytt+(ramp-step_count+x)*delaytt/acc\n sleep(delay)\n GPIO.output(STEP, GPIO.LOW)\n sleep(delay)\nGPIO.cleanup()\n\nreturn msg\n","outputs":1,"x":370,"y":140,"wires":[["7d837f2b.4beee"]]},{"id":"fd86cde7.a001f","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["2ec25eee.175402","35a36b3b.902074","9eafa9a.929b058"],"x":955,"y":120,"wires":[]},{"id":"7d837f2b.4beee","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["2ec25eee.175402","35a36b3b.902074","9eafa9a.929b058"],"x":475,"y":120,"wires":[]},{"id":"abe15458.1d6ba8","type":"delay","z":"9dc0cf34.3aae4","name":"lmt 0.2/s","pauseType":"rate","timeout":"0.1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":220,"y":100,"wires":[["1b297116.fe275f"]]},{"id":"a321acea.e4b76","type":"delay","z":"9dc0cf34.3aae4","name":"lmt 0.2/s","pauseType":"rate","timeout":"0.1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":220,"y":140,"wires":[["15617fb7.4d65e"]]},{"id":"629be1e.cc5c12","type":"delay","z":"9dc0cf34.3aae4","name":"lmt 0.2/s","pauseType":"rate","timeout":"0.1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":720,"y":100,"wires":[["455c9b67.5b88a4"]]},{"id":"1071456b.e198eb","type":"delay","z":"9dc0cf34.3aae4","name":"lmt 0.2/s","pauseType":"rate","timeout":"0.1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":720,"y":140,"wires":[["d5790a3c.695078"]]},{"id":"acd9a5d9.947d88","type":"ui_template","z":"c23f7f4e.33171","group":"828432c0.98256","name":"Display File List","order":1,"width":14,"height":6,"format":"<script>\n \nthis.scope.action = function(opt) {\n var playFile = opt || \"no data passed to function\";\n// console.warn(playFile)\n return playFile; } \n</script>\n\n\n<section layout = \"row\" layout-sm = \"column\" layout-align = \"center center\" layout-wrap>\n<md-button style=\"width:300px; height:46px;\" target=\"_blank\" ng-href=\"/ui/data/zip/{{file}}\">\n <div class=\"center\" style=\"position: relative;\n top: 30%;\">\n Download File\n</div></md-button>\n</section>\n\n <ul>\n <li ng-repeat=\"file in msg.files track by $index\" style=\"list-style-type: none;\">\n <label>\n <input type=\"radio\" ng-model=\"$parent.file\" name=\"data\" value=\"{{file}}\" required />{{file}}\n </label>\n </li>\n </ul>\n\n\n\n</div>\n\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":440,"y":120,"wires":[["d4c377fa.ee0a48"]]},{"id":"d4c377fa.ee0a48","type":"fs-ops-dir","z":"c23f7f4e.33171","name":"/media/pi/","path":"path","pathType":"msg","filter":"*","filterType":"str","dir":"files","dirType":"msg","x":441,"y":80,"wires":[["acd9a5d9.947d88"]]},{"id":"cc428b68.e48858","type":"function","z":"c23f7f4e.33171","name":"","func":"msg.path = \"shared2/ui/data/zip\"\n\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":80,"wires":[["d4c377fa.ee0a48"]]},{"id":"270d5a7f.f247d6","type":"inject","z":"c23f7f4e.33171","name":"repeat 1","topic":"Repeater","payload":"0.2","payloadType":"str","repeat":"1","crontab":"","once":true,"onceDelay":"3","x":120,"y":80,"wires":[["cc428b68.e48858"]]},{"id":"d18b6e75.b80a2","type":"ui_button","z":"c23f7f4e.33171","name":"Delete old files","group":"828432c0.98256","order":3,"width":6,"height":1,"passthru":false,"label":"{{msg.payload}}","tooltip":"This can not be undone","color":"red","bgcolor":"lightblue","icon":"","payload":"Delete all local image files?","payloadType":"str","topic":"","x":440,"y":180,"wires":[["f48b380d.8cd418"]]},{"id":"3cd9dd95.824bf2","type":"exec","z":"c23f7f4e.33171","command":"","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":950,"y":180,"wires":[[],[],[]]},{"id":"69497708.ce1b18","type":"python3-function","z":"c23f7f4e.33171","name":"check if busy","func":"with open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"r\") as file:\n state=file.read()\nif state==\"--READY--\":\n if msg['payload']!=\"Yes\":\n return\n msg['payload']=\"sudo rm -rf -d /home/pi/shared2/ui/data/zip/*.zip && sudo rm -rf /home/pi/shared/20*/\"\n return msg\nreturn","outputs":1,"x":790,"y":180,"wires":[["3cd9dd95.824bf2"]]},{"id":"82065daf.abb56","type":"inject","z":"c23f7f4e.33171","name":"repeat 10","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":true,"onceDelay":"1","x":130,"y":180,"wires":[["704db336.958a6c"]]},{"id":"704db336.958a6c","type":"python3-function","z":"c23f7f4e.33171","name":"diskspace","func":"import os\nimport subprocess\n\nos.system(\"df| awk -F '%' 'NR==2{print $1}'>tmp\")\npercentage=open('tmp', 'r').read()[-4:-1]\nos.remove('tmp')\n\nmsg['payload']=\"Delete all images (\"+percentage+\"% used)\"\n\n\n\nreturn msg\n","outputs":1,"x":280,"y":180,"wires":[["d18b6e75.b80a2"]]},{"id":"f48b380d.8cd418","type":"ui_toast","z":"c23f7f4e.33171","position":"dialog","displayTime":"5","highlight":"","sendall":true,"outputs":1,"ok":"No","cancel":"Yes","raw":false,"topic":"","name":"","x":630,"y":180,"wires":[["69497708.ce1b18"]]},{"id":"ad52debb.ecd1b","type":"ui_form","z":"9dc0cf34.3aae4","name":"","label":"","group":"a6b29266.ae242","order":13,"width":0,"height":0,"options":[{"label":"Projectname","value":"Projectname","type":"text","required":true,"rows":null},{"label":"Photos per Rotation","value":"PhotosPerRotation","type":"number","required":true,"rows":null},{"label":"Start Deflection","value":"StartDeflection","type":"number","required":true,"rows":null},{"label":"Vertical Positions","value":"VerticalPositions","type":"number","required":true,"rows":null}],"formValue":{"Projectname":"","PhotosPerRotation":"","StartDeflection":"","VerticalPositions":""},"payload":"","submit":"Start Routine","cancel":"Reset","topic":"","x":510,"y":1360,"wires":[["60223d07.7a90b4","17db61f7.83807e"]]},{"id":"9733fa31.d0d5e8","type":"ui_dropdown","z":"9dc0cf34.3aae4","name":"","label":"","tooltip":"","place":"Load Program","group":"a6b29266.ae242","order":12,"width":0,"height":0,"passthru":true,"options":[{"label":"Minimal (18/10/2)","value":"minimal","type":"str"},{"label":"Standard (30/20/3)","value":"standard","type":"str"},{"label":"Fine (36/35/5)","value":"fine","type":"str"}],"payload":"","topic":"","x":260,"y":1360,"wires":[["16d9dcaf.a681f3"]]},{"id":"16d9dcaf.a681f3","type":"function","z":"9dc0cf34.3aae4","name":"","func":"if (msg.payload==\"minimal\"){\n msg={payload:{Projectname:\"default\",PhotosPerRotation:18,StartDeflection:10,VerticalPositions:2}}\n return msg\n}\nif (msg.payload==\"standard\"){\n msg={payload:{Projectname:\"default\",PhotosPerRotation:30,StartDeflection:20,VerticalPositions:3}}\n return msg\n}\nif (msg.payload==\"fine\"){\n msg={payload:{Projectname:\"default\",PhotosPerRotation:36,StartDeflection:35,VerticalPositions:5}}\n return msg\n}\n","outputs":1,"noerr":0,"x":390,"y":1360,"wires":[["ad52debb.ecd1b"]]},{"id":"b93410ed.7a1d8","type":"ui_button","z":"9dc0cf34.3aae4","name":"","group":"a6b29266.ae242","order":15,"width":4,"height":1,"passthru":true,"label":"Stop Routine","tooltip":"","color":"","bgcolor":"lightblue","icon":"","payload":"stop","payloadType":"str","topic":"","x":110,"y":1040,"wires":[["e8ec2826.350118"]]},{"id":"e8ec2826.350118","type":"python3-function","z":"9dc0cf34.3aae4","name":"set stop state variables","func":"with open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"r\") as file:\n test=file.read()\nif test[:3]!=\"Pos\":\n return\n\nwith open(\"/home/pi/shared2/log/stopstate.log\", \"w\") as file:\n file.write(\"stop\")\nwith open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"w\") as file:\n file.write(\"--stopping--\")","outputs":1,"x":300,"y":1040,"wires":[[]]},{"id":"d86a59e0.bcc1c8","type":"function","z":"9dc0cf34.3aae4","name":"Autoupdate on?","func":"if (global.get(\"autoupdate\") == \"on\"){\n return msg\n}","outputs":1,"noerr":0,"x":360,"y":740,"wires":[["cde489b7.74bc38"]]},{"id":"e0a9c2ea.d86bf","type":"file in","z":"9dc0cf34.3aae4","name":"","filename":"/home/pi/shared2/log/currentstatus_rpi.log","format":"lines","chunk":false,"sendError":false,"encoding":"none","x":436.9999237060547,"y":778.9998388290405,"wires":[["edd0b32b.50761"]]},{"id":"a3eef736.b6f1c8","type":"ui_text","z":"9dc0cf34.3aae4","group":"a6b29266.ae242","order":1,"width":0,"height":0,"name":"","label":"Current Status:","format":"<font color= {{msg.color}} > {{msg.payload}} </font>","layout":"row-spread","x":820,"y":780,"wires":[]},{"id":"b5ab25ee.22b848","type":"inject","z":"9dc0cf34.3aae4","name":"","topic":"Repeater","payload":"0.1","payloadType":"str","repeat":"0.1","crontab":"","once":true,"onceDelay":"1","x":120,"y":740,"wires":[["e0a9c2ea.d86bf","d86a59e0.bcc1c8","743e6924.3983c8"]]},{"id":"cde489b7.74bc38","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["35a36b3b.902074","9eafa9a.929b058"],"x":493.0173387527466,"y":739.6771926879883,"wires":[]},{"id":"edd0b32b.50761","type":"python3-function","z":"9dc0cf34.3aae4","name":"color","func":"if msg['payload']==\"no camera found\":\n msg['color']=\"red\"\n pass\nreturn msg","outputs":1,"x":666.9999237060547,"y":778.9998388290405,"wires":[["a3eef736.b6f1c8"]]},{"id":"a114e968.90f3f8","type":"ui_button","z":"9dc0cf34.3aae4","name":"","group":"8f687dea.5dbd8","order":6,"width":4,"height":1,"passthru":false,"label":"Update Preview","tooltip":"press to show the effect of changed settings (takes one second to load)","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":120,"y":900,"wires":[["b5487b7a.f8f358"]]},{"id":"25263a41.269786","type":"function","z":"9dc0cf34.3aae4","name":"timestamp pic file","func":"var d = new Date();\nvar n = d.getTime();\nmsg.payload = \"/ui/data/preview.jpg?ts=\" + n;\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":900,"wires":[["e3940138.c5445"]]},{"id":"f06ce05a.82","type":"python3-function","z":"9dc0cf34.3aae4","name":"Take Preview Shot","func":"import time\nimport picamera\nfrom time import sleep\nimport subprocess\nfrom PIL import Image\n\ndownscale=3\n\nwith open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"r\") as file:\n if file.read()==\"creating zip file\":\n return\n\nif subprocess.check_output([\"vcgencmd\",\"get_camera\"])[-2:-1]==\"0\":\n with open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"w\") as file:\n file.write(\"no camera found\")\n return\n\nwith open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"r\") as file:\n state=file.read()\n if state[:3]==\"Pos\":\n return\n\nwith open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"w\") as file:\n file.write(\"--READY--\")\n\nwith open(\"/home/pi/shared2/log/shutterspeed.log\", \"r\") as file:\n shutterspeed=int(file.read())*100\n\n\nwith open(\"/home/pi/shared2/log/camera_resolution_x.log\", \"r\") as file:\n resx=int(file.read())\nwith open(\"/home/pi/shared2/log/camera_resolution_y.log\", \"r\") as file:\n resy=int(file.read())\nwith open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"r\") as file:\n currentstatus=file.read()\n\ndef rotate(filepath):\n pass\n\ndef crop(filepath):\n with open(\"/home/pi/shared2/log/cropx.log\", \"r\") as file:\n cropx=int(file.read())\n with open(\"/home/pi/shared2/log/cropy.log\", \"r\") as file:\n cropy=int(file.read()) \n img = Image.open(filepath)\n width, height = img.size \n\n left = width*cropy/100\n top = height*cropx/100\n right = width*(100-cropy)/100\n bottom = height*(100-cropx)/100\n img= img.crop((left,top,right,bottom))\n img.save(filepath)\n zoom=min(float(cropx)/50,float(cropy)/50)\n img = img.resize((int(float(1200-24*cropy)/(1-zoom)),int(float(900-18*cropx)/(1-zoom))))\n img = img.transpose(Image.ROTATE_90)\n img.save('./shared2/ui/data/preview.jpg')\n img.close()\n\n\nif currentstatus == \"--READY--\":\n with picamera.PiCamera() as camera:\n camera.iso = 100\n camera.brightness = 50\n camera.contrast = 0\n camera.resolution=(resx/downscale, resy/downscale)\n camera.exposure_compensation = 0 \n sleep(0.4)\n camera.awb_mode = 'auto'\n camera.exposure_mode = 'off'\n camera.shutter_speed = shutterspeed\n camera.capture(\"./shared2/ui/data/preview.jpg\",quality=90)\n rotate(\"./shared2/ui/data/preview.jpg\")\n crop(\"./shared2/ui/data/preview.jpg\")\n return msg\n\n\nreturn\n","outputs":1,"x":550,"y":900,"wires":[["25263a41.269786"]]},{"id":"b5487b7a.f8f358","type":"delay","z":"9dc0cf34.3aae4","name":"","pauseType":"rate","timeout":"0.1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1.35","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":350,"y":900,"wires":[["f06ce05a.82"]]},{"id":"9eafa9a.929b058","type":"link in","z":"9dc0cf34.3aae4","name":"Update Preview RPi","links":["4bafeaee.da8274","1519cfac.723f1","1c4b5036.a10fd","1a794560.38424b","529400f0.1e473","cdc6c714.a50768","f5ee2b34.38c468","e24779c5.096f48","bb4b43c8.b49e7","efcbec58.ac2c1","eedbeec5.3e917","fd86cde7.a001f","7d837f2b.4beee","845a52f.82102b","cde489b7.74bc38","d7a485a0.2bbff8","771a440b.43fc7c","f94f9607.4e8fd8","5df71560.5080cc","d3678a8e.ae49f8"],"x":195,"y":940,"wires":[["b5487b7a.f8f358"]]},{"id":"e3940138.c5445","type":"ui_template","z":"9dc0cf34.3aae4","group":"6c1b4ac6.22fbe4","name":"preview","order":1,"width":10,"height":13,"format":"<div align=\"center\">\n<img ng-src= {{msg.payload}} style=\"max-width: 505px;max-height: 660px;width: auto; height: auto;\"</img>\n<a src=\"/data/preview.jpg\" </a>\n</div>\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":1060,"y":900,"wires":[[]]},{"id":"fef03d9b.5b56f","type":"ui_slider","z":"9dc0cf34.3aae4","name":"cropx","label":" Crop X","tooltip":"Crop the image horizontally ","group":"8f687dea.5dbd8","order":3,"width":6,"height":1,"passthru":true,"outs":"end","topic":"","min":"0","max":"49","step":"1","x":610,"y":480,"wires":[["b5dbc3ed.fc6a6","d7a485a0.2bbff8"]]},{"id":"bdf2fccc.4f4f8","type":"file in","z":"9dc0cf34.3aae4","name":"","filename":"/home/pi/shared2/log/cropx.log","format":"","chunk":false,"sendError":false,"encoding":"none","x":370,"y":480,"wires":[["fef03d9b.5b56f"]]},{"id":"b5dbc3ed.fc6a6","type":"python3-function","z":"9dc0cf34.3aae4","name":"add unit","func":"value=str(msg['payload'])\nwith open(\"/home/pi/shared2/log/cropx.log\", \"w\") as file:\n file.write(value)\nmsg['payload']=value+\"%\"\nreturn msg","outputs":1,"x":780,"y":480,"wires":[[]]},{"id":"8c08e540.ab6658","type":"ui_slider","z":"9dc0cf34.3aae4","name":"cropy","label":" Crop Y","tooltip":"crop the image vertically","group":"8f687dea.5dbd8","order":2,"width":6,"height":1,"passthru":true,"outs":"end","topic":"","min":"0","max":"49","step":"1","x":610,"y":520,"wires":[["58072c22.766dd4","d7a485a0.2bbff8"]]},{"id":"c4e8d7a2.8c9528","type":"file in","z":"9dc0cf34.3aae4","name":"","filename":"/home/pi/shared2/log/cropy.log","format":"","chunk":false,"sendError":false,"encoding":"none","x":370,"y":520,"wires":[["8c08e540.ab6658"]]},{"id":"58072c22.766dd4","type":"python3-function","z":"9dc0cf34.3aae4","name":"add unit","func":"value=str(msg['payload'])\nwith open(\"/home/pi/shared2/log/cropy.log\", \"w\") as file:\n file.write(value)\nmsg['payload']=value+\"%\"\nreturn msg","outputs":1,"x":780,"y":520,"wires":[[]]},{"id":"d7a485a0.2bbff8","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["35a36b3b.902074","9eafa9a.929b058"],"x":715,"y":560,"wires":[]},{"id":"2744828e.90bc5e","type":"inject","z":"9dc0cf34.3aae4","name":"","topic":"","payload":"Started!","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"1","x":100,"y":200,"wires":[["bdf2fccc.4f4f8","c4e8d7a2.8c9528","4c8186d8.eaade8","44490d23.894d64","69ca875e.221018","20c20792.54acc8","1dcf0f6a.c56e11","385965ee.c7b66a"]]},{"id":"11c5edb0.0a90d2","type":"ui_slider","z":"9dc0cf34.3aae4","name":"shutter ","label":" Shutter","tooltip":"adjust the camera shutter speed","group":"8f687dea.5dbd8","order":1,"width":6,"height":1,"passthru":true,"outs":"end","topic":"","min":"1","max":"200","step":"1","x":610,"y":440,"wires":[["792a3849.63d0d8","d7a485a0.2bbff8"]]},{"id":"4c8186d8.eaade8","type":"file in","z":"9dc0cf34.3aae4","name":"","filename":"/home/pi/shared2/log/shutterspeed.log","format":"","chunk":false,"sendError":false,"encoding":"none","x":390,"y":440,"wires":[["11c5edb0.0a90d2"]]},{"id":"792a3849.63d0d8","type":"python3-function","z":"9dc0cf34.3aae4","name":"add unit","func":"value=str(msg['payload'])\nwith open(\"/home/pi/shared2/log/shutterspeed.log\", \"w\") as file:\n file.write(value)\nmsg['payload']=str(float(value)/10)+'ms'\nreturn msg","outputs":1,"x":780,"y":440,"wires":[[]]},{"id":"44490d23.894d64","type":"python3-function","z":"9dc0cf34.3aae4","name":"set initial variables","func":"import subprocess\n\nwith open(\"/home/pi/shared2/log/stopstate.log\", \"w\") as file:\n file.write(\"run\")\nwith open(\"/home/pi/shared2/log/updatepreview.log\", \"w\") as file:\n file.write(\"start\")\nwith open(\"/home/pi/shared2/log/ringlightstatus1.log\", \"w\") as file:\n file.write(\"off\")\nwith open(\"/home/pi/shared2/log/ringlightstatus2.log\", \"w\") as file:\n file.write(\"off\")\n\nif subprocess.check_output([\"vcgencmd\",\"get_camera\"])[-2:-1]==\"0\":\n with open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"w\") as file:\n file.write(\"no camera found\")\n return\nwith open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"w\") as file:\n file.write(\"--READY--\")","outputs":1,"x":330,"y":200,"wires":[[]]},{"id":"69ca875e.221018","type":"exec","z":"9dc0cf34.3aae4","command":"sudo rm -rf -d /home/pi/shared2/ui/data/preview.jpg","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":430,"y":260,"wires":[[],[],[]]},{"id":"16fc3ee2.e1fee1","type":"ui_switch","z":"9dc0cf34.3aae4","name":"","label":"Light 2","tooltip":"turn second ringlight on/off","group":"a6b29266.ae242","order":10,"width":3,"height":1,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":630,"y":380,"wires":[["9f6280d7.49b57"]]},{"id":"605b65a6.9b478c","type":"python3-function","z":"9dc0cf34.3aae4","name":"Ringlight on/off","func":"from time import sleep\nimport RPi.GPIO as GPIO\n\nwith open(\"/home/pi/shared2/log/pin_ringlight2.log\", \"r\") as file:\n ringlightpin=int(file.read())\nwith open(\"/home/pi/shared2/log/ringlightstatus2.log\", \"r\") as file:\n state=file.read()\n\nGPIO.setwarnings(False)\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(ringlightpin, GPIO.OUT)\n\nif state == \"on\":\n GPIO.output(ringlightpin, GPIO.HIGH)\nif state == \"off\":\n GPIO.output(ringlightpin, GPIO.LOW)\n\nmsg['payload']=state\n\nreturn msg","outputs":1,"x":480,"y":380,"wires":[["16fc3ee2.e1fee1"]]},{"id":"a966e3bf.d9a08","type":"ui_switch","z":"9dc0cf34.3aae4","name":"","label":"Light 1","tooltip":"turn first ringlight on/off","group":"a6b29266.ae242","order":9,"width":3,"height":1,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":630,"y":320,"wires":[["ed2576ba.f46f98"]]},{"id":"193307a1.049708","type":"python3-function","z":"9dc0cf34.3aae4","name":"Ringlight on/off","func":"from time import sleep\nimport RPi.GPIO as GPIO\n\nwith open(\"/home/pi/shared2/log/pin_ringlight1.log\", \"r\") as file:\n ringlightpin=int(file.read())\nwith open(\"/home/pi/shared2/log/ringlightstatus1.log\", \"r\") as file:\n state=file.read()\n\nGPIO.setwarnings(False)\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(ringlightpin, GPIO.OUT)\n\nif state == \"on\":\n GPIO.output(ringlightpin, GPIO.HIGH)\nif state == \"off\":\n GPIO.output(ringlightpin, GPIO.LOW)\n\nmsg['payload']=state\n\nreturn msg","outputs":1,"x":480,"y":320,"wires":[["a966e3bf.d9a08"]]},{"id":"ed2576ba.f46f98","type":"python3-function","z":"9dc0cf34.3aae4","name":"Ringlight on/off","func":"\nwith open(\"/home/pi/shared2/log/ringlightstatus1.log\", \"r\") as file:\n oldstate=file.read()\nnewstate =msg['payload']\n\nif newstate!=oldstate:\n with open(\"/home/pi/shared2/log/ringlightstatus1.log\", \"w\") as file:\n file.write(newstate)\n return msg\n","outputs":1,"x":780,"y":320,"wires":[["771a440b.43fc7c","193307a1.049708"]]},{"id":"9f6280d7.49b57","type":"python3-function","z":"9dc0cf34.3aae4","name":"Ringlight on/off","func":"\nwith open(\"/home/pi/shared2/log/ringlightstatus2.log\", \"r\") as file:\n oldstate=file.read()\nnewstate =msg['payload']\n\nif newstate!=oldstate:\n with open(\"/home/pi/shared2/log/ringlightstatus2.log\", \"w\") as file:\n file.write(newstate)\n return msg\n","outputs":1,"x":780,"y":380,"wires":[["771a440b.43fc7c","605b65a6.9b478c"]]},{"id":"771a440b.43fc7c","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["2ec25eee.175402","35a36b3b.902074","9eafa9a.929b058"],"x":935,"y":320,"wires":[]},{"id":"20c20792.54acc8","type":"python3-function","z":"9dc0cf34.3aae4","name":"blink","func":"from time import sleep\nimport RPi.GPIO as GPIO\n\nsleep(1)\n\nsleeptime = 0.05\n\nwith open(\"/home/pi/shared2/log/pin_ringlight1.log\", \"r\") as file:\n ringlightpin1=int(file.read())\nwith open(\"/home/pi/shared2/log/pin_ringlight2.log\", \"r\") as file:\n ringlightpin2=int(file.read())\n\nGPIO.setwarnings(False)\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(ringlightpin1, GPIO.OUT)\nGPIO.setup(ringlightpin2, GPIO.OUT)\nGPIO.output(ringlightpin2, GPIO.LOW)\n\nwith open(\"/home/pi/shared2/log/ringlightstatus1.log\", \"w\") as file:\n file.write(\"off\")\nwith open(\"/home/pi/shared2/log/ringlightstatus2.log\", \"w\") as file:\n file.write(\"off\")\n\nfor x in range(10):\n GPIO.output(ringlightpin1, GPIO.HIGH)\n sleep(sleeptime)\n GPIO.output(ringlightpin1, GPIO.LOW)\n sleep(sleeptime)\nmsg['payload']=\"off\"\nreturn msg","outputs":1,"x":290,"y":320,"wires":[["193307a1.049708","605b65a6.9b478c","f94f9607.4e8fd8"]]},{"id":"94191463.e5cb28","type":"ui_switch","z":"9dc0cf34.3aae4","name":"","label":"Auto Update Preview","tooltip":"This will update the preview every 2s","group":"8f687dea.5dbd8","order":15,"width":4,"height":1,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":460,"y":600,"wires":[["3d27d10c.59a97e"]]},{"id":"3d27d10c.59a97e","type":"change","z":"9dc0cf34.3aae4","name":"","rules":[{"t":"set","p":"autoupdate","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":600,"wires":[[]]},{"id":"1dcf0f6a.c56e11","type":"python3-function","z":"9dc0cf34.3aae4","name":"msg","func":"msg['payload']=\"off\"\nreturn msg","outputs":1,"x":290,"y":600,"wires":[["94191463.e5cb28"]]},{"id":"f94f9607.4e8fd8","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["2ec25eee.175402","35a36b3b.902074","9eafa9a.929b058"],"x":255,"y":380,"wires":[]},{"id":"3938bf22.4b4c4","type":"ui_toast","z":"9dc0cf34.3aae4","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":true,"topic":"","name":"","x":710,"y":660,"wires":[[]]},{"id":"13138d86.5a4102","type":"python3-function","z":"9dc0cf34.3aae4","name":"set image as fullscreen","func":"import time\ntime.sleep(1)\ntimestamp =str(int(time.time()))\nmsg['payload']='<img src=\"/ui/data/preview.jpg?ts='+timestamp+'\" alt=\"Preview\" style=\"width: auto; height: auto;max-width: 1800px;max-height: 1800px\">'\nreturn msg","outputs":1,"x":520,"y":660,"wires":[["3938bf22.4b4c4"]]},{"id":"f8f593a5.c4729","type":"ui_button","z":"9dc0cf34.3aae4","name":"","group":"8f687dea.5dbd8","order":12,"width":4,"height":1,"passthru":false,"label":"Fullscreen","tooltip":"This will open the current preview in a larger window","color":"","bgcolor":"","icon":"","payload":"off","payloadType":"str","topic":"","x":90,"y":660,"wires":[["b3323cb1.f57c7"]]},{"id":"b3323cb1.f57c7","type":"change","z":"9dc0cf34.3aae4","name":"","rules":[{"t":"set","p":"autoupdate","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":660,"wires":[["13138d86.5a4102","443634c8.0db14c"]]},{"id":"99735b94.c28f88","type":"ui_button","z":"9dc0cf34.3aae4","name":"","group":"8f687dea.5dbd8","order":9,"width":4,"height":1,"passthru":false,"label":"Get Features","tooltip":"Calculate Features on the current preview image","color":"","bgcolor":"","icon":"","payload":"autoupdate","payloadType":"global","topic":"","x":110,"y":1140,"wires":[["5dacd9.5d83d328"]]},{"id":"5dacd9.5d83d328","type":"python3-function","z":"9dc0cf34.3aae4","name":"Auto Update off","func":"msg2={\"payload\":\"disabled auto-update preview for the feature calculation\"}\n\nif msg['payload']==\"on\":\n msg['payload']=\"off\"\n return None,msg,msg2\n\nreturn msg","outputs":3,"x":280,"y":1140,"wires":[["e17fee1b.b5063"],["be95c406.19e5e8","20c6ddc0.5295b2"],["49d0e7f8.56f038"]]},{"id":"be95c406.19e5e8","type":"change","z":"9dc0cf34.3aae4","name":"","rules":[{"t":"set","p":"autoupdate","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1160,"wires":[["52211f43.b09d2"]]},{"id":"52211f43.b09d2","type":"python3-function","z":"9dc0cf34.3aae4","name":"sleep","func":"from time import sleep\nwith open(\"/home/pi/shared/log/currentstatus_rpi.log\", \"w\") as file:\n file.write(\"initalizing\")\n\nsleep(1.3)\n\nreturn msg","outputs":1,"x":710,"y":1160,"wires":[["e17fee1b.b5063"]]},{"id":"e17fee1b.b5063","type":"python3-function","z":"9dc0cf34.3aae4","name":"Preview for features","func":"import time\nimport picamera\nfrom time import sleep\nimport subprocess\nfrom PIL import Image\n\nwith open(\"/home/pi/shared2/log/feedback_terms.log\", \"r\") as file:\n terms=file.read()\nif terms==\"False\":\n msg['payload']=\"Please read and agree to the Terms of Use (See Settings Menu) before you can use this function\"\n return None,msg\n\nwith open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"r\") as file:\n state=file.read()\n if state[:3]==\"Pos\":\n return\n\nwith open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"w\") as file:\n file.write(\"initalizing\")\n\nif subprocess.check_output([\"vcgencmd\",\"get_camera\"])[-2:-1]==\"0\":\n with open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"w\") as file:\n file.write(\"no camera found\")\n return\n\nwith open(\"/home/pi/shared2/log/shutterspeed.log\", \"r\") as file:\n shutterspeed=int(file.read())*100\nwith open(\"/home/pi/shared2/log/camera_resolution_x.log\", \"r\") as file:\n resx=int(file.read())\nwith open(\"/home/pi/shared2/log/camera_resolution_y.log\", \"r\") as file:\n resy=int(file.read())\nwith open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"r\") as file:\n currentstatus=file.read()\n\ndef crop(filepath):\n with open(\"/home/pi/shared2/log/cropx.log\", \"r\") as file:\n cropx=int(file.read())\n with open(\"/home/pi/shared2/log/cropy.log\", \"r\") as file:\n cropy=int(file.read()) \n img = Image.open(filepath)\n width, height = img.size \n\n left = width*cropx/100\n top = height*cropy/100\n right = width*(100-cropx)/100\n bottom = height*(100-cropy)/100\n img= img.crop((left,top,right,bottom))\n img.save(filepath)\n zoom=min(float(cropx)/50,float(cropy)/50)\n #img = img.resize((int(float(600-12*cropx)/(1-zoom)), int(float(450-9*cropy)/(1-zoom))))\n img = img.resize((int(float(1800-36*cropx)/(1-zoom)), int(float(1350-27*cropy)/(1-zoom))))\n img = img.transpose(Image.ROTATE_90)\n img.save('./shared2/ui/data/preview.jpg')\n img.close()\n\nsleep(0.2)\n\nwith picamera.PiCamera() as camera:\n camera.iso = 100\n camera.brightness = 50\n camera.contrast = 0\n camera.resolution=(resx, resy)\n camera.exposure_compensation = 0 \n sleep(0.4)\n camera.awb_mode = 'auto'\n camera.exposure_mode = 'off'\n camera.shutter_speed = shutterspeed\n camera.capture(\"./shared2/ui/data/preview.jpg\",quality=90)\n crop(\"./shared2/ui/data/preview.jpg\")\nreturn msg\n","outputs":2,"x":900,"y":1120,"wires":[["dd9efadd.a30528","25263a41.269786"],["6f9e24a7.8ebe1c"]]},{"id":"dd9efadd.a30528","type":"python3-function","z":"9dc0cf34.3aae4","name":"features","func":"import os\nimport os\nfrom PIL import Image\nimport uuid\n\nfrom time import sleep\nrepeats=4\ndelay=3\n\nfilepath=\"/home/pi/shared2/ui/data/preview.jpg\"\n\nwith open(\"/home/pi/shared2/log/feedback_terms.log\", \"r\") as file:\n terms=file.read()\n\nkey=uuid.uuid4().hex[:30].replace('0','X').replace('O','Y')\n\n\npw=\"MKN3iOE4u9qICzHzBmjwuWNt8UD62aP8uPxcOqsrwramqrMcoPJd7dJLz44B4VGRUOKk9W5C4viKrrINagKxvmrLDajrgg8Wkh4I\"\nuser=\"feature\"\n#server=\"openscanfeedback.dnsuser.de:1312\"\nserver=\"openscanfeedback.dnsuser.de\"\nport=str(1312)\npw_down=\"nnEDBxDrDPFPWKZIylxbL21U9QhUrnBWIqsnYUgmLPsCd1ZiJtClrS2bxc8wJq7DSIZNOoiWnMNrLnuJadNagCKhsDCyCVRiUBpf\"\nuser_down=\"download\"\ntarget=\"/home/pi/shared2/log/\"+key+\".jpg\"\n\nos.system(\"sudo cp \"+filepath+\" \"+target)\n\ndef check_terms():\n #if terms==\"False\":\n # status(\"please agree to the terms of use\")\n # end()\n pass\n\ndef status(text):\n with open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"w\") as file:\n file.write(text)\n msg['payload']=text\n pass\n\ndef onlinetest():\n if os.system(\"nc -w 1 \"+server+\" \"+port)==0:\n status(\"server is online\")\n \n else:\n status(\"server not reachable\")\n end()\n pass\n\ndef upload():\n command=\"curl -k --user \"+user+\":\"+pw+\" sftp://\"+server+\":\"+port+\"/\"+user+\"/ -T \"+target\n if os.system(command)!=0:\n status(\"upload failed\")\n end()\n\n\ndef download():\n command=\"curl -k --user \"+user_down+\":\"+pw_down+\" sftp://\"+server+\":\"+port+\"/\"+user_down+\"/\"+key+\".jpg -o \"+filepath\n test=os.system(command)\n return test\n\ncheck_terms()\nstatus(\"checking connection\")\ntry:\n onlinetest()\nexcept:\n status(\"connection failed\")\n return msg\n\nstatus(\"uploading file\")\ntry:\n upload()\nexcept:\n status(\"upload failed\")\n return msg\nsleep(delay/2)\nstatus(\"waiting for file\")\nsleep(delay/2)\n\nfor x in range (repeats):\n if download()!=0:\n status(\"try: (\"+str(x+1)+\")\")\n sleep(delay/2)\n else:\n os.system(\"sudo rm \"+target)\n status(\"--READY--\")\n return msg\n\nstatus(\"--READY--\")\nreturn msg\n","outputs":1,"x":1100,"y":1120,"wires":[["25263a41.269786"]]},{"id":"6f9e24a7.8ebe1c","type":"ui_toast","z":"9dc0cf34.3aae4","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","topic":"","name":"","x":1110,"y":1160,"wires":[[]]},{"id":"49d0e7f8.56f038","type":"ui_toast","z":"9dc0cf34.3aae4","position":"bottom right","displayTime":"5","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":520,"y":1200,"wires":[]},{"id":"64625276.d9ab6c","type":"link in","z":"9dc0cf34.3aae4","name":"Autoupdate","links":["443634c8.0db14c","20c6ddc0.5295b2","60223d07.7a90b4"],"x":195,"y":600,"wires":[["1dcf0f6a.c56e11"]]},{"id":"443634c8.0db14c","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["64625276.d9ab6c"],"x":435,"y":700,"wires":[]},{"id":"20c6ddc0.5295b2","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["64625276.d9ab6c"],"x":455,"y":1100,"wires":[]},{"id":"60223d07.7a90b4","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["64625276.d9ab6c"],"x":595,"y":1380,"wires":[]},{"id":"17db61f7.83807e","type":"python3-function","z":"9dc0cf34.3aae4","name":"Run Routine","func":"import RPi.GPIO as GPIO\nimport time\nimport picamera\nfrom time import sleep\n# Zip-packer\nimport os\nimport shutil\nfrom os import path\nfrom zipfile import ZipFile\nfrom shutil import make_archive\nfrom PIL import Image\nimport sys\n\nfrom zipfile import ZipFile\n\n\n\nwith open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"r\") as file:\n test=file.read()\nif test!=\"no camera found\" and test!=\"--READY--\":\n return\n\n#routine settings\nfotosperrotation=msg['payload']['PhotosPerRotation']\nstartdeflection=msg['payload']['StartDeflection']\nverticalpositions=msg['payload']['VerticalPositions']\nprojectname=msg['payload']['Projectname']\n\n# cam settings\nwith open(\"/home/pi/shared2/log/camera_resolution_x.log\", \"r\") as file:\n resx=int(file.read())\nwith open(\"/home/pi/shared2/log/camera_resolution_y.log\", \"r\") as file:\n resy=int(file.read())\n\n\nwith open(\"/home/pi/shared2/log/pin_rotor_dir.log\", \"r\") as file:\n dirpinrotor=int(file.read())\nwith open(\"/home/pi/shared2/log/pin_rotor_step.log\", \"r\") as file:\n steppinrotor=int(file.read())\nwith open(\"/home/pi/shared2/log/pin_turntable_dir.log\", \"r\") as file:\n dirpintt=int(file.read())\nwith open(\"/home/pi/shared2/log/pin_turntable_step.log\", \"r\") as file:\n steppintt=int(file.read())\nwith open(\"/home/pi/shared2/log/rotor_stepsperrotation.log\", \"r\") as file:\n rotorspr=int(file.read())\nwith open(\"/home/pi/shared2/log/turntable_stepsperrotation.log\", \"r\") as file:\n ttspr=int(file.read()) \nwith open(\"/home/pi/shared2/log/rotor_delay.log\", \"r\") as file:\n delayrotor=float(file.read())\nwith open(\"/home/pi/shared2/log/turntable_delay.log\", \"r\") as file:\n delaytt=float(file.read()) \nwith open(\"/home/pi/shared2/log/turntable_accramp.log\", \"r\") as file:\n ttramp=int(file.read())\nwith open(\"/home/pi/shared2/log/turntable_acc.log\", \"r\") as file:\n ttacc=ttramp*float(file.read()) \nwith open(\"/home/pi/shared2/log/rotor_accramp.log\", \"r\") as file:\n rotorramp=int(file.read())\nwith open(\"/home/pi/shared2/log/rotor_acc.log\", \"r\") as file:\n rotoracc=rotorramp*float(file.read()) \n\nstartangle = rotorspr/360*startdeflection\nprojectcode =time.strftime(\"20%y-%m-%d %H.%M.%S - \")+projectname+'/'\ndirname='./shared2/'+projectcode\nos.makedirs(dirname) \n\nGPIO.setwarnings(False)\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(3, GPIO.OUT)\n\n\n\ndef ttrun(step_count):\n stoptest()\n GPIO.setup(dirpintt, GPIO.OUT)\n GPIO.setup(steppintt, GPIO.OUT)\n if (step_count>0):\n GPIO.output(dirpintt, GPIO.HIGH)\n if(step_count<0):\n GPIO.output(dirpintt, GPIO.LOW)\n step_count=-step_count\n for x in range(step_count):\n GPIO.output(steppintt, GPIO.HIGH)\n if x<=ttramp and x<=step_count/2:\n delay=delaytt+(ttramp-x)*delaytt/ttacc\n elif step_count-x<=ttramp and x>step_count/2:\n delay=delaytt+(ttramp-step_count+x)*delaytt/ttacc\n sleep(delay)\n GPIO.output(steppintt, GPIO.LOW)\n sleep(delay)\n\ndef rotorrun(step_count):\n stoptest()\n GPIO.setup(dirpinrotor, GPIO.OUT)\n GPIO.setup(steppinrotor, GPIO.OUT)\n if (step_count>0):\n GPIO.output(dirpinrotor, GPIO.HIGH)\n if(step_count<0):\n GPIO.output(dirpinrotor, GPIO.LOW)\n step_count=-step_count\n for x in range(step_count):\n GPIO.output(steppinrotor, GPIO.HIGH)\n if x<=rotorramp and x<=step_count/2:\n delay=delayrotor+(rotorramp-x)*delayrotor/rotoracc\n elif step_count-x<=rotorramp and x>step_count/2:\n delay=delayrotor+(rotorramp-step_count+x)*delayrotor/rotoracc\n sleep(delay)\n GPIO.output(steppinrotor, GPIO.LOW)\n sleep(delay)\n\ndef updatepreview():\n with open(\"/home/pi/shared2/log/updatepreview.log\", \"w\") as file:\n file.write(time.strftime(\"20%y-%m-%d_%H-%M-%S\"))\n\ndef stoptest():\n with open(\"/home/pi/shared2/log/stopstate.log\", \"r\") as file:\n if (file.read()!=\"stop\"):\n return\n saveparameters()\n with open(\"/home/pi/shared2/log/stopstate.log\", \"w\") as file:\n file.write(\"ready\")\n stoppp() # let it run into an error ;)\n \n \ndef takephoto():\n stoptest()\n with picamera.PiCamera() as camera:\n with open(\"/home/pi/shared2/log/shutterspeed.log\", \"r\") as file:\n shutterspeed=int(file.read())*100\n camera.iso = 100\n camera.brightness = 50\n camera.contrast = 0\n camera.resolution=(resx, resy)\n camera.exposure_compensation = 0 \n timestamp= time.strftime(\"20%y-%m-%d_%H-%M-%S\")\n filepath = dirname+'/'+ timestamp + \".jpg\"\n sleep(0.7)\n camera.awb_mode = 'auto'\n camera.exposure_mode = 'off'\n camera.shutter_speed = shutterspeed\n camera.capture(filepath, quality=100)\n \n crop(filepath)\n zip(filepath)\n camera.close()\n updatepreview()\n\ndef turntablerotation():\n for x in range (fotosperrotation):\n with open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"w\") as file:\n file.write(\"Position: \"+str(vertpos)+\"/\"+str(verticalpositions)+\" Foto: \"+str(x+1)+\"/\"+str(fotosperrotation))\n if fotosperrotation!=1:\n ttrun(ttspr/fotosperrotation)\n takephoto()\n\ndef saveparameters():\n os.mknod(dirname+\"/parameters.txt\")\n\n cameracontrast=0\n camerabrightness=50\n with open(\"/home/pi/shared2/log/shutterspeed.log\", \"r\") as file:\n shutterspeed=int(file.read())\n with open(\"/home/pi/shared2/log/cropx.log\", \"r\") as file:\n cropx=int(file.read())\n with open(\"/home/pi/shared2/log/cropy.log\", \"r\") as file:\n cropy=int(file.read())\n\n with open(dirname+\"/parameters.txt\", \"w\") as file:\n file.write(\"Settings for OpenScanPi;\\n\")\n file.write(\"projectname;\"+str(projectname)+\"\\n\")\n file.write(\"fotosperrotation;\"+str(fotosperrotation)+\"\\n\")\n file.write(\"startdeflection;\"+str(startdeflection)+\"\\n\")\n file.write(\"verticalpositions;\"+str(verticalpositions)+\"\\n\")\n file.write(\"shutterspeed;\"+str(shutterspeed)+\"\\n\")\n file.write(\"cropx;\"+str(cropx)+\"\\n\")\n file.write(\"cropy;\"+str(cropy)+\"\\n\")\n\n zip(dirname+\"/parameters.txt\")\n\n shutil.move('shared2/temp.zip','shared2/ui/data/zip/'+projectcode[:-1]+'.zip')\n shutil.rmtree(dirname)\n \n with open(\"/home/pi/shared2/log/currentstatus_rpi.log\", \"w\") as file:\n file.write(\"--READY--\")\n\ndef zip(filepath):\n with ZipFile(\"/home/pi/shared2/temp.zip\", \"a\") as zip:\n zip.write(filepath, os.path.basename(filepath))\n os.remove(filepath)\n \ndef crop(filepath):\n with open(\"/home/pi/shared2/log/cropx.log\", \"r\") as file:\n cropx=int(file.read())\n with open(\"/home/pi/shared2/log/cropy.log\", \"r\") as file:\n cropy=int(file.read()) \n img = Image.open(filepath)\n width, height = img.size \n\n left = width*cropy/100\n top = height*cropx/100\n right = width*(100-cropy)/100\n bottom = height*(100-cropx)/100\n img= img.crop((left,top,right,bottom))\n img = img.transpose(Image.ROTATE_90)\n img.save(filepath)\n img = img.transpose(Image.ROTATE_270)\n zoom=min(float(cropx)/50,float(cropy)/50)\n img = img.resize((int(float(1200-24*cropy)/(1-zoom)),int(float(900-18*cropx)/(1-zoom))))\n img = img.transpose(Image.ROTATE_90)\n img.save('./shared2/ui/data/preview.jpg')\n img.close()\n\n\nrotorrun(-startangle)\nfor x in range (verticalpositions-1):\n vertpos = x+1\n turntablerotation()\n if (verticalpositions>1):\n rotorrun(2*startangle/(verticalpositions-1))\nif (verticalpositions==1):\n startangle=-startangle\nvertpos=verticalpositions\nturntablerotation()\n\nrotorrun(-startangle)\n\nsaveparameters()\n\nreturn msg\n","outputs":1,"x":710,"y":1360,"wires":[["5df71560.5080cc"]]},{"id":"5df71560.5080cc","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["35a36b3b.902074","cbe4bd92.d30af","9eafa9a.929b058"],"x":815,"y":1360,"wires":[]},{"id":"af52faaf.33f278","type":"inject","z":"9dc0cf34.3aae4","name":"","topic":"","payload":"Started!","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"1","x":100,"y":1360,"wires":[["9733fa31.d0d5e8"]]},{"id":"743e6924.3983c8","type":"function","z":"9dc0cf34.3aae4","name":"","func":"msg.payload=global.get(\"newpreview\")\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":820,"wires":[["b0406051.835bd"]]},{"id":"b0406051.835bd","type":"python3-function","z":"9dc0cf34.3aae4","name":"","func":"with open(\"/home/pi/shared2/log/updatepreview.log\", \"r\") as file:\n newpreview=file.read()\n\nif msg['payload']==newpreview:\n return\nmsg['payload']=newpreview\nreturn msg","outputs":1,"x":470,"y":820,"wires":[["b1e9143d.19d438"]]},{"id":"b1e9143d.19d438","type":"change","z":"9dc0cf34.3aae4","name":"","rules":[{"t":"set","p":"newpreview","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":820,"wires":[["25263a41.269786"]]},{"id":"385965ee.c7b66a","type":"change","z":"9dc0cf34.3aae4","name":"","rules":[{"t":"set","p":"newpreview","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":220,"wires":[[]]},{"id":"5447bdcd.9e1684","type":"ui_dropdown","z":"67f0d11b.66aa4","name":"","label":"Model","tooltip":"Choose which build version you are using","place":"Choose Model","group":"bb1dd00e.a62b9","order":1,"width":0,"height":0,"passthru":true,"options":[{"label":"OpenScan Mini","value":"OpenScanMini","type":"str"},{"label":"OpenScan","value":"OpenScan","type":"str"}],"payload":"","topic":"","x":450,"y":780,"wires":[["fe9ce51.bd97018"]]},{"id":"468cbf31.112a2","type":"python3-function","z":"67f0d11b.66aa4","name":"load var","func":"with open(\"/home/pi/shared2/log/openscan_model.log\", \"r\") as file:\n model=file.read()\n\nmsg['payload']=model\nreturn msg","outputs":1,"x":300,"y":780,"wires":[["5447bdcd.9e1684"]]},{"id":"fe9ce51.bd97018","type":"python3-function","z":"67f0d11b.66aa4","name":"save var","func":"model=msg['payload']\n\nif model==\"OpenScanMini\":\n with open(\"/home/pi/shared2/log/rotor_stepsperrotation.log\", \"w\") as file:\n file.write(\"48000\")\n with open(\"/home/pi/shared2/log/openscan_model.log\", \"w\") as file:\n file.write(\"OpenScanMini\")\nelif model==\"OpenScan\":\n with open(\"/home/pi/shared2/log/rotor_stepsperrotation.log\", \"w\") as file:\n file.write(\"17067\")\n with open(\"/home/pi/shared2/log/openscan_model.log\", \"w\") as file:\n file.write(\"OpenScan\")","outputs":1,"x":600,"y":780,"wires":[[]]},{"id":"c7dea90b.5b6478","type":"link out","z":"4aee81d.130dd8","name":"","links":["118a6113.30ceef"],"x":1055,"y":400,"wires":[]},{"id":"bda5b333.e3cac","type":"ui_button","z":"4aee81d.130dd8","name":"","group":"ddbd496e.93a288","order":8,"width":0,"height":0,"passthru":false,"label":"Change to Expert GUI","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":120,"y":1140,"wires":[["4a6880f1.ffd86"]]},{"id":"a33a2bcf.e759e8","type":"ui_toast","z":"4aee81d.130dd8","position":"dialog","displayTime":"5","highlight":"","sendall":true,"outputs":1,"ok":"No","cancel":"Yes","raw":false,"topic":"","name":"","x":570,"y":1140,"wires":[["30482cf8.7296e4"]]},{"id":"30482cf8.7296e4","type":"python3-function","z":"4aee81d.130dd8","name":"Download and Install","func":"import os\n\nif msg['payload']!=\"Yes\":\n return\n\nfile = '/home/pi/.node-red/temp'\nurl = 'https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/update.json'\ntry:\n os.remove(file)\nexcept OSError:\n pass\nos.system('wget -O'+file+' '+url+' >/dev/null 2>&1')\n\nsize = os.stat(file).st_size\nif size<1000:\n msg['payload']=\"received not enough data - check internet connection and try again\"\n os.remove(file)\n return None,msg\n\nfile = '/home/pi/.node-red/flows_raspberrypi.json'\nurl = 'https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/update.json'\nos.remove(file)\nos.system('wget -O'+file+' '+url+' >/dev/null 2>&1')\n\nif os.stat(file).st_size!=size:\n msg['payload']=\"wrong filesize - check internet connection and try again\"\n os.remove(file)\n return None,msg\n\nfile= '/home/pi/.node-red/settings_openscan.js'\n\nif os.path.exists(file)==False:\n msg['payload']=\"could not load settings file\"\n return None,msg\nif os.stat(file).st_size==0:\n msg['payload']=\"could not load settings file\"\n return None,msg\n\nos.system('sudo cp /home/pi/.node-red/settings_openscan.js /home/pi/.node-red/settings.js')\nmsg['payload']=\"switching to expert mode (restarting now)\"\nreturn msg","outputs":2,"x":760,"y":1140,"wires":[["86c5ec2e.fef36"],["5cb3f753.4e3b88"]]},{"id":"e331487a.07e798","type":"function","z":"4aee81d.130dd8","name":"t/f","func":"if (msg.payload === true){\n msg.payload=\"Change the User Interface to Expert mode? (SEVERAL AUTOMATIC RESTARTS)\"\n return [msg,null]\n}\nmsg.payload=\"no internet connection\"\nreturn [null,msg]\n","outputs":2,"noerr":0,"x":430,"y":1140,"wires":[["a33a2bcf.e759e8"],["611f2d91.2c4414"]]},{"id":"4a6880f1.ffd86","type":"is online","z":"4aee81d.130dd8","name":"","url":"www.google.com","action":"0","x":300,"y":1140,"wires":[["e331487a.07e798"]]},{"id":"611f2d91.2c4414","type":"link out","z":"4aee81d.130dd8","name":"","links":["51433c54.55af44"],"x":515,"y":1180,"wires":[]},{"id":"5cb3f753.4e3b88","type":"ui_toast","z":"4aee81d.130dd8","position":"dialog","displayTime":"5","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":true,"topic":"","name":"Error handling","x":960,"y":1180,"wires":[[]]},{"id":"86c5ec2e.fef36","type":"ui_toast","z":"4aee81d.130dd8","position":"dialog","displayTime":"5","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":950,"y":1140,"wires":[["2e855701.980d58"]]},{"id":"2e855701.980d58","type":"link out","z":"4aee81d.130dd8","name":"","links":["118a6113.30ceef"],"x":1055,"y":1140,"wires":[]},{"id":"b13c2178.49023","type":"debug","z":"68819360.7e7a7c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":890,"y":460,"wires":[]},{"id":"5387c68d.fbdbd8","type":"ui_button","z":"9dc0cf34.3aae4","name":"reboot","group":"a6b29266.ae242","order":20,"width":2,"height":1,"passthru":false,"label":"","tooltip":"reboot the raspberry pi","color":"","bgcolor":"","icon":"fa-repeat","payload":"","payloadType":"date","topic":"","x":90,"y":1460,"wires":[["b049eb75.c59518"]]},{"id":"12fde73d.92d349","type":"ui_button","z":"9dc0cf34.3aae4","name":"shutdown","group":"a6b29266.ae242","order":19,"width":2,"height":1,"passthru":false,"label":"","tooltip":"shutdown the raspberry pi","color":"","bgcolor":"","icon":"fa-power-off","payload":"","payloadType":"date","topic":"","x":100,"y":1500,"wires":[["ed11f34c.e784"]]},{"id":"b049eb75.c59518","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["118a6113.30ceef"],"x":215,"y":1460,"wires":[]},{"id":"ed11f34c.e784","type":"link out","z":"9dc0cf34.3aae4","name":"","links":["b8ef7981.8e81d8"],"x":215,"y":1500,"wires":[]},{"id":"4db883b3.6e25bc","type":"ui_button","z":"68819360.7e7a7c","name":"","group":"3be89360.d049cc","order":3,"width":10,"height":2,"passthru":false,"label":"INSTALL SIMPLIFIED USER INTERFACE","tooltip":"","color":"","bgcolor":"red","icon":"","payload":"","payloadType":"str","topic":"","x":160,"y":660,"wires":[["1145ee51.912632"]]},{"id":"6d43c5c8.efb60c","type":"ui_toast","z":"68819360.7e7a7c","position":"dialog","displayTime":"5","highlight":"","sendall":true,"outputs":1,"ok":"No","cancel":"Yes","raw":false,"topic":"","name":"","x":870,"y":660,"wires":[["14197a6a.b03f66"]]},{"id":"14197a6a.b03f66","type":"python3-function","z":"68819360.7e7a7c","name":"Download and Install","func":"import os\n\nif msg['payload']!=\"Yes\":\n return\n\nfile = '/home/pi/.node-red/temp'\nurl = 'https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/update_universal.json'\ntry:\n os.remove(file)\nexcept OSError:\n pass\nos.system('wget -O'+file+' '+url+' >/dev/null 2>&1')\n\nsize = os.stat(file).st_size\nif size<1000:\n msg['payload']=\"received not enough data - check internet connection and try again\"\n os.remove(file)\n return None,msg\n\nfile1 = '/home/pi/.node-red/temp2'\nos.system('wget -O'+file1+' '+url+' >/dev/null 2>&1')\n\nif os.stat(file1).st_size!=size:\n msg['payload']=\"wrong filesize - check internet connection and try again\"\n os.remove(file1)\n return None,msg\n\nos.system('sudo cp /home/pi/.node-red/temp2 /home/pi/.node-red/flows_raspberrypi.json')\nos.remove(file)\nos.remove(file1)\n\nfile= '/home/pi/.node-red/settings_openscan.js'\n\nif os.path.exists(file)==False:\n msg['payload']=\"could not load settings file\"\n return None,msg\nif os.stat(file).st_size==0:\n msg['payload']=\"could not load settings file\"\n return None,msg\n\nos.system('sudo cp /home/pi/.node-red/settings_openscan.js /home/pi/.node-red/settings.js')\n\n\nmsg['payload']=\"Restarting now, please be patient, this will take 3-5min :)\"\nreturn msg","outputs":2,"x":1061,"y":660,"wires":[["a5f58c8c.d5c69","a9a7c713.2e51b8"],["813c6de5.9aad2"]]},{"id":"2d0dbea9.816d82","type":"function","z":"68819360.7e7a7c","name":"t/f","func":"if (msg.payload === true){\n msg.payload=\"Install new Firmware? (SEVERAL AUTOMATIC RESTARTS)\"\n return [msg,null]\n}\nmsg.payload=\"no internet connection\"\nreturn [null,msg]\n","outputs":2,"noerr":0,"x":530,"y":660,"wires":[["dc44ab64.af7798"],["62f44ebe.150c7"]]},{"id":"1145ee51.912632","type":"is online","z":"68819360.7e7a7c","name":"","url":"www.google.com","action":"0","x":400,"y":660,"wires":[["2d0dbea9.816d82"]]},{"id":"62f44ebe.150c7","type":"link out","z":"68819360.7e7a7c","name":"","links":["51433c54.55af44"],"x":635,"y":720,"wires":[]},{"id":"813c6de5.9aad2","type":"ui_toast","z":"68819360.7e7a7c","position":"dialog","displayTime":"5","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":true,"topic":"","name":"Error handling","x":1260,"y":700,"wires":[[]]},{"id":"a5f58c8c.d5c69","type":"ui_toast","z":"68819360.7e7a7c","position":"dialog","displayTime":"5","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":1250,"y":660,"wires":[[]]},{"id":"a9a7c713.2e51b8","type":"link out","z":"68819360.7e7a7c","name":"","links":["118a6113.30ceef"],"x":1195,"y":620,"wires":[]},{"id":"c7a68561.871f68","type":"python3-function","z":"68819360.7e7a7c","name":"install node-red-module + increase gpu","func":"import os\n\npath=\"/home/pi/.node-red/node_modules/node-red-node-ui-table\"\n\nif(os.path.exists(path)==False):\n os.system(\"cd /home/pi/.node-red && npm i node-red-node-ui-table\")\n os.system(\"node-red-restart\")\nelse:\n pass\n\nif os.popen('vcgencmd get_mem gpu').read()[0:8]!=\"gpu=256M\":\n os.system(\"sudo sed -i -e 's/gpu_mem=128/gpu_mem=256/g' /boot/config.txt\")\n os.system(\"reboot -h\")","outputs":1,"x":571,"y":600,"wires":[[]]},{"id":"dc44ab64.af7798","type":"python3-function","z":"68819360.7e7a7c","name":"check module","func":"import os\n\npath=\"/home/pi/.node-red/node_modules/node-red-node-ui-table\"\n\nif(os.path.exists(path)==False):\n msg['payload']=\"dependencies are missing, installing now. (Internet Connection required)\"\n return None,msg\nelse:\n return msg,None","outputs":2,"x":700,"y":660,"wires":[["6d43c5c8.efb60c"],["5a22fa84.278f84","ad633a56.5cede8"]]},{"id":"5a22fa84.278f84","type":"python3-function","z":"68819360.7e7a7c","name":"install","func":"import os\nos.system(\"cd /home/pi/.node-red && npm i node-red-node-ui-table\")\nos.system(\"node-red-restart\")","outputs":1,"x":850,"y":700,"wires":[[]]},{"id":"ad633a56.5cede8","type":"ui_toast","z":"68819360.7e7a7c","position":"dialog","displayTime":"5","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":870,"y":740,"wires":[[]]},{"id":"d694fa43.d3ed38","type":"inject","z":"68819360.7e7a7c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":90,"y":600,"wires":[["bdba6592.487678"]]},{"id":"89c23de4.e1be3","type":"ui_template","z":"68819360.7e7a7c","group":"3be89360.d049cc","name":"","order":2,"width":10,"height":7,"format":" <div class=\"center\" style=\"text-align: center\">\n<h2>Major Update</h2>\n<b><span style=\"color:red\"> -- highly recommended :) --</span></b>\n\n</div>\n<br /> There is a new firmware, which has been improved in many ways:\n<ul>\n<li>routine is 50-70% faster</li>\n<li>interface is more stable</li>\n<li>better image quality</li>\n<li>...</li>\n<li>Changelog at <a href=\"https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/update_universal.log\" target=\"_blank\">Github</a></li>\n</ul>\n<b><span style=\"color:red\">There won't be any future update to your current firmware, so it is highly recommended to switch to the new Firmware by pressing the button below:</span></b>\n","storeOutMessages":true,"fwdInMessages":false,"templateScope":"local","x":100,"y":720,"wires":[[]]},{"id":"bdba6592.487678","type":"python3-function","z":"68819360.7e7a7c","name":"create new files + content","func":"import os.path\nfrom time import sleep\n\nflag=False\n\ndef new_file(filepath,content):\n if os.path.isfile(filepath):\n if os.stat(filepath).st_size==0:\n with open(filepath, \"w\") as file:\n file.write(content)\n flag=True\n else:\n pass\n else:\n with open(filepath, \"w\") as file:\n file.write(content)\n flag=True\n\nnew_file('/home/pi/shared/log/autoupdatestate.log',\"true\")\nnew_file('/home/pi/shared/log/camera.log',\"External Camera\")\nnew_file('/home/pi/shared/log/camera_resolution_x.log',\"3280\")\nnew_file('/home/pi/shared/log/camera_resolution_y.log',\"2464\")\nnew_file('/home/pi/shared/log/camerabrightness.log',\"50\")\nnew_file('/home/pi/shared/log/cameracontrast.log',\"0\")\nnew_file('/home/pi/shared/log/cropx.log',\"0\")\nnew_file('/home/pi/shared/log/cropx_gp.log',\"0\")\nnew_file('/home/pi/shared/log/cropy.log',\"0\")\nnew_file('/home/pi/shared/log/cropy_gp.log',\"0\")\nnew_file('/home/pi/shared/log/currentserverversion.log',\"1;\")\nnew_file('/home/pi/shared/log/currentstatus_ext.log',\"--READY--\")\nnew_file('/home/pi/shared/log/currentstatus_gp.log',\"no camera found\")\nnew_file('/home/pi/shared/log/currentstatus_rpi.log',\"--READY--\")\nnew_file('/home/pi/shared/log/currentversion.log',\"1\")\nnew_file('/home/pi/shared/log/experimentalmode.log',\"false\")\nnew_file('/home/pi/shared/log/fotosperrotation.log',\"1\")\nnew_file('/home/pi/shared/log/hotspot_angle.log',\"5\")\nnew_file('/home/pi/shared/log/hotspot_photos.log',\"5\")\nnew_file('/home/pi/shared/log/loadsettings.log',\"1;\")\nnew_file('/home/pi/shared/log/loadsettings_save.log',\"1;\")\nnew_file('/home/pi/shared/log/picamera_activation.log',\"true\")\nnew_file('/home/pi/shared/log/pin_externalcam.log',\"10\")\nnew_file('/home/pi/shared/log/pin_ringlight1.log',\"17\")\nnew_file('/home/pi/shared/log/pin_ringlight2.log',\"27\")\nnew_file('/home/pi/shared/log/pin_rotor_dir.log',\"5\")\nnew_file('/home/pi/shared/log/pin_rotor_step.log',\"6\")\nnew_file('/home/pi/shared/log/pin_turntable_dir.log',\"9\")\nnew_file('/home/pi/shared/log/pin_turntable_step.log',\"11\")\nnew_file('/home/pi/shared/log/projectname.log',\"default\")\nnew_file('/home/pi/shared/log/ringlightstatus1.log',\"10\")\nnew_file('/home/pi/shared/log/ringlightstatus2.log',\"10\")\nnew_file('/home/pi/shared/log/releasetime_ext.log',\"10\")\nnew_file('/home/pi/shared/log/rotor_acc.log',\"1\")\nnew_file('/home/pi/shared/log/rotor_accramp.log',\"200\")\nnew_file('/home/pi/shared/log/rotor_angle.log',\"5\")\nnew_file('/home/pi/shared/log/rotor_delay.log',\"0.0005\")\nnew_file('/home/pi/shared/log/rotor_stepsperrotation.log',\"17067\")\nnew_file('/home/pi/shared/log/samba.log',\"true\")\nnew_file('/home/pi/shared/log/shutterspeed.log',\"300\")\nnew_file('/home/pi/shared/log/ssh.log',\"true\")\nnew_file('/home/pi/shared/log/startdeflection.log',\"0\")\nnew_file('/home/pi/shared/log/stopstate.log',\"run\")\nnew_file('/home/pi/shared/log/stopstate_ext.log',\"run\")\nnew_file('/home/pi/shared/log/stopstate_gp.log',\"run\")\nnew_file('/home/pi/shared/log/timeperfoto_ext.log',\"0.5\")\nnew_file('/home/pi/shared/log/turntable_acc.log',\"1\")\nnew_file('/home/pi/shared/log/turntable_accramp.log',\"200\")\nnew_file('/home/pi/shared/log/turntable_angle.log',\"10\")\nnew_file('/home/pi/shared/log/turntable_delay.log',\"0.0005\")\nnew_file('/home/pi/shared/log/turntable_stepsperrotation.log',\"3200\")\nnew_file('/home/pi/shared/log/updatepreview.log',\"start\")\nnew_file('/home/pi/shared/log/updatepreview_gp.log',\"1\")\nnew_file('/home/pi/shared/log/verticalpositions.log',\"1\")\nnew_file('/home/pi/shared/log/zoom.log',\"1\")\nnew_file('/home/pi/shared/ui/data/update.log',\"1\")\nnew_file('/home/pi/shared/log/manual_en.log',\"1\")\nnew_file('/home/pi/shared/log/manual_en_new.log',\"1\")\nnew_file('/home/pi/shared/log/email.log',\"\")\nnew_file('/home/pi/shared/log/feedback_status.log',\"\")\nnew_file('/home/pi/shared/log/feedback_terms.log',\"False\")\nnew_file(\"/home/pi/shared/log/openscan_model.log\",\"none\")\nnew_file(\"/home/pi/shared/log/awb_red.log\",\"1.7\")\nnew_file(\"/home/pi/shared/log/awb_blue.log\",\"1.7\")\nnew_file(\"/home/pi/shared/log/angle_min.log\",\"-20\")\nnew_file(\"/home/pi/shared/log/angle_max.log\",\"90\")\nnew_file(\"/home/pi/shared/log/preview.log\",\"True\")\nnew_file(\"/home/pi/shared/log/startangle.log\",\"0\")\nnew_file(\"/home/pi/shared/log/delay_ext.log\",\"1200\")\nnew_file(\"/home/pi/shared/log/camera_type.log\",\"v2\")\n\nreturn msg","outputs":1,"x":290,"y":600,"wires":[["c7a68561.871f68"]]}]