[{"id":"ea0b6e5d.23037","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"9572dd9e.2697d","type":"subflow","name":"Settings","info":"Persist settings in a flat file.\n\nIf msg.clearAll is set to true, the settings are truncated.\n\nSending a topic of \"get\" will return the property you've named in the payload.\n\nAny other topic will be treated as a property and the payload will be saved to the settings file.","in":[{"x":40,"y":220,"wires":[{"id":"688a2b3a.7c78f4"}]}],"out":[{"x":380,"y":160,"wires":[{"id":"688a2b3a.7c78f4","port":0}]}]},{"id":"22f6bd43.b76d12","type":"subflow","name":"Settings (2)","info":"Persist settings in a flat file.\n\nIf msg.clearAll is set to true, the settings are truncated.\n\nSending a topic of \"get\" will return the property you've named in the payload.\n\nAny other topic will be treated as a property and the payload will be saved to the settings file.","in":[{"x":40,"y":220,"wires":[{"id":"6cd3ca2f.e2f144"}]}],"out":[{"x":380,"y":160,"wires":[{"id":"6cd3ca2f.e2f144","port":0}]}]},{"id":"9f4d27a8.d62958","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"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":"27e55848.84c818","type":"ui_group","z":"","name":"Moisture","tab":"8b67ba17.228828","order":2,"disp":true,"width":"7","collapse":false},{"id":"8c05834b.134d4","type":"ui_tab","z":"","name":"Data liste","icon":"dashboard"},{"id":"b213a760.16b838","type":"ui_group","z":"","name":"Chart for moisture","tab":"8b67ba17.228828","order":1,"disp":true,"width":"6","collapse":false},{"id":"ce99e397.9ada5","type":"ui_group","z":"","name":"Data liste","tab":"8c05834b.134d4","order":2,"disp":true,"width":"7","collapse":false},{"id":"7c0ba445.8353ec","type":"ui_group","z":"","name":"Data liste","tab":"8c05834b.134d4","order":3,"disp":true,"width":"7","collapse":false},{"id":"dfb54652.87e688","type":"serial-port","z":"","serialport":"COM3","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","newline":"0","bin":"bin","out":"time","addchar":false,"responsetimeout":""},{"id":"8b67ba17.228828","type":"ui_tab","z":"","name":"Data liste","icon":"dashboard"},{"id":"18f1d110.03d4af","type":"MySQLdatabase","z":"","host":"127.0.0.1","port":"3306","db":"nodered","tz":"+2"},{"id":"d602e943.26bee8","type":"file in","z":"9572dd9e.2697d","name":"","filename":"persist/settings.json","format":"utf8","chunk":false,"sendError":true,"x":360,"y":60,"wires":[["6c4c1f33.20c25"]]},{"id":"6c4c1f33.20c25","type":"switch","z":"9572dd9e.2697d","name":"","property":"error","propertyType":"msg","rules":[{"t":"nnull"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":60,"wires":[["9362e1ee.e7fc7"],["5be9074f.a69cb8"]]},{"id":"eaa032f3.e9282","type":"file","z":"9572dd9e.2697d","name":"","filename":"persist/settings.json","appendNewline":false,"createDir":true,"overwriteFile":"false","x":1080,"y":40,"wires":[[]]},{"id":"819ef003.3ff4a","type":"json","z":"9572dd9e.2697d","name":"","property":"payload","action":"str","pretty":false,"x":390,"y":260,"wires":[["c1c9805.e12c38"]]},{"id":"8f03360a.fb6728","type":"inject","z":"9572dd9e.2697d","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":90,"y":60,"wires":[["d602e943.26bee8"]]},{"id":"8db6d4fb.2b7328","type":"change","z":"9572dd9e.2697d","name":"","rules":[{"t":"set","p":"persistant_settings","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1120,"y":100,"wires":[[]]},{"id":"5be9074f.a69cb8","type":"json","z":"9572dd9e.2697d","name":"","property":"payload","action":"","pretty":false,"x":930,"y":100,"wires":[["8db6d4fb.2b7328"]]},{"id":"688a2b3a.7c78f4","type":"function","z":"9572dd9e.2697d","name":"","func":"if(msg.clearAll === true){\n flow.set('persistant_settings', {});\n return [msg, {payload: {}}];\n}\n\nvar settings = flow.get('persistant_settings') || {};\n\nif(msg.topic == 'get'){\n msg.payload = settings[msg.payload] || null;\n return [msg, null]\n}else{\n settings[msg.topic] = msg.payload;\n flow.set('persistant_settings', settings);\n return [msg, {payload: settings}];\n}","outputs":2,"noerr":0,"x":210,"y":220,"wires":[[],["819ef003.3ff4a"]]},{"id":"c1c9805.e12c38","type":"file","z":"9572dd9e.2697d","name":"","filename":"persist/settings.json","appendNewline":false,"createDir":true,"overwriteFile":"true","x":620,"y":260,"wires":[[]]},{"id":"9362e1ee.e7fc7","type":"change","z":"9572dd9e.2697d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":20,"wires":[["eaa032f3.e9282","5be9074f.a69cb8"]]},{"id":"bdef907d.418ed","type":"file in","z":"22f6bd43.b76d12","name":"","filename":"persist/settings.json","format":"utf8","chunk":false,"sendError":true,"x":360,"y":60,"wires":[["ab7a52.e4d245b"]]},{"id":"ab7a52.e4d245b","type":"switch","z":"22f6bd43.b76d12","name":"","property":"error","propertyType":"msg","rules":[{"t":"nnull"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":60,"wires":[["ee11f828.7243d8"],["ec096fc1.d945a"]]},{"id":"2f5b5422.69d49c","type":"file","z":"22f6bd43.b76d12","name":"","filename":"persist/settings.json","appendNewline":false,"createDir":true,"overwriteFile":"false","x":1080,"y":40,"wires":[[]]},{"id":"9b243676.4b77a8","type":"json","z":"22f6bd43.b76d12","name":"","property":"payload","action":"str","pretty":false,"x":390,"y":260,"wires":[["84f817ef.f793d8"]]},{"id":"f8758464.f9ab18","type":"inject","z":"22f6bd43.b76d12","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":90,"y":60,"wires":[["bdef907d.418ed"]]},{"id":"9ac53d8b.1c7e1","type":"change","z":"22f6bd43.b76d12","name":"","rules":[{"t":"set","p":"persistant_settings","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1120,"y":100,"wires":[[]]},{"id":"ec096fc1.d945a","type":"json","z":"22f6bd43.b76d12","name":"","property":"payload","action":"","pretty":false,"x":930,"y":100,"wires":[["9ac53d8b.1c7e1"]]},{"id":"6cd3ca2f.e2f144","type":"function","z":"22f6bd43.b76d12","name":"","func":"if(msg.clearAll === true){\n flow.set('persistant_settings', {});\n return [msg, {payload: {}}];\n}\n\nvar settings = flow.get('persistant_settings') || {};\n\nif(msg.topic == 'get'){\n msg.payload = settings[msg.payload] || null;\n return [msg, null]\n}else{\n settings[msg.topic] = msg.payload;\n flow.set('persistant_settings', settings);\n return [msg, {payload: settings}];\n}","outputs":2,"noerr":0,"x":210,"y":220,"wires":[[],["9b243676.4b77a8"]]},{"id":"84f817ef.f793d8","type":"file","z":"22f6bd43.b76d12","name":"","filename":"persist/settings.json","appendNewline":false,"createDir":true,"overwriteFile":"true","x":620,"y":260,"wires":[[]]},{"id":"ee11f828.7243d8","type":"change","z":"22f6bd43.b76d12","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":20,"wires":[["2f5b5422.69d49c","ec096fc1.d945a"]]},{"id":"215de48d.c56fcc","type":"serial in","z":"ea0b6e5d.23037","name":"COM3","serial":"dfb54652.87e688","x":70,"y":180,"wires":[["6de47da8.a07904","bf940ee8.63976","2bd2ca42.78d4c6"]]},{"id":"6de47da8.a07904","type":"function","z":"ea0b6e5d.23037","name":"Moisture","func":"var var1 = {topic: \"Moisture\"[0]};\nreturn [var1];","outputs":1,"noerr":0,"x":240,"y":260,"wires":[["1667f7a9.c70b68","cfd613d3.217d4"]]},{"id":"1667f7a9.c70b68","type":"ui_gauge","z":"ea0b6e5d.23037","name":"","group":"27e55848.84c818","order":0,"width":"6","height":"5","gtype":"gage","title":"","label":"%","format":"{{value}}%","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":450,"y":220,"wires":[]},{"id":"cfd613d3.217d4","type":"debug","z":"ea0b6e5d.23037","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":470,"y":260,"wires":[]},{"id":"4d41557d.fe874c","type":"ui_button","z":"ea0b6e5d.23037","name":"","group":"ce99e397.9ada5","order":0,"width":0,"height":0,"passthru":false,"label":"Update","tooltip":"","color":"","bgcolor":"red","icon":"","payload":"","payloadType":"str","topic":"SELECT * FROM nodered.node","x":100,"y":360,"wires":[["466d96b8.52fa88"]]},{"id":"466d96b8.52fa88","type":"mysql","z":"ea0b6e5d.23037","mydb":"18f1d110.03d4af","name":"","x":320,"y":360,"wires":[["c9bba283.0a22e","ba9bf29c.8305a"]]},{"id":"c9bba283.0a22e","type":"ui_template","z":"ea0b6e5d.23037","group":"7c0ba445.8353ec","name":"","order":0,"width":"7","height":"3","format":"\n\n\n\n\n\n\n\n
Index TimeMoisture
{{$index}}{{msg.payload[$index].time}}{{msg.payload[$index].moisture}}%
","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":480,"y":320,"wires":[[]]},{"id":"ba9bf29c.8305a","type":"debug","z":"ea0b6e5d.23037","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":490,"y":360,"wires":[]},{"id":"8215d9fa.be46d8","type":"function","z":"ea0b6e5d.23037","name":"Sending data","func":"var mlevel = data[0];\nvar out = \"INSERT INTO nodered.node (time,mlevel) VALUES('\"+new Date().toString().slice(0,19).replace('T', ' ')\",\"+mlevel;\nmsg.topic = out;\nreturn msg;\n","outputs":1,"noerr":0,"x":370,"y":100,"wires":[["40c5e77.e908918","6f06ca79.f745b4"]]},{"id":"40c5e77.e908918","type":"mysql","z":"ea0b6e5d.23037","mydb":"18f1d110.03d4af","name":"","x":620,"y":40,"wires":[[]]},{"id":"6f06ca79.f745b4","type":"debug","z":"ea0b6e5d.23037","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":630,"y":100,"wires":[]},{"id":"bf940ee8.63976","type":"debug","z":"ea0b6e5d.23037","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":250,"y":180,"wires":[]},{"id":"20c62901.3269a6","type":"inject","z":"ea0b6e5d.23037","name":"","topic":"SELECT * FROM 'node'","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":320,"wires":[["466d96b8.52fa88"]]},{"id":"2bd2ca42.78d4c6","type":"string","z":"ea0b6e5d.23037","name":"","methods":[{"name":"toString","params":[]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":200,"y":140,"wires":[["8215d9fa.be46d8"]]}]