Updating existing record in ThingSpeak
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I am writing rainfall data from ESP8266 to a TS Channel every 10 minutes - Weather Regular Channel.
I have created a Matlab Analysis that will run on React to update another channel with Daily Weather information - Weather Daily Channel. This channel should only have ONE entry per day, that is updated continuously.
My Analysis is doing to checking to see if the entry should be a new one (if it is the first one for the day) or if there is an existing entry that should be updated.
How do I update the existing entry if it should be updated?
I have tried the following where LastDailyTS(1,1) is the timestamp of the existing record that should be updated:
thingSpeakWrite(writeChannelID,LastRegularData(:,2),LastRegularData(:,3),RainFallTot], 'WriteKey', writeAPIKey, 'TimeStamp',[datetime(LastDailyTS(1,1),'format','MM/dd/uuuu HH:mm:ss')] );
I am getting this error when compiling:
Error using Rainfall Totalizer (line 46)
URL is incorrectly formed, or the requested feature is not supported in this version of ThingSpeak.
Is it even possible to update an existing record? Is there another way of doing the same?
Thanks for the help...
0 comentarios
Respuestas (1)
Saurabh
el 22 de Oct. de 2024
I understand that you want to update the timestamp of the existing record.
While going through the documentation of 'thingSpeakWrite' I found out that the "Timestamp of data values written to fields in the write channel, specified as a comma-separated pair consisting of 'Timestamp' and a value. The value must be a MATLAB datetime value. All timestamps must be unique. If you submit duplicate timestamps, all your updates are rejected, otherwise only updates with timestamps already in channel are rejected."
So, there is the limitations that the all "timestamps" must be unique. You cannot write new data with timestamps that match existing data in the channel.
As a workaround consider updating other Name-Value arguments, that would avoid creating new entry for particular day.
For more information on the 'thingSpeakWrite', refer to the following link:
I hope this helps.
2 comentarios
Saurabh
el 23 de Oct. de 2024
Thank you for your response. I have come across a similar discussion on this topic. It suggests that the issue can be resolved by clearing the channel and re-uploading the data. For a detailed step-by-step guide, please refer to the following link.
If there is the need to delete a record, you can refer to the following thread. It outlines the process of exporting the file, editing the exported file, and deleting the necessary records.
I hope this helps.
Ver también
Categorías
Más información sobre Prepare and Analyze Data en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!