The Things Stack and bucket Timestamp

Howdy partners, I’m looking to clarify where thinger obtains the timestamp added to data points in the buckets, in particular when using the The Things Stack plug-in.

I found an older post indicating that if a ‘ts’ variable containing the epoch time in milliseconds that will be used when data is added to bucket. But I’m unclear if this is the case if data is coming in through the TTS plug-in.

In looking inside the JSON data sent by TTS I find few possible timestamps. If I remove all the non time related data, the JSON packet has:

{
“received_at”: “2023-02-04T20:49:44.292908940Z”,
“rx_metadata”: [
{
“time”: “2023-02-04T20:49:42.603601Z”,
“timestamp”: 1331533220,
“received_at”: “2023-02-04T20:49:43.970026717Z”
}
],
“settings”: {
“timestamp”: 1331533220,
“time”: “2023-02-04T20:49:42.603601Z”
},
“received_at”: “2023-02-04T20:49:44.087826650Z”,
}

Does anyone know if I include an epoch timestamp variable “ts” in the payload, if thinger.io plug-in will used that as the timestamp for the data point in bucket?

The reason I’m looking for the information is so I can come up with a way to send backlog data in case of communication problems between my end-device (sensor node) and the TTS app servers.

Cheers and thanks in advance.

-jjo

Hi,

Of course you can establish the dataset’s timestamp, just need to add the “ts” variable and add the time in ms, in this way the bucket will register the received timestamp and won’t add the default current time timestamp.

Hope this helps.

Thanks for confirming @ega ! This feature will save me some trouble from the TTN/TTS side.

For the record and future reference, I confirmed that decoding a 32 bit variable named ‘ts’ from the TTN side will cause thinger to use it as the timestamp for the data point. For this to work it is best to have an RTC on the device generating or aggregating the data before it is sent to TTN.

2 Likes