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

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





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

Register Lost password?
sp_Feed sp_TopicIcon
How to properly use relative timestamps via delta_t in REST API?
Avatar
Pavlo
New Member
Forum Posts: 3
sp_UserOfflineSmall Offline
1
August 20, 2017 - 6:27 pm
sp_Permalink sp_Print

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".

Avatar
Pavlo
New Member
Forum Posts: 3
sp_UserOfflineSmall Offline
2
September 7, 2017 - 4:24 am
sp_Permalink sp_Print

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)

Avatar
cstapels

Gold
Forum Posts: 83
sp_UserOfflineSmall Offline
3
September 7, 2017 - 8:57 am
sp_Permalink sp_Print

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:
19 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 250

Vinod: 154

cstapels: 83

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

webone

KMVp

aamir786

sugengprayogi

vickysam@gmail.com

farmerkjs

Forum Stats:

Groups: 4

Forums: 17

Topics: 1289

Posts: 4481

 

Member Stats:

Guest Posters: 1

Members: 5652

Moderators: 0

Admins: 2

Administrators: Hans, lee