How to upload set of stored timestamp with historical data

Hello,
I’m saving data with timestamp when blynk is offline,So I tried send saved data to blynk using Blynk.virtualWrite() function of [Blynk.virtualWrite(Vx, Value, timestamp); ] but data’s not sent.

I see another option in blynk documention (below i shared images). how to use this function [[timestamp, value]] or Any example program for that.

Thanks.


The documentation you’ve quoted is from the Blynk HTTPS API section, so you’d need to make an API call to do this. Whilst this is not straightforward, it’s certainly do-able.

Alternatively, you may be able to use the Blynk.beginGroup(), Blynk.endGroup() with optional timestamp, but it really depends more on your use-case.

Is this as deep-sleep project where youre waking-up your device every x seconds then uploading data say every x times 10 seconds, or it it simply about maintaining a complete history during connectivity outages?

The solution you choose will depend on how many datastreams you want to update for each timestamp period and how many unique timestamps you want to upload in each batch.

The operation of this process also depends to a degree on how you are ensuring the correct UNIX x 1000 timestamp (are you using external RTC hardware?) and how you are storing the data values prior to upload.

If you provide more info then I could probably point you in the most appropriate direction.

Pete.

Thanks for your reply,

yes I’m using external RTC .
In this project ,esp32 reading the sensor values and usually send the data’s to blynk through
eg : Blynk.virtualWrite(V0, humidity) function.

while bylnk or internet online, esp32 posting the data continuously and stored the data’s in FRAM when Blynk or internet is offline.

I have totally 20 datastreams for each timestamp( 5 minutes once).

if any possible for blynk response to esp32 when blynk not receive data .

Okay, your response is slightly ambiguous.
I think you’re saying that…

Your device takes readings every 5 minutes and uploads the results to 20 different datastreams in Blynk if the device is online.

When the device is offline these data reading are saved to an external FRAM device rather than being stored in SPIFFS or LittleFS.

When the device comes back online you want to be able to upload all the data stored in FRAM to the 20 datastreams in Blynk, with the correct timestamps.

Is that correct?

There is no handshake between the Blynk server and the Blynk C++ library to acknowledge that data sent via Blynk.virtualwrite has been correctly received.

If you used the HTTP(S) API then I seem to think you do get a 200 response code if the data was received, but you’d need to test this.

Pete.

yes exactly.
How to implement this?

The documentation for the Blynk.beginGroup(ts), Blynk.endGroup() functionality would seem to allow you to achieve an upload of 20 datastreams with the same (specified) timestamp…

I’ve not tried this, but it seems that it should work.

How you implement the writing of data to your FRAM device if Blynk.connected() == false then extract and upload this data to Blynk in batches once the connection is re-established will depend on your existing codebase.

Pete.

1 Like

Thanks for your understanding my queries.
I have tried and its working.

Thanks.

1 Like