I have built a project to water my raised garden beds. I'm using an MCP3008 connected to a raspberry pi zero. All of the components are working great, but... I'd like to monitor and graph the data from the moisture and temp sensors all day but have the watering happen once a day. My flow is set up to check the soil every 20 seconds and then calculate if it needs water. Right now it will turn on the water as soon as it senses that the soil has past the 'to dry" threshold I would like for it to only check if it needs water every 24 hours. How do I constantly monitor the soil but only act once a day? If there is a way to code a function node to pole the data and then decide to water only after getting an input from the inject node? If so that would work fine.
I"ve attached the flows here-
[{"id":"e4185306.869578","type":"subflow","name":"Subflow 2","info":"","in":[{"x":40,"y":160,"wires":[{"id":"67823963.1392c8"}]}],"out":[{"x":620,"y":100,"wires":[{"id":"c49e5930.06b9f","port":0}]}]},{"id":"22d95ee0.32ddd2","type":"debug","z":"e4185306.869578","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":690,"y":240,"wires":[]},{"id":"3cdf3f31.ce5ab","type":"smooth","z":"e4185306.869578","name":"","property":"payload","action":"mean","count":"1000","round":"0","mult":"single","x":320,"y":160,"wires":[["c49e5930.06b9f"]]},{"id":"67823963.1392c8","type":"range","z":"e4185306.869578","minin":"515","maxin":"715","minout":"0","maxout":"100","action":"clamp","round":false,"property":"payload","name":"","x":180,"y":160,"wires":[["3cdf3f31.ce5ab"]]},{"id":"c49e5930.06b9f","type":"delay","z":"e4185306.869578","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":470,"y":160,"wires":[["af0e033.40e21","2828467a.ab96ea","22d95ee0.32ddd2"]]},{"id":"2828467a.ab96ea","type":"ui_gauge","z":"e4185306.869578","name":"","group":"a299de7a.483d88","order":1,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":670,"y":160,"wires":[]},{"id":"af0e033.40e21","type":"ui_chart","z":"e4185306.869578","name":"","group":"a299de7a.483d88","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":670,"y":200,"wires":[[]]},{"id":"1cad6973.58ef87","type":"arduino in","z":"d70da7af.82ffa","name":"Bed 1","pin":"2","state":"ANALOG","arduino":"96c9b3c4.28ff28","x":50,"y":100,"wires":[["d28e31ce.7df7b"]]},{"id":"d3ae1679.352f48","type":"arduino in","z":"d70da7af.82ffa","name":"Bed 2","pin":"1","state":"ANALOG","arduino":"96c9b3c4.28ff28","x":50,"y":400,"wires":[["5e4a9e2b.68efa8"]]},{"id":"45ec2849.71d54","type":"debug","z":"d70da7af.82ffa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":690,"y":500,"wires":[]},{"id":"9c4309c2.dd7c88","type":"smooth","z":"d70da7af.82ffa","name":"","property":"payload","action":"mean","count":"1000","round":"0","mult":"single","x":320,"y":400,"wires":[["ea5411c0.1bb5"]]},{"id":"5e4a9e2b.68efa8","type":"range","z":"d70da7af.82ffa","minin":"515","maxin":"715","minout":"0","maxout":"100","action":"clamp","round":false,"property":"payload","name":"","x":180,"y":400,"wires":[["9c4309c2.dd7c88"]]},{"id":"ea5411c0.1bb5","type":"delay","z":"d70da7af.82ffa","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":470,"y":400,"wires":[["50ae79a5.c898f8","2e45ddaa.f47662","45ec2849.71d54","b4d8b114.bd72c","3e309494.17f294"]]},{"id":"50ae79a5.c898f8","type":"ui_chart","z":"d70da7af.82ffa","name":"","group":"a299de7a.483d88","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":674,"y":456,"wires":[[]]},{"id":"2e45ddaa.f47662","type":"ui_gauge","z":"d70da7af.82ffa","name":"","group":"a299de7a.483d88","order":1,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":673,"y":396,"wires":[]},{"id":"b4d8b114.bd72c","type":"mqtt out","z":"d70da7af.82ffa","name":"","topic":"Bed2","qos":"","retain":"","broker":"19ec834a.fd09e5","x":670,"y":320,"wires":[]},{"id":"e843861.74c95f8","type":"function","z":"d70da7af.82ffa","name":"Soil Hydration","func":"const soilHigh =45\nconst soilLow =25\nlet soilHydration = msg.payload\n\nif (soilHydration >= soilHigh) {\n return {payload: 0}\n} else if (soilHydration <= soilLow) {\n return {payload: 1}\n}","outputs":1,"noerr":0,"x":480,"y":120,"wires":[["766d22e3.de2a94","110784b8.8b2993"]]},{"id":"19c76bff.064f1c","type":"mqtt out","z":"d70da7af.82ffa","name":"","topic":"Bed 1 Hydration","qos":"","retain":"","broker":"13985a58.855886","x":480,"y":80,"wires":[]},{"id":"d28e31ce.7df7b","type":"subflow:e4185306.869578","z":"d70da7af.82ffa","name":"Analog Signal Conditioning ","x":240,"y":100,"wires":[["e843861.74c95f8","19c76bff.064f1c"]]},{"id":"766d22e3.de2a94","type":"mytimeout","z":"d70da7af.82ffa","name":"Water valve timer","outtopic":"","outsafe":"0","outwarning":"Warning","outunsafe":"1","warning":"5","timer":"30","debug":false,"ndebug":false,"ignoreCase":false,"repeat":false,"again":false,"x":690,"y":120,"wires":[["bb55d698.e59548"],[]]},{"id":"110784b8.8b2993","type":"mqtt out","z":"d70da7af.82ffa","name":"","topic":"Bed 1 Valve Status ","qos":"","retain":"","broker":"13985a58.855886","x":690,"y":180,"wires":[]},{"id":"bb55d698.e59548","type":"rpi-gpio out","z":"d70da7af.82ffa","name":"Bed 1 Valve ","pin":"40","set":"","level":"0","freq":"","out":"out","x":870,"y":120,"wires":[]},{"id":"3e309494.17f294","type":"function","z":"d70da7af.82ffa","name":"Soil Hydration","func":"const soilHigh =45\nconst soilLow =25\nlet soilHydration = msg.payload\n\nif (soilHydration >= soilHigh) {\n return {payload: 0}\n} else if (soilHydration <= soilLow) {\n return {payload: 1}\n}","outputs":1,"noerr":0,"x":700,"y":360,"wires":[["f89846ce.098ff"]]},{"id":"f89846ce.098ff","type":"rpi-gpio out","z":"d70da7af.82ffa","name":"Bed 2 Valve","pin":"38","set":"","level":"0","freq":"","out":"out","x":870,"y":360,"wires":[]},{"id":"96c9b3c4.28ff28","type":"arduino-board","z":"","device":"/dev/ttyUSB0"},{"id":"a299de7a.483d88","type":"ui_group","z":"","name":"Default","tab":"9444d915.be79a8","disp":true,"width":"6","collapse":false},{"id":"19ec834a.fd09e5","type":"mqtt-broker","z":"","name":"","broker":"192.168.0.50","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"13985a58.855886","type":"mqtt-broker","z":"","name":"","broker":"192.168.0.50","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"9444d915.be79a8","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]