Plugins and UTC Time | ThingSpeak Plugins | 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
Plugins and UTC Time
Avatar
sturbo177

Silver
Forum Posts: 5
sp_UserOfflineSmall Offline
1
July 1, 2015 - 11:07 am
sp_Permalink sp_Print

I've been playing with ThingSpeak plugins in order to determine the best method of generating a specific chart that I'm after. All I'm looking to do is to plot the first value for every day on a single chart (for say 180 days or so).

I thought this was going to be easy, as I'm not looking for too many data points, and ThingSpeak provides the "timescale=daily" option for this processing to occur on the server. However, daily only works for the UTC day, not for time zones. I'd like to be able to apply an offset, for example, I'm after the first value that is entered every day in EST time, NOT UTC time.

Are there any plans to allow the daily calculations to be offset on the server side? If not, I have to query all of the data and do this myself. Not that big of deal really, except that with the 8000 value limit I'll have to do this many times to get the few values I'm after!

Thoughts?

Avatar
lee

Forum Posts: 457
sp_UserOfflineSmall Offline
2
July 1, 2015 - 1:51 pm
sp_Permalink sp_Print sp_EditHistory

Hi,

We have time zone parameters that should help you: https://thingspeak.com/docs#timezones .

Here are examples of two charts with different daily calculations based on time zone:

http://api.thingspeak.com/channels/9/charts/1?days=2&timescale=daily&timezone=UTC

http://api.thingspeak.com/channels/9/charts/1?days=2&timescale=daily&timezone=America/New_York

lee

Avatar
sturbo177

Silver
Forum Posts: 5
sp_UserOfflineSmall Offline
3
July 1, 2015 - 5:00 pm
sp_Permalink sp_Print

I think your example shows the issue I'm having...

I downloaded your data (last 8000 points)...

If you click on your link showing EST time (http://api.thingspeak.com/channels/9/charts/1?days=2&timescale=daily&timezone=America/New_York), you get the following point:

Light: 359, Tue Jun 30 2015, 16:00:00 GMT-0400

Which aligns with the points from the data:
{"created_at":"2015-07-01T00:00:02Z","entry_id":8398786,"field1":"359","field2":"55.031847133757957"}

If I'm not mistaken, the first point of the day for EST time (New York) would be at 0400UTC, which corresponds to this point:
{"created_at":"2015-07-01T04:00:04Z","entry_id":8399739,"field1":"338","field2":"53.07855626326964"}

So it appears to me that the daily is taking the first point of the day in UTC, NOT EST like requested.

I do see that your first point is changing with the different time zone request, however, this point is more than 8000 points ago, so I cannot see this data.

In addition, when requesting EST time, why is the point showing up at 1600? I'm in the EST time zone, so that is the setting on my computer. I believe it's adjusting for the requested time zone from UTC time, and then also adjusting for the local time set on my computer.

What am I missing???

Avatar
sturbo177

Silver
Forum Posts: 5
sp_UserOfflineSmall Offline
4
July 2, 2015 - 9:53 am
sp_Permalink sp_Print

I dug into this a little more... Since I downloaded your data from yesterday, I added to it by downloading the last 8000 points from today. Now I have the data to cover the last 2 points in your plot. Here's what I see:

The most recent point is the same point in both plots, which is the first point of the day in UTC time (as previous post shows). The first point however, varies depending on the time zone used in the query.

For the UTC case, the correct point is provided (the first point of the day in UTC):
{"created_at":"2015-07-02T00:00:14Z","entry_id":8404539,"field1":"400","field2":"65.562632696390651"}

However, for the EST case, this point is provided (no idea why???):
{"created_at":"2015-07-01T09:02:51Z","entry_id":8400950,"field1":"336","field2":"52.653927813163477"}

Field 1 has many repeating values. So to narrow down to the correct row, I had to use the field1 and field2 combination.

Are you seeing the same results?

Avatar
fishmastaflex

Silver
Forum Posts: 11
sp_UserOfflineSmall Offline
5
July 7, 2015 - 11:12 pm
sp_Permalink sp_Print

I'm also having issues with timezones. I have a python script GET some JSON feed data to parse and I am using the ?timezone parameter. It's not working. It keeps displaying UTC time and nothing else.

I actually think it worked once or twice, but now it doesn't since I've refreshed more than ten times to see if it fixed itself.

Here is the channel feed I'm trying, which timezone is ignored:
https://api.thingspeak.com/channels/11869/feeds.json?results=30?timezone=America%2FLos_Angeles

It DOES work with the last entry though:
https://api.thingspeak.com/channels/11869/feeds/last.json?timezone=America%2FLos_Angeles

Avatar
lee

Forum Posts: 457
sp_UserOfflineSmall Offline
6
July 8, 2015 - 9:14 am
sp_Permalink sp_Print

Hi,

Your first query is not a valid HTTP request, it should be: https://api.thingspeak.com/channels/11869/feeds.json?results=30&timezone=America%2FLos_Angeles .

lee

Avatar
sturbo177

Silver
Forum Posts: 5
sp_UserOfflineSmall Offline
7
July 8, 2015 - 10:28 am
sp_Permalink sp_Print

What about the previous case, when simply trying to get the first point of the day in a specific timezone? I could do this on the client side, but think it would be lighter on the server to do it on the server side.

Avatar
lee

Forum Posts: 457
sp_UserOfflineSmall Offline
8
July 9, 2015 - 4:11 pm
sp_Permalink sp_Print

Hi,

Thanks for notifying us about the chart issue, we've fixed the timestamps so that they appear correctly now even with a timezone. The daily calculations do only use full UTC days though, and there currently isn't a server side workaround for this.

lee

Avatar
sturbo177

Silver
Forum Posts: 5
sp_UserOfflineSmall Offline
9
July 13, 2015 - 9:24 am
sp_Permalink sp_Print

Lee - thanks for looking into this and for the update.

Are there any plans to add a max or min for the daily calculations? I could keep this processing on the server side, if a max function was implemented. I see that you have an option to limit the max value returned, but I'm interested in finding the max value for each day.

Any plans for this?

Avatar
lee

Forum Posts: 457
sp_UserOfflineSmall Offline
10
July 13, 2015 - 1:15 pm
sp_Permalink sp_Print

Hi,

We don't currently have plans for implementing functions to find the absolute min/max over a time period, but we do recognize that we have a need to provide data analysis functionality in our app.

lee

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online: cstapels, jacktheripper125
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

Nsneilotof

angieus2

goldiepw11

BinanceoSt

gnarender123@gmail.com

edenderest

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee