[{"id":"6012f43d.3d744c","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"445859f1.7f13d8","type":"tab","label":"IP Settings","disabled":false,"info":""},{"id":"1d1d161c.cbf57a","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"601138f4.05b298","type":"ui_group","z":"","name":"CAS01-B04-SA","tab":"1047620.d0ce69e","disp":true,"width":"3","collapse":false},{"id":"fc229a2f.fbb478","type":"ui_group","z":"","name":"BOLARDO 2","tab":"1047620.d0ce69e","disp":true,"width":"3","collapse":false},{"id":"7ddc802a.50d08","type":"ui_group","z":"","name":"BOLARDO 3","tab":"1047620.d0ce69e","disp":true,"width":"3","collapse":false},{"id":"d776ad51.c2161","type":"ui_group","z":"","name":"CTRL GLOBAL","tab":"1047620.d0ce69e","disp":true,"width":"3","collapse":false},{"id":"1047620.d0ce69e","type":"ui_tab","z":"","name":"CONTROLADORA IAIJM-01 - CASETA 01","icon":"dashboard","order":2,"disabled":false,"hidden":false},{"id":"4c2e3d7b.2df844","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"},"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":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"8c1aa857.edbd78","type":"ui_group","z":"","name":"Col1","tab":"","order":1,"disp":false,"width":"6"},{"id":"e23bb181.b33fd","type":"ui_group","z":"","name":"ACCIONES","tab":"","order":4,"disp":true,"width":"6","collapse":false},{"id":"a0181ee0.e720f","type":"ui_group","z":"","name":"Col2","tab":"","order":2,"disp":false,"width":"6"},{"id":"a0bb76b8.952728","type":"ui_group","z":"","name":"Col3","tab":"","order":3,"disp":false,"width":"6","collapse":false},{"id":"142c87de.d23ec8","type":"ui_group","z":"","name":"IP ADDRESS:","tab":"","order":5,"disp":true,"width":"6","collapse":false},{"id":"9e8b745c.f6e1a8","type":"ui_group","z":"","name":"IP Settings","tab":"79319f78.917f","disp":true,"width":"6","collapse":false},{"id":"79319f78.917f","type":"ui_tab","z":"","name":"Settings","icon":"settings","order":3},{"id":"195d5036.9fe22","type":"ui_group","z":"","name":"Col1","tab":"b684c649.1094a8","order":1,"disp":false,"width":"6"},{"id":"8b0d0245.3a3af","type":"ui_group","z":"","name":"ACCIONES","tab":"b684c649.1094a8","order":4,"disp":true,"width":"6","collapse":false},{"id":"c63d4b1c.580a58","type":"ui_group","z":"","name":"Col2","tab":"b684c649.1094a8","order":2,"disp":false,"width":"6"},{"id":"54a093c8.2d264c","type":"ui_group","z":"","name":"Col3","tab":"b684c649.1094a8","order":3,"disp":false,"width":"6","collapse":false},{"id":"d1d4a477.ce4738","type":"ui_group","z":"","name":"IP ADDRESS:","tab":"b684c649.1094a8","order":5,"disp":true,"width":"6","collapse":false},{"id":"b684c649.1094a8","type":"ui_tab","z":"","name":"RPi Control CPU 2 MODEL B c/d","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"1f7843c2.050fbc","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"cc873a42.d1dce8","type":"mqtt-broker","z":"","name":"IAIJM01","broker":"10.70.37.220","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"9bd7559f.051158","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"982d3346.30078","type":"ui_group","z":"","name":"CAS01-B04-SA","tab":"","order":4,"disp":true,"width":"3","collapse":false},{"id":"796fdaa7.8b9c04","type":"ui_template","z":"6012f43d.3d744c","group":"601138f4.05b298","name":"BOLARDO 1","order":0,"width":"0","height":"0","format":"\n\n
\n\n\n\n
\n\n\n \n
\n","storeOutMessages":true,"fwdInMessages":false,"templateScope":"local","x":347.44446563720703,"y":136.00000190734863,"wires":[["370ca71a.c43df8"]]},{"id":"932ebdce.83dc9","type":"ui_template","z":"6012f43d.3d744c","group":"fc229a2f.fbb478","name":"BOLARDO 2","order":0,"width":0,"height":0,"format":"\n\n\n\n\n\n
\n\n\n \n
\n\n\n\n","storeOutMessages":true,"fwdInMessages":false,"templateScope":"local","x":345,"y":254,"wires":[["f50f6128.e18dd"]]},{"id":"72374cb3.c39374","type":"ui_template","z":"6012f43d.3d744c","group":"7ddc802a.50d08","name":"BOLARDO 3","order":1,"width":0,"height":0,"format":"\n\n\n\n\n\n
\n\n\n \n
\n\n\n\n\n","storeOutMessages":true,"fwdInMessages":false,"templateScope":"local","x":335,"y":374,"wires":[["be0c217d.9d0b3"]]},{"id":"cf14ca1c.6786f8","type":"rpi-gpio out","z":"6012f43d.3d744c","name":"B1 BAJAR","pin":"33","set":true,"level":"1","freq":"","out":"out","x":923,"y":96,"wires":[]},{"id":"7020da50.b98314","type":"rpi-gpio out","z":"6012f43d.3d744c","name":"B1 SUBIR","pin":"36","set":true,"level":"1","freq":"","out":"out","x":915,"y":174,"wires":[]},{"id":"31fa929e.3a851e","type":"rpi-gpio out","z":"6012f43d.3d744c","name":"B2 SUBIR","pin":"38","set":true,"level":"1","freq":"","out":"out","x":883,"y":296,"wires":[]},{"id":"ecde89a5.04d658","type":"rpi-gpio out","z":"6012f43d.3d744c","name":"B2 BAJAR 2","pin":"35","set":true,"level":"1","freq":"","out":"out","x":903,"y":236,"wires":[]},{"id":"5e41558e.c8623c","type":"rpi-gpio out","z":"6012f43d.3d744c","name":"B3 BAJAR","pin":"37","set":true,"level":"1","freq":"","out":"out","x":895,"y":374,"wires":[]},{"id":"a27fd6ab.f59868","type":"rpi-gpio out","z":"6012f43d.3d744c","name":"B3 SUBIR","pin":"40","set":true,"level":"1","freq":"","out":"out","x":905,"y":434,"wires":[]},{"id":"8a7b9290.97a13","type":"rpi-gpio in","z":"6012f43d.3d744c","name":"B1","pin":"29","intype":"up","debounce":"100","read":true,"x":136.11112594604492,"y":136.22221755981445,"wires":[["796fdaa7.8b9c04","cd383eff.3c5e7"]]},{"id":"f128361e.253058","type":"trigger","z":"6012f43d.3d744c","op1":"false","op2":"true","op1type":"bool","op2type":"bool","duration":"1","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":713,"y":96,"wires":[["cf14ca1c.6786f8"]]},{"id":"ba07412d.67a7f","type":"trigger","z":"6012f43d.3d744c","op1":"false","op2":"true","op1type":"bool","op2type":"bool","duration":"1","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":715,"y":174,"wires":[["7020da50.b98314"]]},{"id":"370ca71a.c43df8","type":"switch","z":"6012f43d.3d744c","name":"SWITCH B1","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":533,"y":136,"wires":[["f128361e.253058"],["ba07412d.67a7f"]]},{"id":"f50f6128.e18dd","type":"switch","z":"6012f43d.3d744c","name":"SWITCH B2","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":535,"y":254,"wires":[["69a320d7.4c608"],["e5303316.acc93"]]},{"id":"69a320d7.4c608","type":"trigger","z":"6012f43d.3d744c","op1":"false","op2":"true","op1type":"bool","op2type":"bool","duration":"1","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":725,"y":234,"wires":[["ecde89a5.04d658"]]},{"id":"e5303316.acc93","type":"trigger","z":"6012f43d.3d744c","op1":"false","op2":"true","op1type":"bool","op2type":"bool","duration":"1","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":705,"y":294,"wires":[["31fa929e.3a851e"]]},{"id":"be0c217d.9d0b3","type":"switch","z":"6012f43d.3d744c","name":"SWITCH B3","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":515,"y":374,"wires":[["9986978a.68d318"],["a430ae9d.41e"]]},{"id":"9986978a.68d318","type":"trigger","z":"6012f43d.3d744c","op1":"false","op2":"true","op1type":"bool","op2type":"bool","duration":"1","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":705,"y":374,"wires":[["5e41558e.c8623c"]]},{"id":"a430ae9d.41e","type":"trigger","z":"6012f43d.3d744c","op1":"false","op2":"true","op1type":"bool","op2type":"bool","duration":"1","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":705,"y":434,"wires":[["a27fd6ab.f59868"]]},{"id":"f647b6ae.316738","type":"rpi-gpio in","z":"6012f43d.3d744c","name":"B2","pin":"31","intype":"tri","debounce":"25","read":true,"x":147.22222518920898,"y":253.99998664855957,"wires":[["932ebdce.83dc9","b3a28f71.29d97"]]},{"id":"e598ab2d.93b778","type":"rpi-gpio in","z":"6012f43d.3d744c","name":"B3","pin":"32","intype":"tri","debounce":"25","read":true,"x":147.22222900390625,"y":372.88887786865234,"wires":[["72374cb3.c39374","c74249f3.019028"]]},{"id":"f4ebc01d.b283f","type":"ui_switch","z":"6012f43d.3d744c","name":"","label":"OFF / ON","tooltip":"","group":"d776ad51.c2161","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"2","onvalueType":"num","onicon":"","oncolor":"","offvalue":"1","offvalueType":"num","officon":"","offcolor":"","x":407.8888626098633,"y":72.00002002716064,"wires":[["370ca71a.c43df8","f50f6128.e18dd","be0c217d.9d0b3"]]},{"id":"1b5bd5d.586232a","type":"exec","z":"445859f1.7f13d8","command":"cat /etc/dhcpcd.conf","addpay":false,"append":"","useSpawn":"","timer":"","name":"","x":476,"y":179,"wires":[["40e7109c.0661b"],[],[]]},{"id":"40e7109c.0661b","type":"function","z":"445859f1.7f13d8","name":"parse response","func":"var lines = msg.payload.split(\"\\n\");\nvar data = [];\n\nfor(var i=0; i< lines.length; i++){\n if(lines[i].indexOf(\"interface eth0\") != -1)\n break;\n}\n\n//check if interface eth0 is disabled\nif(i < lines.length && lines[i].indexOf(\"#\") >= 0) flow.set('disabled', true);\nelse flow.set('disabled', false);\n\nnode.send({topic:'interface eth0', payload:flow.get('disabled')})\n\ni++;\n\nfor(i; i< lines.length; i++){\n \n //new interface, not eth0\n if(lines[i].indexOf(\"static\") == -1)\n break;\n \n var tmp = lines[i].split(\"=\");\n if(tmp.length==2){\n var prop = tmp[0].split(' ')[1].trim();\n var value = tmp[1].trim();\n \n flow.set(prop, value);\n node.send({topic:prop, payload:value})\n }\n} ","outputs":1,"noerr":0,"x":716,"y":166,"wires":[["7c183c89.8abdb4"]]},{"id":"7c183c89.8abdb4","type":"switch","z":"445859f1.7f13d8","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"ip_address","vt":"str"},{"t":"eq","v":"routers","vt":"str"},{"t":"eq","v":"domain_name_servers","vt":"str"},{"t":"eq","v":"interface eth0","vt":"str"}],"checkall":"false","repair":false,"outputs":4,"x":888,"y":166,"wires":[["e964c4a5.619698"],["e85ef157.5d59"],["f450a1f3.39a01","fed3d212.f346e"],["d3c75203.809c6"]]},{"id":"e964c4a5.619698","type":"ui_text_input","z":"445859f1.7f13d8","name":"ip_address","label":"Indirizzo IP","group":"9e8b745c.f6e1a8","order":2,"width":0,"height":0,"passthru":false,"mode":"text","delay":"0","topic":"ip_address","x":1130,"y":120,"wires":[["7cfb93b0.63d4dc"]]},{"id":"e85ef157.5d59","type":"ui_text_input","z":"445859f1.7f13d8","name":"router","label":"Router","group":"9e8b745c.f6e1a8","order":3,"width":0,"height":0,"passthru":false,"mode":"text","delay":"0","topic":"routers","x":1109,"y":163,"wires":[["7cfb93b0.63d4dc"]]},{"id":"f450a1f3.39a01","type":"ui_text_input","z":"445859f1.7f13d8","name":"dns","label":"DNS","group":"9e8b745c.f6e1a8","order":4,"width":0,"height":0,"passthru":false,"mode":"text","delay":"0","topic":"domain_name_servers","x":1109,"y":206,"wires":[["7cfb93b0.63d4dc"]]},{"id":"7f9a5ace.412ee4","type":"exec","z":"445859f1.7f13d8","command":"sudo sed -i ","addpay":true,"append":"","useSpawn":"","timer":"","oldrc":false,"name":"","x":510,"y":320,"wires":[[],[],[]]},{"id":"9911cfee.6bd8","type":"ui_button","z":"445859f1.7f13d8","name":"reboot","group":"9e8b745c.f6e1a8","order":5,"width":"3","height":"1","passthru":false,"label":"Reboot","color":"","bgcolor":"","icon":"","payload":"By pressing OK the device will be rebooted. If settings are wrong this may cause the device to be unreachable","payloadType":"str","topic":"","x":170,"y":480,"wires":[["4530f038.e3fd9"]]},{"id":"1035a5ef.ed8a4a","type":"exec","z":"445859f1.7f13d8","command":"sudo reboot","addpay":false,"append":"","useSpawn":"","timer":"","name":"","x":650,"y":480,"wires":[[],[],[]]},{"id":"7148fbd9.506524","type":"ui_button","z":"445859f1.7f13d8","name":"refresh","group":"9e8b745c.f6e1a8","order":6,"width":"3","height":"1","passthru":false,"label":"Update","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":111.44442749023438,"y":247.33291149139404,"wires":[["e0630d03.be83f","42d9dcc8.73a484"]]},{"id":"e0630d03.be83f","type":"delay","z":"445859f1.7f13d8","name":"","pauseType":"delay","timeout":"300","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":278.8888740539551,"y":247.44451141357422,"wires":[["1b5bd5d.586232a"]]},{"id":"42d9dcc8.73a484","type":"function","z":"445859f1.7f13d8","name":"send commands","func":"var properties = flow.get(\"properties\");\n\nvar disabled = flow.get(\"disabled\") ? '#' : '';\n\nif(disabled == '#'){\n //enable interface (replace only first occurance)\n var command = `'0,/#interface eth0/s//interface eth0/g;' /etc/dhcpcd.conf`;\n node.send({payload: command})\n}\n\nfor(var i=0;i