Time Check From 2 csv files

i join that to the main message from the csv file only using the column for ppm and use them all in the switch node

for some reason this quit working for me today...code to follow

@UnborN i swear this worked yesterday before bed

debug node ouput before swtich since you wont see HA nodes information:

["2000.0","1305.0","1500.0","1300.0",{"col1":"2022-01-30 04:56:00","col2":"ppm500","col3":"F","col4":1640,"col5":6,"col6":70}]

actual code giving an issue is here:

[{"id":"81c478a245415a26","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"f5eef79a2fdd2027","type":"api-current-state","z":"81c478a245415a26","name":"Dose","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ppm_dose","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":990,"y":400,"wires":[["856f483c517863b8"]]},{"id":"8d13b0e0f1188b81","type":"api-current-state","z":"81c478a245415a26","name":"low ","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ppm_high","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":990,"y":460,"wires":[["856f483c517863b8"]]},{"id":"6fa40203d02ecd02","type":"api-current-state","z":"81c478a245415a26","name":"high","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ppm_low","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":990,"y":520,"wires":[["856f483c517863b8"]]},{"id":"03332bb60fcc6b7b","type":"api-current-state","z":"81c478a245415a26","name":"warn","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ppm_warn","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":990,"y":580,"wires":[["856f483c517863b8"]]},{"id":"856f483c517863b8","type":"join","z":"81c478a245415a26","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"5","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1150,"y":640,"wires":[["e93a4297f7fee358","b2342d78635ab17f"]]},{"id":"d9935128d7bf4348","type":"change","z":"81c478a245415a26","name":"SMC","rules":[{"t":"set","p":"complete","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":990,"y":640,"wires":[["856f483c517863b8"]]},{"id":"7188183f464c18a9","type":"file in","z":"81c478a245415a26","name":"read","filename":"/config/grogreen.csv","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":470,"y":640,"wires":[["ef43e9c1e4e05211"]]},{"id":"a45d65a9b5a78067","type":"function","z":"81c478a245415a26","name":"last line","func":"let lines = msg.payload\nmsg.payload = lines[lines.length - 2]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":640,"wires":[["d9935128d7bf4348"]]},{"id":"b5289870e9da06ca","type":"join","z":"81c478a245415a26","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":710,"y":640,"wires":[["a45d65a9b5a78067"]]},{"id":"ef43e9c1e4e05211","type":"csv","z":"81c478a245415a26","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":590,"y":640,"wires":[["b5289870e9da06ca"]]},{"id":"e93a4297f7fee358","type":"switch","z":"81c478a245415a26","name":"","property":"payload[4].col4","propertyType":"msg","rules":[{"t":"gte","v":"payload[0]","vt":"msg"},{"t":"btwn","v":"payload[1]","vt":"msg","v2":"payload[2]","v2t":"msg"},{"t":"lte","v":"payload[3]","vt":"num"}],"checkall":"false","repair":true,"outputs":3,"x":1290,"y":640,"wires":[["9fb56954decf53e2"],["3143e6588c92284b"],["d7c3dee44756f704"]]},{"id":"941a26677d4950ac","type":"inject","z":"81c478a245415a26","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"10","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"date","x":160,"y":620,"wires":[["7188183f464c18a9","03332bb60fcc6b7b","6fa40203d02ecd02","8d13b0e0f1188b81","f5eef79a2fdd2027"]]},{"id":"b2342d78635ab17f","type":"debug","z":"81c478a245415a26","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1230,"y":720,"wires":[]},{"id":"9fb56954decf53e2","type":"debug","z":"81c478a245415a26","name":"high","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1470,"y":580,"wires":[]},{"id":"3143e6588c92284b","type":"debug","z":"81c478a245415a26","name":"between","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1480,"y":640,"wires":[]},{"id":"d7c3dee44756f704","type":"debug","z":"81c478a245415a26","name":"too low","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1480,"y":700,"wires":[]},{"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}]

could the decimal point be the underlying issue here?

I talking nonsense once again, sorry

1 Like

