Hi, I’m currently using an Arduino Nano Connect RP2040 to send pressure sensor readings to a Data Bucket every 30 minutes. I’ve done this by setting up an outputValue resource and streaming it in loop{} every 30 mins.
The use case I want will mean the user may go out of range of wi-fi throughout the day. Is there any way using Thinger that I can store the data on the Arduino when disconnected from the wi-fi, and then on reconnection, send all of the data that I have saved.
Currently it cannot be done, due the thinger cloud establish the timestamp, maybe this could be a feature to request, the hability to store the timestamp directly from the remote device, to save the offline data and then update when the connection comes back.
Thanks for your response @ega, I thought that might be the case. Where do we place feature requests? Do you know if there is an easy way to ask Thinger to send the current timestamp to the device when there is a connection established?
devices can actually set the timestamp on the bucket, as long as you send it in the payload, i.e., you can use the write_bucket function with a payload like the following:
{
"ts": 1647289544240,
"pressure": 2.33
}
(ts is a timestamp field, which holds a unix timestamp in milliseconds: ms from 1/1/1970).
The problem here is that the device must use an RTC, and probably use NTP for sync time on boot, but it is feasible. Hope it helps!
Very interesting. I didn’t know this option was possible.
If it’s not in the documentation, it would be important to include it. An example demonstrating how to enter 20 pressure measurements with the respective timestamp, sending them all at once to the Thinger Server.
Thanks for the tip.
Hi @alvarolb, thanks very much for this information. Is ts something which thinger.io recognises as a timestamp and hence converts this into a date/time format e.g. 2022-03-17T15:16.00.000Z ? Or is ts just a variable that you created which just sends the timestamp in milliseconds to the bucket, as well as showing the Date column as the timestamp when it entered the bucket?
A Unix Timestamp is just a way to describe a point in time. Thinger.io use them to store the date/time of any given bucket entry. It is used always as an UTC time, so, we can later convert it to different timezones in the representation (i.e. dashboards). In the buckets section, what you see is a conversion from this timestamp to a ISO String representation, which is much more user-friendly.
So, what thinger does in any data being written to the bucket, is to check if it contains the ts key. It it is present, then, it does nothing and insert the provided timestamp (it must be unix timestamp in milliseconds). If the value is not present, then, it injects the current timestamp taken from the server.
That is a great information. So one can save massively power upon storing e.g. the minute-paced information in a local buffer and updating Thinger every 10 minutes at once with only one call?
Can we put the time stamp several times in one message or do we imperatively need a discrete message for every sequenced event?