How to customize the timestamp of a post request?

Hi there,

Fresh new user of Thingerio here.

I am using the service as an air quality indicator dashboard.
For that purpose, I am sending from a raspberry pi a pyton request to Thingerio to feed my bucket.“[USER]/devices/[DATA]/callback/data”, headers=Headers,json={“CO2”: self.AMP_CO2, “PM25”:self.AMP_PM25, “PM10” : self.AMP_PM10, “Temperature_Actual” : self.AMP_TEM, “Temperature_Calibrated” : self.AMP_TEMP_CAL, “Humidity” : self.AMP_HUM, “TVOC” : self.AMP_TVOC, “IAQ” : self.AMP_IAQ , “Wind_Dir” : self.AMP_WindDir })

My issue is related to the last parameter Wind dir which is the wind direction I collect from a public web site where I live: It has 10min lag. So currently my bucket record is having T0 data for all parameter but T0-10 for that one.

I saw it’s possible to send data with customized timestamp. In that case I would split my data into 2 buckets and have the wind dir submitted with its own ts I get from the website API.

My issue is: I don’t see where I can specify the ts value since in the example on thingerio, it’s part of a higher level json they specify in the case of a device setup, not a http request setup.

In other words, in the code I share here, ts is not part of the json={xxx} but at the higher level.
Using the bucket inspector I see the field is outside my json data:

“bucket”: “ID”,
“data”: { <===== This is what the POST sends a json payload
“M”: {
“CO2”: {
“N”: “448”
“Humidity”: {
“N”: “78.581629681296235”
“IAQ”: {
“N”: “75”
“PM10”: {
“N”: “5”
“PM25”: {
“N”: “5”
“TVOC”: {
“N”: “457”
“Temperature_Actual”: {
“N”: “35.509999999999998”
“Temperature_Calibrated”: {
“N”: “29.809999999999999”
“Wind_Dir”: {
“N”: “10”
“event”: “bucket_write”,
“ts”: 1682665767831, <===== This is what I would like to customize.
“user”: “[USER]”

Any idea?

Thanks a lot


The ts value is stablished automatically by default to current time by the server, but if you send that value, it will take it as the received dataset’s timestamp, so basically what you need to do is to declare the ts value at the post request.

Hope this helps.

Thanks for your reply however I am not clear how to do that.

As you see, the json data I send is not having a ts member as it belongs to the upper level of the json the server is using. I put the snippet from the inspector: i see the ts is part of an encapsulating json part that contains the json I send as payload.

Do you have an example on how to do what you describe?

I couldn’t find any.



Try something like this:

{“ts“:1682975023000,“CO2”: self.AMP_CO2, “PM25”:self.AMP_PM25, “PM10” : self.AMP_PM10, “Temperature_Actual” : self.AMP_TEM, “Temperature_Calibrated” : self.AMP_TEMP_CAL, “Humidity” : self.AMP_HUM, “TVOC” : self.AMP_TVOC, “IAQ” : self.AMP_IAQ , “Wind_Dir” : self.AMP_WindDir })

Note that the json has a ts value, that timestamp should override the default ts stablished at the server.

Let us know how it goes.

1 Like

Thank you!!

Will have a try and let you know.