Influx_V2 historic data not being accepted from nodeRed and being overwritten to now rather than actual timestamp

Hey guys,

I am wondering if anyone has any experience with nodered influxdb stack.

I am calling data from a complex device, the data is called line by line from its measurement start until it catches up wiht realtime.

my probelm is that when i get the data formatted ready for influxdb i have this format

{“measurement”:“Measurement name”,“payload”:[{“Time /s”:234191.298,“U /V”:1.610985517501831,“I /A”:4.988839149475098,“P /W”:8.036947618950535,“Date Time /ns”:1771838354.2979949},{“Cycle number”:1,“Loop 1 number”:0,“Loop 1 iteration”:2},1771838354952],“_msgid”:“17d5e01d0474e279”}

the problem is that the timestamp portion of the message doesnt seem to work and influx just moves the data to now rather than logging historically.

Here you can see that the data is being added to the data base but it should be appearing in the 20th/21st but it is appearing now — 23rd.

Node-RED nodes for InfluxDB consist of InfluxDB out, InfluxDB in, and InfluxDB batch. Which of these 3 Nodes are you using to send the data to InfluxDB?

Are you saying that Node-RED is applying the current time to the timestamp when populating the data in InfluxDB (instead of the past timestamps)? Here is your JSON formatted:
{
"measurement": "Measurement name",
"payload": [
{
"Time /s": 234191.298,
"U /V": 1.610985517501831,
"I /A": 4.988839149475098,
"P /W": 8.036947618950535,
"Date Time /ns": 1771838354.2979949
},
{
"Cycle number": 1,
"Loop 1 number": 0,
"Loop 1 iteration": 2
},
1771838354952
],
“_msgid”: “17d5e01d0474e279”
}

I would think that using the InfluxDB batch node, your payload from Node-RED would look something like this:

msg.payload =

{
measurement: "Measurement name",
fields: {
"Time /s": 234191.298,
"U /V": 1.610985517501831,
"I /A": 4.988839149475098,
"P /W": 8.036947618950535,
},
tags:{
"Cycle number": 1,
"Loop 1 number": 0,
"Loop 1 iteration": 2
},
timestamp: 1771838354952
};

Hey grant1,

thanks for your reply - i was using the normal INFLUX out node which i think was the issue.

i changed over to the batch with similar formatting as you suggested and now the data is arriving when it was recorded! thanks for the help

@Oliver_Fernihough Great! Please mark the above as “Solution” so others can find it in the future.

1 Like