NodeRED > Influx - Time way ahead

Hi Community,

i am facing a weird problem. I try to use the node-red-contrib-influxdb node to store some data. After i inject, the data is stored in influxdb but the date is way off... checked system time on influx-server and node-red-host but they're fine.
Time precission is set to milliseconds in influxdb-out-node.

Thanks for reading. Hope you have some hints.

Are node-red or influxdb installed using Docker?
Which version of node-red, node-red-contrib-influxdb, and influxdb server are you running?
Also check the time and zone on the machine running the browser.

Hi Colin,

node-red: 3.0.2
node-red-contrib-influxdb: 0.6.1

You're right! NodeRED and InfluxDB are installed using Docker.

Time and zone are also ok the machine running the browser.

Open shells into the docker containers and check the date/time and zone there.

it is a longshot, but can I just check that when checking the system date you were not confused with European Vs American date formats?

Date in InfluxDB-Container:
root@24e57e6ab7d0:/# date
Mon Feb 6 18:57:18 UTC 2023
root@24e57e6ab7d0:/#

Date in NodeRED-Container:
bash-5.1$ date
Mon Feb 6 18:58:05 UTC 2023
bash-5.1$

seems like they're ok besides -1h off

[EDIT: Corrected Time in Containers to Europe/Berlin]

You didn't say which version of influxdb you are using. I guess it is 2.x, looking at the output in the screenshot. Are you using the latest 2.x version.

Very odd. When you send just a value to the influx out node the db server should add the timestamp as the current time.

What query are you using to get the data for the screenshot? Is it possible to show the time value as a number rather than interpreted as in your screenshot?

Can you select those three nodes and Export them and paste here please? I don't know what it will tell me, but you never know. When pasting use the </> button at the top of the forum entry window.

Is the problem consistent? If you write other data is it also 35 days in the future?

It seems like setting the time in the Docker-Container did the job.
Don't know why but today i trye'd to insert some data and the date is ok.

grafik

The query is just the standard mean with time-window in InfluxDB

from(bucket: "stromzaehler")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "1222323")
  |> filter(fn: (r) => r["_field"] == "value")
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> yield(name: "mean")

Here comes the flow-json-export

[{"id":"1d309d49f4c62878","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"b9e9508e71065579","type":"debug","z":"1d309d49f4c62878","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":380,"y":40,"wires":[]},{"id":"b7b74e122516f074","type":"influxdb out","z":"1d309d49f4c62878","influxdb":"06b701234eeb0410","name":"out","measurement":"","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"hell@home","bucket":"stromzaehler","x":370,"y":80,"wires":[]},{"id":"1e925e6389d8b6aa","type":"inject","z":"1d309d49f4c62878","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":90,"y":60,"wires":[["9e231fbea462b298"]]},{"id":"9e231fbea462b298","type":"function","z":"1d309d49f4c62878","name":"function 5","func":"msg.measurement = 1222323\nmsg.payload = {\n    value: 424892348923\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"moment","module":"moment"}],"x":220,"y":60,"wires":[["b9e9508e71065579","b7b74e122516f074"]]},{"id":"06b701234eeb0410","type":"influxdb","hostname":"quintsor-castle.de","port":"8086","protocol":"http","database":"database","name":"","usetls":false,"tls":"","influxdbVersion":"2.0","url":"http://89.58.12.194:8086","rejectUnauthorized":false}]

The problem was consistent.

Thanks for your time and effort!

Did you drop the measurement and start again before each test? I wonder whether you had that record in there and later tests were adding new records at the right time but you were only seeing the one left from previous tests.

On a separate issue, that seems an odd measurement name. I am guessing, but do you have several measurements with similar names? If so then have you considered whether they should all be in one measurement with the number as a tag?

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