last_entry_id
1 view (last 30 days)
Show older comments
ThingSpeak auto assigns an unique identifier to each new inbound record for a given channel. Within the record the identifier is named 'last_entry_id.' Each auto assigned id is auto increment by one over the previous id. What is the largest numeric value that last_entry_id will reach? If there is an upper bound, what will happen when it is reached? Will a roll over occur such that last_entry_id is reset to 0 or 1?
Thanks in advance for the information.
1 Comment
Craig Larson
on 19 Dec 2021
@Jay Hicks: May I ask how you obtain the 'last_entry_id' in your code? I have a need for this data element also. My sensor is writing data and estimated time to Thingspeak in a bulk-uploading of 20 data records inorder to save on battery life of the ESP8266 transmitter. Sometimes there are timestamp overlaps, and sometimes there are gaps due to the estimated time. When there are overlaps the data is no longer in order of the 'entry_id'. I can see the 'entry_id' values in worksheets exported from Thingspeak. But I'm trying to use Matlab code to sort this out from inside Thingspeak using a custom App only I don't know how to access 'entry_id'. Thanks in advance.
Answers (2)
Christopher Stapels
on 14 Oct 2020
Can you describe why you need the last_entry_id?
It is not recommended to be used for the reasons you mention (rollover, finite upper bound.)
Christopher Stapels
on 21 Oct 2020
I suggest that this is not the most viable method. There could be unexpected ways that last_entry_id does not always behave as you would like. I would reccomend that you use timestamp comparisons to detect missing data and to cycle through the recently read data. They may be slightly harder to write, but I think they will be more robust. In MATLAB, you can convert timestamps into numeric representations for fast comparison. You can use datenum() on a timestamp to get a number of days since a set time, or compare datetimes to get durations.
0 Comments
Communities
More Answers in the ThingSpeak Community
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!