dont worry i havent a clue what im doing

1 Like

however, is the debug output on the right in the screenshot, the output you see before the switch ? Because that is a json string that needs to be converted to json (json node).

1 Like

havent the slightest....

[{"id":"81c478a245415a26","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"f5eef79a2fdd2027","type":"api-current-state","z":"81c478a245415a26","name":"Dose","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ppm_dose","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":990,"y":400,"wires":[["9fd06b41544089a5"]]},{"id":"8d13b0e0f1188b81","type":"api-current-state","z":"81c478a245415a26","name":"low ","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ppm_high","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":990,"y":460,"wires":[["9fd06b41544089a5"]]},{"id":"6fa40203d02ecd02","type":"api-current-state","z":"81c478a245415a26","name":"high","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ppm_low","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":990,"y":520,"wires":[["9fd06b41544089a5"]]},{"id":"03332bb60fcc6b7b","type":"api-current-state","z":"81c478a245415a26","name":"warn","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ppm_warn","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":990,"y":580,"wires":[["9fd06b41544089a5"]]},{"id":"d9935128d7bf4348","type":"change","z":"81c478a245415a26","name":"SMC","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":990,"y":640,"wires":[["9fd06b41544089a5"]]},{"id":"7188183f464c18a9","type":"file in","z":"81c478a245415a26","name":"read","filename":"/config/grogreen.csv","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":490,"y":640,"wires":[["ef43e9c1e4e05211"]]},{"id":"a45d65a9b5a78067","type":"function","z":"81c478a245415a26","name":"last line","func":"let lines = msg.payload\nmsg.payload = lines[lines.length - 2]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":640,"wires":[["d9935128d7bf4348"]]},{"id":"ef43e9c1e4e05211","type":"csv","z":"81c478a245415a26","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":610,"y":640,"wires":[["50e3dae4fcd841ec"]]},{"id":"e93a4297f7fee358","type":"switch","z":"81c478a245415a26","name":"","property":"payload[22]","propertyType":"msg","rules":[{"t":"lt","v":"payload[1]","vt":"msg"},{"t":"btwn","v":"payload[3]","vt":"msg","v2":"payload[5]","v2t":"msg"},{"t":"gt","v":"payload[7]","vt":"msg"}],"checkall":"true","repair":true,"outputs":3,"x":1850,"y":640,"wires":[["42648a82f42e88ac"],["3e41a137a7a6b3bb"],["af4158cc677d7dc4"]]},{"id":"9fb56954decf53e2","type":"debug","z":"81c478a245415a26","name":"high","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2310,"y":320,"wires":[]},{"id":"3143e6588c92284b","type":"debug","z":"81c478a245415a26","name":"between","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2420,"y":440,"wires":[]},{"id":"d7c3dee44756f704","type":"debug","z":"81c478a245415a26","name":"too low","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2380,"y":660,"wires":[]},{"id":"3e59506404c98320","type":"inject","z":"81c478a245415a26","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":350,"y":640,"wires":[["7188183f464c18a9","03332bb60fcc6b7b","6fa40203d02ecd02","8d13b0e0f1188b81","f5eef79a2fdd2027"]]},{"id":"50e3dae4fcd841ec","type":"join","z":"81c478a245415a26","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":730,"y":640,"wires":[["a45d65a9b5a78067"]]},{"id":"9fd06b41544089a5","type":"join","z":"81c478a245415a26","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"5","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1150,"y":640,"wires":[["5aef9e0d92d2b017","24fd468959419ba5"]]},{"id":"5aef9e0d92d2b017","type":"debug","z":"81c478a245415a26","name":"join","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1430,"y":800,"wires":[]},{"id":"902201d956b129f9","type":"debug","z":"81c478a245415a26","name":"json","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1270,"y":200,"wires":[]},{"id":"24fd468959419ba5","type":"json","z":"81c478a245415a26","name":"","property":"payload","action":"str","pretty":true,"x":1270,"y":640,"wires":[["902201d956b129f9","37a40c1c1e1bc43a"]]},{"id":"3e47576f75c8ea5f","type":"debug","z":"81c478a245415a26","name":"function","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1660,"y":260,"wires":[]},{"id":"37a40c1c1e1bc43a","type":"split","z":"81c478a245415a26","name":"","splt":"\"","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1410,"y":640,"wires":[["3e47576f75c8ea5f","700b07a94f05722b"]]},{"id":"700b07a94f05722b","type":"join","z":"81c478a245415a26","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"25","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1690,"y":640,"wires":[["da825b621df704c8","e93a4297f7fee358"]]},{"id":"da825b621df704c8","type":"debug","z":"81c478a245415a26","name":"rejoin","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1960,"y":300,"wires":[]},{"id":"3e41a137a7a6b3bb","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Correct","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":560,"wires":[["3143e6588c92284b"]]},{"id":"af4158cc677d7dc4","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Too low","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":660,"wires":[["d7c3dee44756f704"]]},{"id":"42648a82f42e88ac","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Value is high","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":440,"wires":[["9fb56954decf53e2"]]},{"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}]

I think the problem is because you have set your Join node set to create an Array
image
and your Switch is based on that array for its logic switching
as i tried to explain a few days ago but didnt expand further

the order of the msgs arriving at the Join node will determine the order of the Array elements
thats not good in this case .. we want to know where each value is

So its better to set your Join node to create a key/value Object

image

1 Like

and use change node to change payloads to msg.topics?

[{"id":"81c478a245415a26","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"9fb56954decf53e2","type":"debug","z":"81c478a245415a26","name":"high","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2310,"y":320,"wires":[]},{"id":"3143e6588c92284b","type":"debug","z":"81c478a245415a26","name":"between","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2420,"y":440,"wires":[]},{"id":"d7c3dee44756f704","type":"debug","z":"81c478a245415a26","name":"too low","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2380,"y":660,"wires":[]},{"id":"5aef9e0d92d2b017","type":"debug","z":"81c478a245415a26","name":"join","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1870,"y":740,"wires":[]},{"id":"3e41a137a7a6b3bb","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Correct","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":560,"wires":[["3143e6588c92284b"]]},{"id":"af4158cc677d7dc4","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Too low","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":660,"wires":[["d7c3dee44756f704"]]},{"id":"42648a82f42e88ac","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Value is high","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":440,"wires":[["9fb56954decf53e2"]]},{"id":"c93cfc7921d9ab1d","type":"file in","z":"81c478a245415a26","name":"read","filename":"/config/grogreen.csv","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":830,"y":640,"wires":[["15ffb5efe89899f2"]]},{"id":"0d908fac7647a52c","type":"function","z":"81c478a245415a26","name":"last line","func":"let lines = msg.payload\nmsg.payload = lines[lines.length - 2]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":640,"wires":[["97a847fc468cab54"]]},{"id":"9a7024bd3ae2906b","type":"join","z":"81c478a245415a26","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":1070,"y":640,"wires":[["0d908fac7647a52c"]]},{"id":"15ffb5efe89899f2","type":"csv","z":"81c478a245415a26","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":950,"y":640,"wires":[["9a7024bd3ae2906b"]]},{"id":"064a8ecf1b8b3bc9","type":"api-current-state","z":"81c478a245415a26","name":"dose","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_dose","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":400,"wires":[["72ca1e5f7cb84efe"]]},{"id":"9d28364b7608e890","type":"api-current-state","z":"81c478a245415a26","name":"low","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_low","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":460,"wires":[["72ca1e5f7cb84efe"]]},{"id":"feab929f3aa1dc0e","type":"api-current-state","z":"81c478a245415a26","name":"high","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_high","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":520,"wires":[["72ca1e5f7cb84efe"]]},{"id":"8c896d88b41e8007","type":"api-current-state","z":"81c478a245415a26","name":"warn","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_warn","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":580,"wires":[["72ca1e5f7cb84efe"]]},{"id":"7f8a0f29deaf5e57","type":"join","z":"81c478a245415a26","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"5","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1710,"y":640,"wires":[["692c5fd2e0e44ad2","5aef9e0d92d2b017"]]},{"id":"ab7483a0075d6763","type":"change","z":"81c478a245415a26","name":"SMC","rules":[{"t":"set","p":"complete","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1530,"y":640,"wires":[["7f8a0f29deaf5e57"]]},{"id":"692c5fd2e0e44ad2","type":"switch","z":"81c478a245415a26","name":"","property":"payload[\"[object Object]\"].col4","propertyType":"msg","rules":[{"t":"lte","v":"payload[\"6.3\"]","vt":"msg"},{"t":"btwn","v":"payload[\"5.4\"]","vt":"msg","v2":"payload[\"6.0\"]","v2t":"msg"},{"t":"gte","v":"payload[\"5.2\"]","vt":"msg"}],"checkall":"false","repair":false,"outputs":3,"x":1890,"y":640,"wires":[["42648a82f42e88ac"],["3e41a137a7a6b3bb"],["af4158cc677d7dc4"]]},{"id":"f01e451c3c2e76d0","type":"debug","z":"81c478a245415a26","name":"set topic","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1780,"y":300,"wires":[]},{"id":"7972e85909d86950","type":"inject","z":"81c478a245415a26","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":700,"y":640,"wires":[["c93cfc7921d9ab1d","8c896d88b41e8007","feab929f3aa1dc0e","9d28364b7608e890","064a8ecf1b8b3bc9"]]},{"id":"72ca1e5f7cb84efe","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1530,"y":600,"wires":[["7f8a0f29deaf5e57","f01e451c3c2e76d0"]]},{"id":"97a847fc468cab54","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1370,"y":640,"wires":[["ab7483a0075d6763"]]},{"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}]

output from join:

{"6.3":"6.3","6.0":"6.0","5.4":"5.4","5.2":"5.2","[object Object]":{"col1":"2022-01-30 07:46:00","col2":"ppm500","col3":"F","col4":1620,"col5":6,"col6":70}}

No .. just make sure all the messages arriving at the Join node have meaningful Topics

Consider this small example

[{"id":"1bc9127f8f77d7d1","type":"inject","z":"842e77cc569e9fbb","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Highlimit","payload":"3078","payloadType":"num","x":370,"y":220,"wires":[["0325e3561578a167"]]},{"id":"6a06f3295fd2037f","type":"inject","z":"842e77cc569e9fbb","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Lowlimit","payload":"2222","payloadType":"num","x":370,"y":300,"wires":[["0325e3561578a167"]]},{"id":"0325e3561578a167","type":"join","z":"842e77cc569e9fbb","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":570,"y":260,"wires":[["5bb74c4a4e6a011f"]]},{"id":"5bb74c4a4e6a011f","type":"debug","z":"842e77cc569e9fbb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":750,"y":260,"wires":[]}]
1 Like
[{"id":"81c478a245415a26","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"9fb56954decf53e2","type":"debug","z":"81c478a245415a26","name":"high","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2310,"y":320,"wires":[]},{"id":"3143e6588c92284b","type":"debug","z":"81c478a245415a26","name":"between","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2420,"y":440,"wires":[]},{"id":"d7c3dee44756f704","type":"debug","z":"81c478a245415a26","name":"too low","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2380,"y":660,"wires":[]},{"id":"5aef9e0d92d2b017","type":"debug","z":"81c478a245415a26","name":"join","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1870,"y":740,"wires":[]},{"id":"3e41a137a7a6b3bb","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Correct","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":560,"wires":[["3143e6588c92284b"]]},{"id":"af4158cc677d7dc4","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Too low","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":660,"wires":[["d7c3dee44756f704"]]},{"id":"42648a82f42e88ac","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Value is high","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":440,"wires":[["9fb56954decf53e2"]]},{"id":"c93cfc7921d9ab1d","type":"file in","z":"81c478a245415a26","name":"read","filename":"/config/grogreen.csv","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":830,"y":640,"wires":[["15ffb5efe89899f2"]]},{"id":"0d908fac7647a52c","type":"function","z":"81c478a245415a26","name":"last line","func":"let lines = msg.payload\nmsg.payload = lines[lines.length - 2]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":640,"wires":[["1ede1eea3a5e7388"]]},{"id":"9a7024bd3ae2906b","type":"join","z":"81c478a245415a26","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":1070,"y":640,"wires":[["0d908fac7647a52c"]]},{"id":"15ffb5efe89899f2","type":"csv","z":"81c478a245415a26","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":950,"y":640,"wires":[["9a7024bd3ae2906b"]]},{"id":"064a8ecf1b8b3bc9","type":"api-current-state","z":"81c478a245415a26","name":"dose","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_dose","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"dose","valueType":"str"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":400,"wires":[["7f8a0f29deaf5e57"]]},{"id":"9d28364b7608e890","type":"api-current-state","z":"81c478a245415a26","name":"low","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_low","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"low","valueType":"str"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":460,"wires":[["7f8a0f29deaf5e57"]]},{"id":"feab929f3aa1dc0e","type":"api-current-state","z":"81c478a245415a26","name":"high","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_high","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"high","valueType":"str"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":520,"wires":[["7f8a0f29deaf5e57"]]},{"id":"8c896d88b41e8007","type":"api-current-state","z":"81c478a245415a26","name":"warn","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_warn","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"warn","valueType":"str"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":580,"wires":[["7f8a0f29deaf5e57"]]},{"id":"7f8a0f29deaf5e57","type":"join","z":"81c478a245415a26","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"5","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1710,"y":640,"wires":[["692c5fd2e0e44ad2","5aef9e0d92d2b017"]]},{"id":"692c5fd2e0e44ad2","type":"switch","z":"81c478a245415a26","name":"","property":"payload[\"[object Object]\"].col4","propertyType":"msg","rules":[{"t":"gte","v":"payload.warn","vt":"msg"},{"t":"btwn","v":"payload.low","vt":"msg","v2":"payload.high","v2t":"msg"},{"t":"lte","v":"payload.dose","vt":"msg"}],"checkall":"false","repair":false,"outputs":3,"x":1890,"y":640,"wires":[["42648a82f42e88ac"],["3e41a137a7a6b3bb"],["af4158cc677d7dc4"]]},{"id":"7972e85909d86950","type":"inject","z":"81c478a245415a26","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":700,"y":640,"wires":[["c93cfc7921d9ab1d","8c896d88b41e8007","feab929f3aa1dc0e","9d28364b7608e890","064a8ecf1b8b3bc9"]]},{"id":"1ede1eea3a5e7388","type":"change","z":"81c478a245415a26","name":"SMC","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1370,"y":640,"wires":[["7f8a0f29deaf5e57"]]},{"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}]
{"warn":"6.6","high":"6.3","low":"5.4","dose":"5.2","[object Object]":{"col1":"2022-01-30 08:00:00","col2":"ppm500","col3":"F","col4":1630,"col5":6,"col6":70}}

its still not really working ill have to put more time into this

you missed one .. the SMC node .. why is its Topic set to payload ?
change it to something unique and meanigful.
what was it that that line of nodes was producing ? the csv Date ?

image

give it a topic (type string) that makes sense for you

and also make the appropriate changes in the Switch node

[{"id":"81c478a245415a26","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"9fb56954decf53e2","type":"debug","z":"81c478a245415a26","name":"high","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2310,"y":320,"wires":[]},{"id":"3143e6588c92284b","type":"debug","z":"81c478a245415a26","name":"between","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2420,"y":440,"wires":[]},{"id":"d7c3dee44756f704","type":"debug","z":"81c478a245415a26","name":"too low","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2380,"y":660,"wires":[]},{"id":"5aef9e0d92d2b017","type":"debug","z":"81c478a245415a26","name":"join","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1870,"y":740,"wires":[]},{"id":"3e41a137a7a6b3bb","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Correct","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":560,"wires":[["3143e6588c92284b"]]},{"id":"af4158cc677d7dc4","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Too low","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":660,"wires":[["d7c3dee44756f704"]]},{"id":"42648a82f42e88ac","type":"change","z":"81c478a245415a26","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Value is high","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2120,"y":440,"wires":[["9fb56954decf53e2"]]},{"id":"c93cfc7921d9ab1d","type":"file in","z":"81c478a245415a26","name":"read","filename":"/config/grogreen.csv","format":"lines","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":830,"y":640,"wires":[["15ffb5efe89899f2"]]},{"id":"0d908fac7647a52c","type":"function","z":"81c478a245415a26","name":"last line","func":"let lines = msg.payload\nmsg.payload = lines[lines.length - 2]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":640,"wires":[["1ede1eea3a5e7388"]]},{"id":"9a7024bd3ae2906b","type":"join","z":"81c478a245415a26","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":1070,"y":640,"wires":[["0d908fac7647a52c"]]},{"id":"15ffb5efe89899f2","type":"csv","z":"81c478a245415a26","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":950,"y":640,"wires":[["9a7024bd3ae2906b"]]},{"id":"064a8ecf1b8b3bc9","type":"api-current-state","z":"81c478a245415a26","name":"dose","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_dose","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"dose","valueType":"str"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":400,"wires":[["7f8a0f29deaf5e57"]]},{"id":"9d28364b7608e890","type":"api-current-state","z":"81c478a245415a26","name":"low","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_low","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"low","valueType":"str"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":460,"wires":[["7f8a0f29deaf5e57"]]},{"id":"feab929f3aa1dc0e","type":"api-current-state","z":"81c478a245415a26","name":"high","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_high","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"high","valueType":"str"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":520,"wires":[["7f8a0f29deaf5e57"]]},{"id":"8c896d88b41e8007","type":"api-current-state","z":"81c478a245415a26","name":"warn","server":"a52fadfc.d75d","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.ph_warn","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"warn","valueType":"str"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":580,"wires":[["7f8a0f29deaf5e57"]]},{"id":"7f8a0f29deaf5e57","type":"join","z":"81c478a245415a26","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"5","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1710,"y":640,"wires":[["692c5fd2e0e44ad2","5aef9e0d92d2b017"]]},{"id":"692c5fd2e0e44ad2","type":"switch","z":"81c478a245415a26","name":"","property":"payload.log.col4","propertyType":"msg","rules":[{"t":"gte","v":"payload.warn","vt":"msg"},{"t":"btwn","v":"payload.low","vt":"msg","v2":"payload.high","v2t":"msg"},{"t":"lte","v":"payload.dose","vt":"msg"}],"checkall":"false","repair":true,"outputs":3,"x":1890,"y":640,"wires":[["42648a82f42e88ac"],["3e41a137a7a6b3bb"],["af4158cc677d7dc4"]]},{"id":"7972e85909d86950","type":"inject","z":"81c478a245415a26","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":700,"y":640,"wires":[["c93cfc7921d9ab1d","8c896d88b41e8007","feab929f3aa1dc0e","9d28364b7608e890","064a8ecf1b8b3bc9"]]},{"id":"1ede1eea3a5e7388","type":"change","z":"81c478a245415a26","name":"SMC","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.log.col5","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"log","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1370,"y":640,"wires":[["7f8a0f29deaf5e57"]]},{"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}]

join:

{"log":{"col1":"2022-01-30 08:16:00","col2":"ppm500","col3":"F","col4":1630,"col5":6,"col6":70},"warn":"6.6","high":"6.3","low":"5.4","dose":"5.2"}

end:

Value is high

So its working ?

Nah it should read out between value

Iā€™ll D around with it more in a bit, gone to the store for pickup

image

Possibly because warn, high, low and dose are strings ?
and in the Switch node you expect to compare numbers with numbers
check in HA to see if there is a way to send them as numbers .. if not you have to convert them

1 Like

ok so in my haste to get out the door i hadnt noticed i was trying against wrong col...

i was using col4 when i should of used col5 to compare the values against... sorry