mblackstock / node-red-contrib-influxdb

Node-RED nodes to save and query data from an influxdb time series database
Other
64 stars 44 forks source link

influxdb in node time precision has no effect #124

Open Broadsens opened 2 years ago

Broadsens commented 2 years ago

Version [V1.x]. At "influxdb in" node, the default time precision is "ms". In the advanced query option of the "influxdb in" node, changed the time precision to "Microsecond (u)", but the query result is still showing "Millisecond (ms)" resolution in the debug window of node-RED. Also when using function node to handle the output from the node, the precision is also "ms".

What could be the cause?

Broadsens commented 2 years ago

When using the "raw output" option, then the node-RED debug window shows the precision of "Microsecond (u)" no matter what time precision is set at the advanced query option of the "influxdb in" node.

Broadsens commented 2 years ago

Solved the problem with the following approach: Read out the first data in millisecond resolution, then calculating the time passed for the remaining samples using microseconds based on the sampling rate. Use this new time stamps with microseconds resolution.

BTW, the "influxdb in" node time stamp read out is a string. We saved the time stamp with microseconds resolution to Influxdb. Checking timestamp at command line shows correct values.