forgot i use that file in home assistant as readings for some cards...whoops, reinstated the one
but it also allows me to gain a time interval of longer than a minute before the entire program is rerun. it could give false readings if the pumps run without proper time to mix .
[{"id":"7c8093e112804a45","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"a8e3720248d1d7ad","type":"api-call-service","z":"7c8093e112804a45","name":"ch8 on","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.10013b653f_4","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":600,"wires":[["e2374444c0e4ec29"]]},{"id":"b65aeaaaa837116a","type":"api-call-service","z":"7c8093e112804a45","name":"ch8 off","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.10013b653f_4","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":600,"wires":[["c89ea2389c80664f"]]},{"id":"e2374444c0e4ec29","type":"delay","z":"7c8093e112804a45","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":920,"y":600,"wires":[["b65aeaaaa837116a"]]},{"id":"458d96ac7caf326f","type":"change","z":"7c8093e112804a45","name":"1131","rules":[{"t":"set","p":"payload.col4","pt":"msg","to":"System Msg (1121): Ppm's went below 1300, dosing system activated","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1210,"y":900,"wires":[["e758886fed4e2b08"]]},{"id":"4f630cc4e0fd73b4","type":"api-call-service","z":"7c8093e112804a45","name":"ch1","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.1001207d06_1","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":900,"wires":[["d56e53e370fb54d8"]]},{"id":"1a8ec483ecb2b575","type":"api-call-service","z":"7c8093e112804a45","name":"ch 2","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.1001207d06_2","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":960,"wires":[["eb37ae4531a8d01f"]]},{"id":"6ac5e32941f13b5b","type":"api-call-service","z":"7c8093e112804a45","name":"ch 3","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.1001207d06_3","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":1020,"wires":[["c2e4c2b780e41f48"]]},{"id":"c3e4ae6ffe4d8eb5","type":"api-call-service","z":"7c8093e112804a45","name":"ch 4","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.1001207d06_4","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":1080,"wires":[["54b1ef740f636584"]]},{"id":"f3468e510564d083","type":"api-call-service","z":"7c8093e112804a45","name":"ch 5","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.10013b653f_1","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":1140,"wires":[["c040850a4159a174"]]},{"id":"17b22c5c0901591e","type":"api-call-service","z":"7c8093e112804a45","name":"ch 6","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.10013b653f_2","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":1200,"wires":[["607394373a4d70ed"]]},{"id":"e12f39669e9838b7","type":"api-call-service","z":"7c8093e112804a45","name":"ch 7","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.10013b653f_3","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":1260,"wires":[["369564a4ad5d6386"]]},{"id":"c7b1855ad0e74a44","type":"api-call-service","z":"7c8093e112804a45","name":"ch1","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.1001207d06_1","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":900,"wires":[["458d96ac7caf326f"]]},{"id":"562f90d9d01bf852","type":"api-call-service","z":"7c8093e112804a45","name":"ch 2","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.1001207d06_2","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":960,"wires":[["458d96ac7caf326f"]]},{"id":"28758d5c9cbb8e11","type":"api-call-service","z":"7c8093e112804a45","name":"ch 3","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.1001207d06_3","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":1020,"wires":[["458d96ac7caf326f"]]},{"id":"37e8f70008508b87","type":"api-call-service","z":"7c8093e112804a45","name":"ch 4","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.1001207d06_4","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":1080,"wires":[["458d96ac7caf326f"]]},{"id":"26d26ebb8a5cb333","type":"api-call-service","z":"7c8093e112804a45","name":"ch 5","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.10013b653f_1","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":1140,"wires":[["458d96ac7caf326f"]]},{"id":"6a576509891e8f3c","type":"api-call-service","z":"7c8093e112804a45","name":"ch 6","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.10013b653f_2","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":1200,"wires":[["458d96ac7caf326f"]]},{"id":"c84f2c455bcba1a5","type":"api-call-service","z":"7c8093e112804a45","name":"ch 7","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.10013b653f_3","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":1260,"wires":[["458d96ac7caf326f"]]},{"id":"d56e53e370fb54d8","type":"delay","z":"7c8093e112804a45","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":920,"y":900,"wires":[["c7b1855ad0e74a44"]]},{"id":"eb37ae4531a8d01f","type":"delay","z":"7c8093e112804a45","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":920,"y":960,"wires":[["562f90d9d01bf852"]]},{"id":"607394373a4d70ed","type":"delay","z":"7c8093e112804a45","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":920,"y":1200,"wires":[["6a576509891e8f3c"]]},{"id":"c040850a4159a174","type":"delay","z":"7c8093e112804a45","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":920,"y":1140,"wires":[["26d26ebb8a5cb333"]]},{"id":"54b1ef740f636584","type":"delay","z":"7c8093e112804a45","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":920,"y":1080,"wires":[["37e8f70008508b87"]]},{"id":"369564a4ad5d6386","type":"delay","z":"7c8093e112804a45","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":920,"y":1260,"wires":[["c84f2c455bcba1a5"]]},{"id":"c2e4c2b780e41f48","type":"delay","z":"7c8093e112804a45","name":"","pauseType":"delay","timeout":"9","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":920,"y":1020,"wires":[["28758d5c9cbb8e11"]]},{"id":"fd1d69b360c2b974","type":"api-call-service","z":"7c8093e112804a45","name":"all off","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.1001207d06_1, switch.1001207d06_2, switch.1001207d06_3, switch.1001207d06_4","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":800,"wires":[["d46ad0cf150fafc4"]]},{"id":"21af0a14976f9476","type":"file","z":"7c8093e112804a45","name":"BlueLogs","filename":"/config/BlueLogs.csv","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":1500,"y":760,"wires":[["dc721b77684d5411"]]},{"id":"e758886fed4e2b08","type":"csv","z":"7c8093e112804a45","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":1370,"y":760,"wires":[["21af0a14976f9476"]]},{"id":"dc721b77684d5411","type":"debug","z":"7c8093e112804a45","name":"file","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1630,"y":760,"wires":[]},{"id":"c89ea2389c80664f","type":"change","z":"7c8093e112804a45","name":"1133","rules":[{"t":"set","p":"payload.col5","pt":"msg","to":"System Msg (1133): Ph went under 5.4, doser has been activated. Check status ASAP","tot":"str","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":1210,"y":600,"wires":[["e758886fed4e2b08"]]},{"id":"d46ad0cf150fafc4","type":"change","z":"7c8093e112804a45","name":"1141","rules":[{"t":"set","p":"payload.col4","pt":"msg","to":"System Msg(1143) Error within system, pumps may need calibrating","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1210,"y":800,"wires":[["e758886fed4e2b08"]]},{"id":"3e628c65f31d6bee","type":"change","z":"7c8093e112804a45","name":"1122","rules":[{"t":"set","p":"payload.col4","pt":"msg","to":"System Msg (1122): Within Recommended Levels","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1210,"y":860,"wires":[["e758886fed4e2b08"]]},{"id":"6fab8f33ae97b205","type":"change","z":"7c8093e112804a45","name":"1124","rules":[{"t":"set","p":"payload.col5","pt":"msg","to":"System Msg(1124): Conditions are Optimal","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1210,"y":660,"wires":[["e758886fed4e2b08"]]},{"id":"9ec35ded97a42349","type":"change","z":"7c8093e112804a45","name":"1143","rules":[{"t":"set","p":"payload.col5","pt":"msg","to":"System Msg(1144): Pump or probe may need attention","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1210,"y":700,"wires":[["e758886fed4e2b08"]]},{"id":"c713a83020298766","type":"change","z":"7c8093e112804a45","name":"1666","rules":[{"t":"set","p":"payload.col4","pt":"msg","to":"System Msg(1666) ā ā ā ā ā ā ā all hell is breaking loose SHUT SHIT DOWN!)","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1210,"y":760,"wires":[["e758886fed4e2b08"]]},{"id":"6e28f868fbef1981","type":"api-call-service","z":"7c8093e112804a45","name":"ch8/off","server":"a52fadfc.d75d","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.10013b653f_4","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":700,"wires":[["9ec35ded97a42349"]]},{"id":"d9d5bf159ede78cf","type":"switch","z":"7c8093e112804a45","name":"","property":"payload.col4","propertyType":"msg","rules":[{"t":"gt","v":"2300","vt":"num"},{"t":"gt","v":"2000","vt":"str"},{"t":"btwn","v":"1300","vt":"num","v2":"2000","v2t":"num"},{"t":"lt","v":"1300","vt":"num"}],"checkall":"true","repair":false,"outputs":4,"x":650,"y":820,"wires":[["c713a83020298766"],["fd1d69b360c2b974"],["3e628c65f31d6bee"],["4f630cc4e0fd73b4","1a8ec483ecb2b575","6ac5e32941f13b5b","c3e4ae6ffe4d8eb5","f3468e510564d083","17b22c5c0901591e","e12f39669e9838b7"]]},{"id":"095002630166781f","type":"switch","z":"7c8093e112804a45","name":"","property":"payload.col5","propertyType":"msg","rules":[{"t":"lt","v":"5.4","vt":"str"},{"t":"btwn","v":"5.4","vt":"num","v2":"6.2","v2t":"num"},{"t":"gt","v":"6.2","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":650,"y":660,"wires":[["a8e3720248d1d7ad"],["6fab8f33ae97b205"],["6e28f868fbef1981"]]},{"id":"3c0ce4f575f920d7","type":"file","z":"7c8093e112804a45","name":"Nf","filename":"/config/grogreen.csv","appendNewline":false,"createDir":true,"overwriteFile":"false","encoding":"none","x":1030,"y":560,"wires":[["62c8052ad734d829"]]},{"id":"62c8052ad734d829","type":"debug","z":"7c8093e112804a45","name":"GroGreen","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1160,"y":560,"wires":[]},{"id":"116712c9ac9982e0","type":"watch","z":"7c8093e112804a45","name":"watch","files":"/config/BlueLog/","recursive":"","x":130,"y":560,"wires":[["a6ccef87b65a7ae0"]]},{"id":"a6ccef87b65a7ae0","type":"change","z":"7c8093e112804a45","name":"change","rules":[{"t":"set","p":"filename","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":560,"wires":[["89f5777026013215"]]},{"id":"89f5777026013215","type":"file in","z":"7c8093e112804a45","name":"","filename":"","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":400,"y":560,"wires":[["7d1493e7b10d62a7"]]},{"id":"a70371905892b177","type":"function","z":"7c8093e112804a45","name":"last line","func":"let lines = msg.payload\nmsg.payload = lines[lines.length - 2]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":780,"y":560,"wires":[["f514d98944673d13"]]},{"id":"a174fde6f8b28c13","type":"join","z":"7c8093e112804a45","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":650,"y":560,"wires":[["a70371905892b177"]]},{"id":"7d1493e7b10d62a7","type":"csv","z":"7c8093e112804a45","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":530,"y":560,"wires":[["a174fde6f8b28c13"]]},{"id":"23a6fc3206043cdf","type":"debug","z":"7c8093e112804a45","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":740,"wires":[]},{"id":"f514d98944673d13","type":"csv","z":"7c8093e112804a45","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":910,"y":560,"wires":[["3c0ce4f575f920d7"]]},{"id":"a56b0b995d58ae1d","type":"inject","z":"7c8093e112804a45","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"600","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"payload","payloadType":"msg","x":90,"y":740,"wires":[["398b30e2bbafc0e3"]]},{"id":"398b30e2bbafc0e3","type":"file in","z":"7c8093e112804a45","name":"read","filename":"/config/grogreen.csv","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":210,"y":740,"wires":[["cfd1fc0d73696df9"]]},{"id":"56cdb646ae260326","type":"function","z":"7c8093e112804a45","name":"last line","func":"let lines = msg.payload\nmsg.payload = lines[lines.length - 2]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":740,"wires":[["23a6fc3206043cdf","095002630166781f","d9d5bf159ede78cf"]]},{"id":"521c820af847e901","type":"join","z":"7c8093e112804a45","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":450,"y":740,"wires":[["56cdb646ae260326"]]},{"id":"cfd1fc0d73696df9","type":"csv","z":"7c8093e112804a45","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":330,"y":740,"wires":[["521c820af847e901"]]},{"id":"a52fadfc.d75d","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]
hey i came across an issue that is when the program is running it will will a timestamp from the file.. this timestamp is usually 2 minutes old. im trying to write something that allows for a fluctuating variable of +/- 3 minutes but once out of range it will not allow the actual program to run..
i put together something small to test
[{"id":"7c8093e112804a45","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"2c0d0dd0f0d3acab","type":"inject","z":"7c8093e112804a45","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":310,"y":320,"wires":[["6cb061c2583d4350"]]},{"id":"3283245ef49a2b63","type":"debug","z":"7c8093e112804a45","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":200,"wires":[]},{"id":"7683fb8d76274be5","type":"debug","z":"7c8093e112804a45","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":520,"wires":[]},{"id":"e2e1d73cca438d04","type":"inject","z":"7c8093e112804a45","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"payload","payloadType":"msg","x":70,"y":380,"wires":[["79e38673010a89f7"]]},{"id":"79e38673010a89f7","type":"file in","z":"7c8093e112804a45","name":"read","filename":"/config/grogreen.csv","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":190,"y":380,"wires":[["ce3d1fadcee16e47"]]},{"id":"52148dcc131136a3","type":"function","z":"7c8093e112804a45","name":"last line","func":"let lines = msg.payload\nmsg.payload = lines[lines.length - 2]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":380,"wires":[["febfebc6f2f62b36"]]},{"id":"555964b74eb069bf","type":"join","z":"7c8093e112804a45","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":430,"y":380,"wires":[["52148dcc131136a3"]]},{"id":"ce3d1fadcee16e47","type":"csv","z":"7c8093e112804a45","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":310,"y":380,"wires":[["555964b74eb069bf"]]},{"id":"6cb061c2583d4350","type":"moment","z":"7c8093e112804a45","name":"","topic":"","input":"","inputType":"msg","inTz":"America/New_York","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD HH:mm:ss","locale":"C","output":"","outputType":"msg","outTz":"America/New_York","x":520,"y":320,"wires":[["3283245ef49a2b63","bca1a7e957f55e97"]]},{"id":"b5a022e5c1e3efc7","type":"change","z":"7c8093e112804a45","name":"","rules":[{"t":"set","p":"complete","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":380,"wires":[["bca1a7e957f55e97","7db471604621ed65"]]},{"id":"7db471604621ed65","type":"debug","z":"7c8093e112804a45","name":"4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1250,"y":560,"wires":[]},{"id":"14c72076e4ec317d","type":"function","z":"7c8093e112804a45","name":"","func":"var content1 = payload[0];\nvar content2 = payload[1];\n\nif (content1 - content2 =) ( > 3)\n{\nmsg.payload = 1;\n}\nelse\n{\nmsg.payload = 0;\n}\nreturn msg","outputs":1,"noerr":8,"initialize":"","finalize":"","libs":[],"x":1200,"y":320,"wires":[["d2cad7f0514f98be","2b75a6ccab769eb0","30ec5fc8fe958136"]]},{"id":"d2cad7f0514f98be","type":"debug","z":"7c8093e112804a45","name":"5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1590,"y":320,"wires":[]},{"id":"bca1a7e957f55e97","type":"join","z":"7c8093e112804a45","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"payload","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1050,"y":320,"wires":[["14c72076e4ec317d","86addbdca3ba9d22"]]},{"id":"86addbdca3ba9d22","type":"debug","z":"7c8093e112804a45","name":"3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1140,"y":180,"wires":[]},{"id":"febfebc6f2f62b36","type":"change","z":"7c8093e112804a45","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.col1","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":380,"wires":[["b5a022e5c1e3efc7","7683fb8d76274be5"]]},{"id":"2b75a6ccab769eb0","type":"change","z":"7c8093e112804a45","name":"time is within range","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1410,"y":240,"wires":[[]]},{"id":"30ec5fc8fe958136","type":"change","z":"7c8093e112804a45","name":"time is out of range","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1410,"y":380,"wires":[[]]}]
You make the wrong assumption that the datetime from Date/Time Formatter node and the datetime from your file will always arrive in the same order and one will be msg.payload[0] and then other always msg.payload[1]. They may arrive at different times when they get merged in Join node as Array.
Suggestion. Do your logic on the same Flow line.
you dont need two separate 1min Inject nodes. One will do.
also some syntax mistakes in Javascript
you can use Jsonata expression in Change node to get the date format with $moment
prepend payload with msg.
[{"id":"7683fb8d76274be5","type":"debug","z":"7c8093e112804a45","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":320,"wires":[]},{"id":"e2e1d73cca438d04","type":"inject","z":"7c8093e112804a45","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"payload","payloadType":"msg","x":70,"y":380,"wires":[["79e38673010a89f7"]]},{"id":"79e38673010a89f7","type":"file in","z":"7c8093e112804a45","name":"read","filename":"/config/grogreen.csv","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":190,"y":380,"wires":[["ce3d1fadcee16e47"]]},{"id":"52148dcc131136a3","type":"function","z":"7c8093e112804a45","name":"last line","func":"let lines = msg.payload\nmsg.payload = lines[lines.length - 2]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":380,"wires":[["febfebc6f2f62b36"]]},{"id":"555964b74eb069bf","type":"join","z":"7c8093e112804a45","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":430,"y":380,"wires":[["52148dcc131136a3"]]},{"id":"ce3d1fadcee16e47","type":"csv","z":"7c8093e112804a45","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":310,"y":380,"wires":[["555964b74eb069bf"]]},{"id":"7db471604621ed65","type":"debug","z":"7c8093e112804a45","name":"4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1250,"y":200,"wires":[]},{"id":"14c72076e4ec317d","type":"function","z":"7c8093e112804a45","name":"","func":"\nif ((msg.now - msg.payload) > 3) {\n msg.payload = 1;\n}\nelse {\n msg.payload = 0;\n}\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":940,"y":380,"wires":[["86addbdca3ba9d22","06dc7f5e2802b25f"]]},{"id":"d2cad7f0514f98be","type":"debug","z":"7c8093e112804a45","name":"5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1250,"y":240,"wires":[]},{"id":"86addbdca3ba9d22","type":"debug","z":"7c8093e112804a45","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":320,"wires":[]},{"id":"febfebc6f2f62b36","type":"change","z":"7c8093e112804a45","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.col1","tot":"msg"},{"t":"set","p":"now","pt":"msg","to":"$moment().format('YYYY-MM-DD HH:mm:ss')\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":380,"wires":[["7683fb8d76274be5","14c72076e4ec317d"]]},{"id":"2b75a6ccab769eb0","type":"change","z":"7c8093e112804a45","name":"time is within range","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":440,"wires":[[]]},{"id":"30ec5fc8fe958136","type":"change","z":"7c8093e112804a45","name":"time is out of range","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":320,"wires":[[]]},{"id":"06dc7f5e2802b25f","type":"switch","z":"7c8093e112804a45","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":1110,"y":380,"wires":[["30ec5fc8fe958136"],["2b75a6ccab769eb0"]]}]
i dont fully understand the requirement
you mean to create a Dashboard for a user to set the msg.delay for the Delay node ?
or is this something not related to your last flow and create limits for a Switch node ?
in either case a solution is possibly to create a Dashboard using the node-red-dashboard
get the limits from the user and set them to Context (you can read what Context is here)
then read and use those Context limit values to whatever node your application needs them
The missing Home Assistant nodes because i dont have HA ..
which is a common thing on the Forum because everyone's setup is different
In order to replicate part of the logic and understand what you are trying to do
you have to add complete msg Debug nodes after each of those api-current-state nodes and capture some msgs coming out of them, in order to understand their structure (properties, values, etc)
How to capture and share a message from the Debug window :
Hover over the root of the msg and use the Copy value button
Share the message (using ) explaining where its coming from.