Time problem with a group of messages

Hello, I'm requesting your help, my sensor send me actually a packet of 3 messages in 1 message with 3 measurements, 1 every X minutes. My payload contains the time beetween 2 measurements. I know that I can split it in 3 messages but I don't know how to manage the time stamp to display it.
I'm using InfluxDB to store my data and then to display it on grafana.
(sorry for my English, if something is not clear please tell me)

Thank you,

use a change node to set msg.sensor_timestamp to the timestamp variable. Then send the output to a split node. Each new msg will include in msg.sensor_timestamp the original value.

Thank for your reply but i do not understand it, I should convert my timestamp to my variable like 15 minutes (wich means on measurement every 15 minutes) ? And then split this message in 3 messages ?

As I understand you, your message comes in containing three peices of data and a time measurement.

If you want three msgs, each containing the time measurement, then use the change node to add a new field to the msg object. You can call it anything, but for this example let us say it is msg.time_between. In the change node to copy the time between 2 measurements to msg.time_between. Then you will have your msg with the treee measurements AND a new piece of the msg: msg.time_betrween.

It would be easer to explain if you showed a debug of your data coming in.

Now when you split the msg into three messages, each one will contain msg.time_between.

Can you post an example debug output ?

Also explain again exactly what you are trying to do.

Ok sorry I think I was not clear, I'm sorry. I will try to explain you my aim: To save energy my device is sending a message only one time X hours, every message contains not one but 3 measurements and one information about the time measurements (X) and also only one time stamp. What I have to do is to split my message in 3 messages, each one will contain 1 measurement and one time_stamp.
Per example: if I received one message at 11AM with the info that X=1 hour it's mean that I need to split in 3 messages: the first with a time_stamp equals to 9AM, the other one 10 AM and the last one 11AM.
Thank you for your help

Can you show us what the debug output looks like of a single message with the 3 measurements ?

So the time for

  • the first measurement is current time - (2 x X) hours
  • the second measurement is current time - (1 x X) hours
  • the third measurement is current time

So you should split the original message into the three parts, then use a switch to send the three parts to different paths - the path for the first measurement will use a change node to set the time to now - 2 hour. In the change node use the jsonata option with the code $milli()-7200000

  1. $millis() returns the timestamp as the number of milliseconds since midnight on 1st January 1970 UTC (the Unix epoch).
  2. Two hour = 7,200,000 milliseconds

ou should be able to figure out the rest

I dont" what to show you it's like a regulard payload with 14 hex with 2 hex for each temperature (so 6 hex) and one hex for the time beetween measurements.

Oh thank you for your solution, I'm going to do that, I need then to store this data in influxDB, and to display it in Grafana. How can I manage this difference of time to see a chart with my 3 data with X hours of difference beetween each measurements ?
Thank you for your replies

The problem is not an influx to grafana issue, but making sure that when you write the data to influx you write the correct timestamps for each sample. You must take @zenofmud's advice and split the data into three values each with the adjusted timestamp and put that into influx. Then Grafana will show it correctly.

First sorry for my late reply, now I have successed to split in 3 different messages with 3 different payloads, last question: how to inject in influxdb my timestamps ? Actually (and it's working) my paylod is an array with [0]= fields and [1]= tags so where do I have to put my time stamp ?
This is what i am currently injecting in InfluxDB:
Thank you
image

I think you have to use the influxdb batch node for this.