How to properly use relative timestamps via delta_t in REST API? | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
How to properly use relative timestamps via delta_t in REST API?
No permission to create posts
August 20, 2017
6:27 pm
Avatar
Pavlo
New Member
Members
Forum Posts: 3
Member Since:
August 20, 2017
sp_UserOfflineSmall Offline

This is about relative timestamps mentioned in REST API https://www.mathworks.com/help/thingspeak/bulk-update-a-channel-feed-1.html

Docs states "For devices without a real-time clock, you can use relative timestamps instead of absolute timestamps. Replace the "created_at" with "delta_t"inside the updates JSON object to use relative timestamps. Here, "delta_t" represents time in seconds passed since the last measurement was recorded."

I thought it's somehow for buffering values and then submitting them at once. Should be great feature.

Intention is more or less clear, but I can't match it with TS' behavior that I see. Or, maybe,  I'm using it in some wrong way.

Actual behavior is that if I submit series of field values, TS interprets it in a way like 1st record in a series is submitted "now" and all consecutive records get's time "now"+delta_t; that is a kind of "in the future" and not in the past as I thought it should be.

I've tried to use negative values s delta_t - no luck.

I also tried to send delta_t of first record as zero and non-zero values. Though it will trigger TS to use zero as "now" and all consecutive submissions as really "relative" to this 1st series. No luck.

 

Please advice if I can somehow get it working in a way so TS treats values as "from the past" and not "from the future".

September 7, 2017
4:24 am
Avatar
Pavlo
New Member
Members
Forum Posts: 3
Member Since:
August 20, 2017
sp_UserOfflineSmall Offline

ok, so it looks like I'll have to submit data "upfront" as I have not found the way to do otherwise.

So instead of submitting data fort "past". I will send "last 5 minutes" data as is, and ThingSpeak will record them like they occurred "in the future" (next five minutes)

September 7, 2017
8:57 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 210
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

I think the intention of the timestamp field is to record the submission time. Using bulk update and relative timestamps will be difficult to get the behavior you hope for.

Is your goal to show the data with accurate datetimes on your channel page?  One possible work around would be to use a MATLAB visualization to read the data from your channel and adjust the datetimes and then re-plot the data.  If you use ThingSpeakRead() with the 'outputformat','timetable'  then MATLAB makes it easy to shift your data.  For example lag(TT,dt) shifts the data in time table TT by a value of dt.  Then you can show that visualization on your channel page.

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

harriettlf60, ShaToow, Aleftinfenny, DiaBentee, hugo11dom@gmail.com, Pisaruk530

Administrators: Hans: 387, lee: 457