DS18B20 to InfluxDB and CSV

Hi all, first time user here, excited to use Node-Red for the first time but I'm a little stuck I want to read the temperature from 5 DS18B20 sensors and then send the data to InfluxDB and also to a CSV file for additional storage. The InfluxDB portion of my flow is working but the CSV part seems to be going wrong.

[{"id":"d75f132e.9cd8e","type":"influxdb out","z":"dd23e5d5.15c548","influxdb":"5bc5f00a.deb918","name":"","measurement":"sensor1","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":660,"y":460,"wires":[]},{"id":"b6ddfbdf.97f4e8","type":"influxdb out","z":"dd23e5d5.15c548","influxdb":"5bc5f00a.deb918","name":"","measurement":"sensor2","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":660,"y":520,"wires":[]},{"id":"c2542312.e7c9c8","type":"influxdb out","z":"dd23e5d5.15c548","influxdb":"5bc5f00a.deb918","name":"","measurement":"sensor3","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":660,"y":580,"wires":[]},{"id":"9f27b9f1.36709","type":"influxdb out","z":"dd23e5d5.15c548","influxdb":"5bc5f00a.deb918","name":"","measurement":"sensor4","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":660,"y":640,"wires":[]},{"id":"c389690.a122418","type":"influxdb out","z":"dd23e5d5.15c548","influxdb":"5bc5f00a.deb918","name":"","measurement":"sensor5","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":660,"y":700,"wires":[]},{"id":"8fcc8a56.3202a","type":"ds18b20","z":"dd23e5d5.15c548","name":"","sensorid":"28-3c01d075948c","timer":"0.5","x":230,"y":640,"wires":[["9f27b9f1.36709","b0bf9ead.cf673"]]},{"id":"71465659.3913a","type":"debug","z":"dd23e5d5.15c548","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":430,"y":400,"wires":[]},{"id":"58efe0b7.8cdfa","type":"debug","z":"dd23e5d5.15c548","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":430,"y":480,"wires":[]},{"id":"f92372e3.6c567","type":"debug","z":"dd23e5d5.15c548","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":430,"y":540,"wires":[]},{"id":"b0bf9ead.cf673","type":"debug","z":"dd23e5d5.15c548","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":430,"y":660,"wires":[]},{"id":"53f93d96.b06bc4","type":"debug","z":"dd23e5d5.15c548","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":430,"y":740,"wires":[]},{"id":"5bacbc37.84bd8c","type":"inject","z":"dd23e5d5.15c548","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":810,"y":360,"wires":[["6908bcd8.103e84"]]},{"id":"915cad23.91c21","type":"file","z":"dd23e5d5.15c548","name":"","filename":"/home/pi/datalog/temperature.csv","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":1660,"y":560,"wires":[[]]},{"id":"96c31caf.d53848","type":"function","z":"dd23e5d5.15c548","name":"temp_a22d2","func":"msg.topic = \"B-Temp1\"\npayload = msg.payload.number;\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":980,"y":500,"wires":[["42606179.1961d8"]]},{"id":"24db0593.bad732","type":"function","z":"dd23e5d5.15c548","name":"temp_9b846","func":"msg.topic = \"C-Temp2\"\npayload = msg.payload.temperature;\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":981,"y":540,"wires":[["42606179.1961d8"]]},{"id":"42606179.1961d8","type":"join","z":"dd23e5d5.15c548","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":"num","reduceFixup":"","x":1210,"y":560,"wires":[["63a4147f.5be21c","46fb648a.fa1dfc"]]},{"id":"6908bcd8.103e84","type":"function","z":"dd23e5d5.15c548","name":"time","func":"msg.topic = \"A-time\"\nvar d = new Date();\nvar t = d.getTime();\npayload=t;\nmsg.payload=payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":959,"y":460,"wires":[["42606179.1961d8"]]},{"id":"63a4147f.5be21c","type":"csv","z":"dd23e5d5.15c548","name":"","sep":",","hdrin":"","hdrout":"","multi":"one","ret":"\\n","temp":"Time, Temp1, Temp2, Temp3, Temp4","skip":"0","strings":true,"include_empty_strings":true,"include_null_values":true,"x":1430,"y":560,"wires":[["915cad23.91c21"]]},{"id":"46fb648a.fa1dfc","type":"debug","z":"dd23e5d5.15c548","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1430,"y":500,"wires":[]},{"id":"5ae59770.ecac38","type":"function","z":"dd23e5d5.15c548","name":"temp_85e65","func":"msg.topic = \"D-Temp3\"\npayload = msg.payload.temperature;\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"x":982,"y":580,"wires":[["42606179.1961d8"]]},{"id":"898eac8b.3eddf8","type":"function","z":"dd23e5d5.15c548","name":"temp_8b38d","func":"msg.topic = \"E-Temp4\"\npayload = msg.payload.temperature;\nmsg.payload = payload;\nreturn msg;","outputs":1,"noerr":0,"x":983,"y":620,"wires":[["42606179.1961d8"]]},{"id":"21d7a969.641c6e","type":"ds18b20","z":"dd23e5d5.15c548","name":"","sensorid":"28-3c01d075948c","timer":"0.1","x":210,"y":460,"wires":[["d75f132e.9cd8e","71465659.3913a","96c31caf.d53848"]]},{"id":"91a79919.85518","type":"ds18b20","z":"dd23e5d5.15c548","name":"","sensorid":"28-3c01d075272c","timer":"0.1","x":210,"y":520,"wires":[["b6ddfbdf.97f4e8","58efe0b7.8cdfa","24db0593.bad732"]]},{"id":"f538a21b.6c7fb8","type":"ds18b20","z":"dd23e5d5.15c548","name":"","sensorid":"28-3c01d075a042","timer":"0.1","x":210,"y":580,"wires":[["c2542312.e7c9c8","f92372e3.6c567","5ae59770.ecac38"]]},{"id":"a3f1689d.c6255","type":"ds18b20","z":"dd23e5d5.15c548","name":"","sensorid":"28-3c01d075d4dd","timer":"0.1","x":210,"y":700,"wires":[["c389690.a122418","53f93d96.b06bc4","898eac8b.3eddf8"]]},{"id":"5bc5f00a.deb918","type":"influxdb","hostname":"192.168.1.105","port":"8086","protocol":"http","database":"temp_logger","name":"Data Storage Sensor ","usetls":false,"tls":"","influxdbVersion":"1.x","url":"http://localhost:8086","rejectUnauthorized":true}]

Just the flow probably doesn't really help us understand here. A screenshot of your flow and a description and/or screenshot of the incorrect data may help.

What ds18b20 contrib node are you using? node-red-cintrib-???????

What is coming out of the debug node after the join node?

If the ds18b20 node returns the id of the device, you could combine the function nodes into one.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.