-
Notifications
You must be signed in to change notification settings - Fork 7
/
TerrariumController-Flow-v3.json
1 lines (1 loc) · 8.63 KB
/
TerrariumController-Flow-v3.json
1
[{"id":"f4bfa1d9.2144e","type":"tab","label":"Terrarium Controller v3","disabled":true,"info":""},{"id":"b2969c26.e48738","type":"ui_switch","z":"f4bfa1d9.2144e","name":"Manual pump control","label":"Manual pump control","tooltip":"","group":"4c9b7e83.a15c88","order":1,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"0","offvalueType":"str","officon":"","offcolor":"","x":280,"y":380,"wires":[["73485906.0864d8"]]},{"id":"5fe787d6.7b32","type":"mqtt out","z":"f4bfa1d9.2144e","name":"Publish pump state","topic":"techexplorations/terrarium/pump-control","qos":"0","retain":"","broker":"ac3817ea.826db8","x":1250,"y":380,"wires":[]},{"id":"598f39e2.30b61","type":"ui_text","z":"f4bfa1d9.2144e","group":"582e5eea.e3645","order":3,"width":0,"height":0,"name":"Pump state","label":"Pump state is...","format":"{{msg.payload}}","layout":"row-spread","x":1230,"y":320,"wires":[]},{"id":"de30a137.762aa","type":"debug","z":"f4bfa1d9.2144e","name":"Pump state","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1230,"y":280,"wires":[]},{"id":"41966429.2d5344","type":"mqtt in","z":"f4bfa1d9.2144e","name":"Get soil humidity","topic":"techexplorations/terrarium/soil-humidity","qos":"0","datatype":"auto","broker":"ac3817ea.826db8","x":260,"y":220,"wires":[["6dd0946c.92d9c4","4005e25e.78355c","55d23a8e.73ea2c"]]},{"id":"6dd0946c.92d9c4","type":"ui_gauge","z":"f4bfa1d9.2144e","name":"Soil humidity raw","group":"c76544b.1f79338","order":1,"width":0,"height":0,"gtype":"gage","title":"Soil humidity raw","label":"units","format":"{{value}}","min":0,"max":"1023","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":590,"y":180,"wires":[]},{"id":"4005e25e.78355c","type":"function","z":"f4bfa1d9.2144e","name":"Pump operation","func":"var pump_state = '0';\n\nvar device_string = msg.payload.split(\",\"); // The data is coming in like this: \"167,ESP32_client_2\"\n // The actual sensor value is in device_string[0]\nvar raw_humidity_value = device_string[0];\nvar device_name = device_string[1];\n\nflow.set(\"raw_humidity_value\",raw_humidity_value);\nflow.set(\"device_name\",device_name);\n\nif (raw_humidity_value > 500)\n{\n pump_state = '1';\n flow.set(\"pump_state\",\"On\");\n} else\n{\n pump_state = '0';\n flow.set(\"pump_state\",\"Off\");\n}\n\n\nreturn {payload: pump_state};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":260,"wires":[["73485906.0864d8"]]},{"id":"73485906.0864d8","type":"rbe","z":"f4bfa1d9.2144e","name":"Update if pump state changed","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":900,"y":320,"wires":[["5fe787d6.7b32","de30a137.762aa","598f39e2.30b61","f63e466d.e53b6"]]},{"id":"cd134629.e12ce","type":"mqtt in","z":"f4bfa1d9.2144e","name":"Get MCU voltage","topic":"techexplorations/terrarium/mcu_voltage","qos":"0","datatype":"auto","broker":"ac3817ea.826db8","x":280,"y":520,"wires":[["f576eecc.1bc328","5f38e0e8.4e5c98"]]},{"id":"d6f63941.f759e","type":"mqtt in","z":"f4bfa1d9.2144e","name":"Get motor voltage","topic":"techexplorations/terrarium/motor_voltage","qos":"2","datatype":"auto","broker":"ac3817ea.826db8","x":290,"y":700,"wires":[["7ee2eea1.11b388","1a4c228a.1fbef5"]]},{"id":"f576eecc.1bc328","type":"debug","z":"f4bfa1d9.2144e","name":"MCU Voltage","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":520,"wires":[]},{"id":"7ee2eea1.11b388","type":"debug","z":"f4bfa1d9.2144e","name":"Motor Voltage","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":700,"wires":[]},{"id":"228ce090.f609f","type":"ui_gauge","z":"f4bfa1d9.2144e","name":"MCU Voltage","group":"8a1febd1.228ed8","order":0,"width":"6","height":"6","gtype":"gage","title":"MCU Voltage","label":"V","format":"{{value | number:1}} V","min":0,"max":"5","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":850,"y":580,"wires":[]},{"id":"539b8dcb.dfcb8c","type":"ui_gauge","z":"f4bfa1d9.2144e","name":"Motor Voltage","group":"8a1febd1.228ed8","order":0,"width":"6","height":"6","gtype":"gage","title":"Motor Voltage","label":"V","format":"{{value | number:1}} V","min":0,"max":"9","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":860,"y":760,"wires":[]},{"id":"55d23a8e.73ea2c","type":"debug","z":"f4bfa1d9.2144e","name":"Soil humidity raw","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":600,"y":120,"wires":[]},{"id":"96786ba7.1c1d98","type":"GSheet","z":"f4bfa1d9.2144e","creds":"90d14cf4.d152d8","method":"append","action":"","sheet":"1fpasYEjoUoExPwptcmerV0R0TpTfTBmzWGNcPcOMTMc","cells":"Sheet1!A2","name":"Log data to GSheet","x":1750,"y":560,"wires":[["8fc85a98.22127"]]},{"id":"f69c38fd.c5a07","type":"inject","z":"f4bfa1d9.2144e","name":"Hello!","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2020-7-16 2:1:7,ESP32_client_1,831,On,0.7,4.7","payloadType":"str","x":1470,"y":580,"wires":[["96786ba7.1c1d98"]]},{"id":"e836102f.6ea2e","type":"function","z":"f4bfa1d9.2144e","name":"Prepare Sheet Payload","func":"var today = new Date();\n\nvar date = today.getFullYear()+\n '-'+ (today.getMonth()+1)+\n '-'+ today.getDate() + \n ' ' + today.getHours() + \n \":\" + today.getMinutes() + \n \":\" + today.getSeconds();\n\nvar new_payload = date;\nnew_payload += \",\";\nnew_payload += flow.get(\"device_name\");\nnew_payload += \",\";\nnew_payload += flow.get(\"raw_humidity_value\");\nnew_payload += \",\";\nnew_payload += flow.get(\"pump_state\");\nnew_payload += \",\";\nnew_payload += flow.get(\"motor_voltage\");\nnew_payload += \",\";\nnew_payload += flow.get(\"mcu_voltage\");\n\n\nreturn { payload: new_payload };","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1460,"y":480,"wires":[["96786ba7.1c1d98","a8cafa18.d02948"]]},{"id":"5f38e0e8.4e5c98","type":"function","z":"f4bfa1d9.2144e","name":"Set MCU Voltage flow variable","func":"flow.set(\"mcu_voltage\",msg.payload);\n\nreturn {payload: msg.payload};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":590,"y":580,"wires":[["228ce090.f609f"]]},{"id":"1a4c228a.1fbef5","type":"function","z":"f4bfa1d9.2144e","name":"Set Motor Voltage flow variable","func":"flow.set(\"motor_voltage\",msg.payload);\n\nreturn {payload: msg.payload};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":590,"y":760,"wires":[["539b8dcb.dfcb8c"]]},{"id":"f63e466d.e53b6","type":"trigger","z":"f4bfa1d9.2144e","name":"Update log","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-1","extend":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1230,"y":480,"wires":[["e836102f.6ea2e"]]},{"id":"a8cafa18.d02948","type":"debug","z":"f4bfa1d9.2144e","name":"GSheet function","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1740,"y":480,"wires":[]},{"id":"8fc85a98.22127","type":"debug","z":"f4bfa1d9.2144e","name":"GSheet payload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2000,"y":560,"wires":[]},{"id":"4c9b7e83.a15c88","type":"ui_group","z":"","name":"Manual Pump Control","tab":"7d9d0a00.14e178","order":1,"disp":true,"width":"4","collapse":false},{"id":"ac3817ea.826db8","type":"mqtt-broker","z":"","name":"MQTT client on NodeRed.local","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"582e5eea.e3645","type":"ui_group","z":"","name":"Pump","tab":"7d9d0a00.14e178","order":2,"disp":true,"width":"4","collapse":false},{"id":"c76544b.1f79338","type":"ui_group","z":"","name":"Soil humidity","tab":"7d9d0a00.14e178","order":5,"disp":true,"width":"6","collapse":false},{"id":"8a1febd1.228ed8","type":"ui_group","z":"","name":"Voltages","tab":"7d9d0a00.14e178","order":7,"disp":true,"width":"6","collapse":false},{"id":"90d14cf4.d152d8","type":"gauth","z":""},{"id":"7d9d0a00.14e178","type":"ui_tab","z":"","name":"Terrarium","icon":"dashboard","disabled":false,"hidden":false}]