From Influx IN node to CSV-file problem

In a simple flow, data is read from an Influx Database with, in addition to the timestamp, only one field namely "luchtdruk". The data is converted to a CSV file but in that file there are extra quotes (image).

Can someone tell me why this isn't working?

[{"id":"f12f6f56.44f4d","type":"tab","label":"CSV Range Forum","disabled":false,"info":""},{"id":"9d9141a6.1b19d","type":"influxdb in","z":"f12f6f56.44f4d","influxdb":"92192c23.a0c2c","name":"Read from InfluxDB","query":"SELECT \"time\",\"luchtdruk\" FROM \"luchtdruk\" WHERE time > now() - 1h","rawOutput":false,"precision":"","retentionPolicy":"","org":"organisation","x":310,"y":80,"wires":[["63535a51.f1eac4"]]},{"id":"fc96823.e15978","type":"inject","z":"f12f6f56.44f4d","name":"Inject","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":80,"wires":[["9d9141a6.1b19d"]]},{"id":"9bbfcc1.a59393","type":"debug","z":"f12f6f56.44f4d","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":80,"wires":[]},{"id":"63535a51.f1eac4","type":"csv","z":"f12f6f56.44f4d","name":"Generate CSV","sep":",","hdrin":false,"hdrout":"none","multi":"one","ret":"\\n","temp":"time,luchtdruk","skip":"0","strings":true,"include_empty_strings":false,"include_null_values":false,"x":520,"y":80,"wires":[["9bbfcc1.a59393"]]},{"id":"92192c23.a0c2c","type":"influxdb","hostname":"192.168.2.185","port":"8086","protocol":"http","database":"luchtdruk","name":"Luchtdruk","usetls":false,"tls":"1e7c3760.240cb9","influxdbVersion":"1.x","url":"192.168.2.185:8086","rejectUnauthorized":false},{"id":"1e7c3760.240cb9","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":true}]

db

2

Put a debug on the output of the influx node and show what is coming out

Thanks Paul, below the output:

interesting...when I setup asn inject to send the data, here is my result:
Screen Shot 2021-06-08 at 8.03.20 AM

what is the influx schema for this?
What version of NR?
What platform?
what version of the CSV node?

p.s. I'll be gone for an hour or so.

here is ny test flow:

[{"id":"f12f6f56.44f4d","type":"tab","label":"CSV Range Forum","disabled":false,"info":""},{"id":"fc96823.e15978","type":"inject","z":"f12f6f56.44f4d","name":"Inject","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"time\":\"2021-06-08T09:46:28.109Z\",\"luchtdruk\":11023.2},{\"time\":\"2021-06-08T10:01:29.438Z\",\"luchtdruk\":11023.2}]","payloadType":"json","x":150,"y":200,"wires":[["883b652f.4e99b","63535a51.f1eac4"]]},{"id":"9bbfcc1.a59393","type":"debug","z":"f12f6f56.44f4d","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":160,"wires":[]},{"id":"63535a51.f1eac4","type":"csv","z":"f12f6f56.44f4d","name":"Generate CSV","sep":",","hdrin":false,"hdrout":"none","multi":"one","ret":"\\n","temp":"time,luchtdruk","skip":"0","strings":true,"include_empty_strings":false,"include_null_values":false,"x":400,"y":160,"wires":[["9bbfcc1.a59393"]]},{"id":"883b652f.4e99b","type":"debug","z":"f12f6f56.44f4d","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":410,"y":240,"wires":[]},{"id":"efc11cbe.d6f288","type":"inject","z":"f12f6f56.44f4d","name":"Inject","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"time\":\"2021-06-08T09:46:28.109Z\",\"luchtdruk\":11023.2},{\"time\":\"2021-06-08T10:01:29.438Z\",\"luchtdruk\":11023.2}]","payloadType":"json","x":150,"y":100,"wires":[[]]}]

Your test flow works here too, without the extra quotes. NodeRED is 1.3.4, the CSV-node shows 1.2 and running NodeRED on a RPI-4. Please see the image above for the InfluxDB info.

Missed that (influx) - I’ll take a deeper look when I get back

I've reproduced the problen and am going to look at the code. Someting is tickling my head about a similar situation not too long ago....but it might have been a different node.

Hans,

Ok I know what is causing the issue. an Influx timestamp is stored in nanoseconds while a javascript timestamp is stored in milliseconds. The Influx node doesn't know what datatype it is and thinks it is an object and that is why things get messy.

If you divide the returned timestamp(s) by 1000 then Node-RED/(JavaScript)/the CSV node can handle it.

I've opened an issue on the nodes Github page if you want to follow it:

When Node-red starts processing the

1 Like

Thank you for your kind help, solved!

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