-
Notifications
You must be signed in to change notification settings - Fork 7
/
TerrariumController-Flow-v5.json
1 lines (1 loc) · 12.3 KB
/
TerrariumController-Flow-v5.json
1
[{"id":"8c7724b7.61dc8","type":"tab","label":"Terrarium Controller v5","disabled":true,"info":"This flow receives air tempereture and humidity, displays the values in the dashboard, and logs them in GSheet."},{"id":"2ddd2bd1.00bd1c","type":"ui_switch","z":"8c7724b7.61dc8","name":"Manual pump control","label":"Manual pump control","tooltip":"","group":"f55951e9.1bc2b","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":440,"y":380,"wires":[["dfd81541.7233d8"]]},{"id":"fd7b9b7f.a76ca8","type":"mqtt out","z":"8c7724b7.61dc8","name":"Publish pump state","topic":"techexplorations/terrarium/pump-control","qos":"0","retain":"","broker":"ac3817ea.826db8","x":1410,"y":380,"wires":[]},{"id":"e9245a98.81b038","type":"ui_text","z":"8c7724b7.61dc8","group":"33590577.3d1f2a","order":3,"width":0,"height":0,"name":"Pump state","label":"Pump state is...","format":"{{msg.payload}}","layout":"row-spread","x":1390,"y":320,"wires":[]},{"id":"2c77139b.988f2c","type":"debug","z":"8c7724b7.61dc8","name":"Pump state","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1390,"y":280,"wires":[]},{"id":"4f9b383c.830228","type":"mqtt in","z":"8c7724b7.61dc8","name":"Get soil humidity","topic":"techexplorations/terrarium/soil-humidity","qos":"0","datatype":"auto","broker":"ac3817ea.826db8","x":420,"y":220,"wires":[["7969bb56.e166e4","b7e9afb.e7a775","33719caa.ab8b8c"]]},{"id":"7969bb56.e166e4","type":"ui_gauge","z":"8c7724b7.61dc8","name":"Soil humidity raw","group":"95487361.ac119","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":750,"y":180,"wires":[]},{"id":"b7e9afb.e7a775","type":"function","z":"8c7724b7.61dc8","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 > flow.get(\"soil_humidity_threshold\"))\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,"x":740,"y":260,"wires":[["dfd81541.7233d8"]]},{"id":"dfd81541.7233d8","type":"rbe","z":"8c7724b7.61dc8","name":"Update if pump state changed","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1060,"y":320,"wires":[["fd7b9b7f.a76ca8","2c77139b.988f2c","e9245a98.81b038","ce886c06.620ce8"]]},{"id":"55587e8a.828d2","type":"mqtt in","z":"8c7724b7.61dc8","name":"Get MCU voltage","topic":"techexplorations/terrarium/mcu_voltage","qos":"0","datatype":"auto","broker":"ac3817ea.826db8","x":440,"y":540,"wires":[["67042fc6.4ae0f","c647858f.ca4c9"]]},{"id":"94b47b14.fd5a7","type":"mqtt in","z":"8c7724b7.61dc8","name":"Get motor voltage","topic":"techexplorations/terrarium/motor_voltage","qos":"2","datatype":"auto","broker":"ac3817ea.826db8","x":450,"y":720,"wires":[["5c476fce.bb49f","c9906e5b.f24cf8"]]},{"id":"67042fc6.4ae0f","type":"debug","z":"8c7724b7.61dc8","name":"MCU Voltage","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1010,"y":540,"wires":[]},{"id":"5c476fce.bb49f","type":"debug","z":"8c7724b7.61dc8","name":"Motor Voltage","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1020,"y":720,"wires":[]},{"id":"cc47176c.1fdf6","type":"ui_gauge","z":"8c7724b7.61dc8","name":"MCU Voltage","group":"af67a6b6.aae228","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":1010,"y":600,"wires":[]},{"id":"8b4596d9.dbcc68","type":"ui_gauge","z":"8c7724b7.61dc8","name":"Motor Voltage","group":"af67a6b6.aae228","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":1020,"y":780,"wires":[]},{"id":"33719caa.ab8b8c","type":"debug","z":"8c7724b7.61dc8","name":"Soil humidity raw","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":760,"y":120,"wires":[]},{"id":"170a20c5.8d7317","type":"GSheet","z":"8c7724b7.61dc8","creds":"90d14cf4.d152d8","method":"append","action":"","sheet":"1fpasYEjoUoExPwptcmerV0R0TpTfTBmzWGNcPcOMTMc","cells":"Sheet1!A2","name":"Log data to GSheet","x":1910,"y":560,"wires":[["542f2178.958ac8"]]},{"id":"81d8537e.7f1778","type":"inject","z":"8c7724b7.61dc8","name":"Hello!","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":1630,"y":580,"wires":[["170a20c5.8d7317"]]},{"id":"63a2df0.0f635a","type":"function","z":"8c7724b7.61dc8","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\");\nnew_payload += \",\";\nnew_payload += flow.get(\"air_temperature\");\nnew_payload += \",\";\nnew_payload += flow.get(\"air_humidity\");\n\n\nreturn { payload: new_payload };","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1620,"y":480,"wires":[["170a20c5.8d7317","221c3b1b.306e14"]]},{"id":"c647858f.ca4c9","type":"function","z":"8c7724b7.61dc8","name":"Set MCU Voltage flow variable","func":"flow.set(\"mcu_voltage\",msg.payload);\n\nreturn {payload: msg.payload};","outputs":1,"noerr":0,"x":750,"y":600,"wires":[["cc47176c.1fdf6"]]},{"id":"c9906e5b.f24cf8","type":"function","z":"8c7724b7.61dc8","name":"Set Motor Voltage flow variable","func":"flow.set(\"motor_voltage\",msg.payload);\n\nreturn {payload: msg.payload};","outputs":1,"noerr":0,"x":750,"y":780,"wires":[["8b4596d9.dbcc68"]]},{"id":"ce886c06.620ce8","type":"trigger","z":"8c7724b7.61dc8","name":"Update log","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-1","extend":false,"units":"min","reset":"","bytopic":"all","outputs":1,"x":1390,"y":480,"wires":[["63a2df0.0f635a"]]},{"id":"221c3b1b.306e14","type":"debug","z":"8c7724b7.61dc8","name":"GSheet function","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1900,"y":480,"wires":[]},{"id":"542f2178.958ac8","type":"debug","z":"8c7724b7.61dc8","name":"GSheet payload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":2160,"y":560,"wires":[]},{"id":"ff5e4fea.d073f","type":"ui_numeric","z":"8c7724b7.61dc8","name":"","label":"Pump threshold","tooltip":"Set a raw humidity value above which the pump is turned on","group":"3a47e0e0.e385b","order":0,"width":"6","height":"1","wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"1023","step":"10","x":420,"y":460,"wires":[["ef98f886.525478"]]},{"id":"ef98f886.525478","type":"function","z":"8c7724b7.61dc8","name":"Set soil_humidity_threshold","func":"flow.set(\"soil_humidity_threshold\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":460,"wires":[["fb285e21.d93e98","cb6ada1b.6a52f8"]]},{"id":"fb285e21.d93e98","type":"debug","z":"8c7724b7.61dc8","name":"set soil_humidity_threshold","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1060,"y":480,"wires":[]},{"id":"cb6ada1b.6a52f8","type":"mqtt out","z":"8c7724b7.61dc8","name":"Set MQTT soil_humidity_threshold","topic":"techexplorations/terrarium/soil_humidity_threshold","qos":"0","retain":"","broker":"ac3817ea.826db8","x":1080,"y":420,"wires":[]},{"id":"bf0524a7.01d85","type":"inject","z":"8c7724b7.61dc8","name":"Set default threshold","repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"500","payloadType":"num","x":160,"y":460,"wires":[["ff5e4fea.d073f"]],"info":"This trigger will fire automatically 1 second after the flow starts."},{"id":"e299d00b.63e918","type":"mqtt in","z":"8c7724b7.61dc8","name":"Get air temperature","topic":"techexplorations/terrarium/air-temperature","qos":"0","datatype":"auto","broker":"ac3817ea.826db8","x":470,"y":960,"wires":[["f8124d8c.254b6","f4edd88.13587a8"]]},{"id":"f8124d8c.254b6","type":"function","z":"8c7724b7.61dc8","name":"Set air temperature variable","func":"flow.set(\"air_temperature\", msg.payload);\n\n\nreturn {payload: msg.payload};","outputs":1,"noerr":0,"x":790,"y":1000,"wires":[["531af391.c2352c"]]},{"id":"f4edd88.13587a8","type":"debug","z":"8c7724b7.61dc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":740,"y":940,"wires":[]},{"id":"531af391.c2352c","type":"ui_gauge","z":"8c7724b7.61dc8","name":"Air temperature","group":"76869ed2.cdc838","order":0,"width":"6","height":"6","gtype":"gage","title":"Air temperature","label":"°C","format":"{{value | number:1}}°C","min":0,"max":"50","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1100,"y":1000,"wires":[]},{"id":"87582a5.abc4b58","type":"mqtt in","z":"8c7724b7.61dc8","name":"Get air humidity","topic":"techexplorations/terrarium/air-humidity","qos":"0","datatype":"auto","broker":"ac3817ea.826db8","x":460,"y":1140,"wires":[["f8dcdd7f.00217","bbe3b8bc.e2c59"]]},{"id":"f8dcdd7f.00217","type":"function","z":"8c7724b7.61dc8","name":"Set air humidity variable","func":"flow.set(\"air_humidity\", msg.payload);\n\n\nreturn {payload: msg.payload};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780,"y":1180,"wires":[["84507165.e42418"]]},{"id":"bbe3b8bc.e2c59","type":"debug","z":"8c7724b7.61dc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":740,"y":1120,"wires":[]},{"id":"84507165.e42418","type":"ui_gauge","z":"8c7724b7.61dc8","name":"Air humidity","group":"76869ed2.cdc838","order":0,"width":"6","height":"6","gtype":"gage","title":"Air humidity","label":"%","format":"{{value | number:1}}%","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1090,"y":1180,"wires":[]},{"id":"f55951e9.1bc2b","type":"ui_group","z":"","name":"Manual Pump Control","tab":"ab58d2f8.4e174","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":"33590577.3d1f2a","type":"ui_group","z":"","name":"Pump","tab":"ab58d2f8.4e174","order":2,"disp":true,"width":"4","collapse":false},{"id":"95487361.ac119","type":"ui_group","z":"","name":"Soil humidity","tab":"ab58d2f8.4e174","order":4,"disp":true,"width":"6","collapse":false},{"id":"af67a6b6.aae228","type":"ui_group","z":"","name":"Voltages","tab":"ab58d2f8.4e174","order":6,"disp":true,"width":"6","collapse":false},{"id":"90d14cf4.d152d8","type":"gauth","z":""},{"id":"3a47e0e0.e385b","type":"ui_group","z":"","name":"Set the pump threshhold","tab":"ab58d2f8.4e174","order":3,"disp":true,"width":"6","collapse":false},{"id":"76869ed2.cdc838","type":"ui_group","z":"","name":"Air sensor","tab":"ab58d2f8.4e174","order":5,"disp":true,"width":"6","collapse":false},{"id":"ab58d2f8.4e174","type":"ui_tab","z":"","name":"Terrarium","icon":"dashboard","disabled":false,"hidden":false}]