Update Multiple data with Absolute time stamp


#1

Hello,

I’m developing a device, arduino based, for upload a meteo data to ubidots platform. I have a question about a possibility to upload a bulk file with absolute time stamp. Does it possible to Write many entries to my channel, with a single http request in Ubidots Environment?

I use arduino uno and sim 900 ( Ubidots Arduino GPRS library).

Thank you

Francesco-Italy


#2

Hello @idroino,

Firstly, I would like to clarify something… What do you mean by “Absolute timestamp”?

To upload multiple data with a different timestamp in single HTTP request you should use the following endpoint and payload structure:

http://things.ubidots.com/api/v1.6/devices/{LABEL_DEVICE}/{VARIABLE_LABEL}/values

[{“value”: 10, “timestamp”:1464661369000}, {“value”: 12, “timestamp”:1464661369999}, {“value”:n, “timestamp”:n}]

Please, refer to this link to find all the information needed.

All the best,
Maria C.


#3

Thank you very much.This is exatly that I wondering.
For Absolute timestamp i i mean a value that has a specific time of entry, different of the upload time, in ubidots personal dashboard.

I have another question about the code:

I use a specific library ubidots-arduino-gprs for connect my sim module to Arduino

I try to change this code but the upload don’t works appropiatly:

void loop() {

_ float value = 1;_
_ int timestamp;_
_ sprintf(timestamp, “1525635620”); //Sends latitude and longitude for watching position in a map_
_ client.add(VARIABLE_LABEL, value, timestamp); // Change for your variable name_
_ client.sendAll();_
}

the first part, is the same of Example UbidotsSaveValueWithContext;

Thank you for your help

Francesco P.


#4

Hey Francisco!

I’m glad to read that, we are here to help! :smiley:

In the loop of the code I can see that you have assigned the timestamp instead of the context as it’s mentioned in the comments of the code. Based on this, what do you desire to assign a context or timestamp?

Now, based on what you desire to sent you should follow the next points:

  • Send context:
Ubidots::add(char *variable_label, double value, char *ctext)

Example:

  sprintf(context, "lat=1.2343$lng=132.1233"); 
  client.add(VARIABLE_LABEL, value, context); 
  • Send timestamp:
 Ubidots::add(char *variable_label, double value, char *ctext, long unsigned timestamp_val)

Example:

  sprintf(timestamp, "1531143251");
  client.add(VARIABLE_LABEL, value, NULL, timestamp); // Change for your variable name

I hope this would help you!

All the best,
Maria C.


#5

Thank you,

yes I’ll send timestamp to ubidots.

I looked at your second example and I wrote the following code (the first part is the same of my last example):

void loop (){

double value = 9999;
long unsigned timestamp;
char context[25];

sprintf(timestamp, “1525635620”); //Sends latitude and longitude for watching position in a map
client.add(VARIABLE_LABEL,value,NULL,timestamp); // Change for your variable name
client.sendAll();
}

Unfortunately the value isn’t loaded on my dashboard.

Maybe something miss in my code, but i don’t now,

Thank you for your help

Francesco P.


#6

Hey @idroino,

Taking a look of the code everything seems to be ok! Anyway, I’m going to make a test by my side and I will let you how everything goes :smiley:

All the best,
Maria C.


#7

Thank You I’ll wait your text!:pray:

Best Regards,

Francesco P.