Plugins and UTC Time | ThingSpeak Plugins | 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
Plugins and UTC Time
No permission to create posts
July 1, 2015
11:07 am
Avatar
sturbo177

Silver
Members
Forum Posts: 5
Member Since:
July 1, 2015
sp_UserOfflineSmall Offline

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?

July 1, 2015
1:51 pm
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

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

July 1, 2015
5:00 pm
Avatar
sturbo177

Silver
Members
Forum Posts: 5
Member Since:
July 1, 2015
sp_UserOfflineSmall Offline

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???

July 2, 2015
9:53 am
Avatar
sturbo177

Silver
Members
Forum Posts: 5
Member Since:
July 1, 2015
sp_UserOfflineSmall Offline

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?

July 7, 2015
11:12 pm
Avatar
fishmastaflex

Silver
Members
Forum Posts: 11
Member Since:
June 18, 2015
sp_UserOfflineSmall Offline

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

July 8, 2015
9:14 am
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

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

July 8, 2015
10:28 am
Avatar
sturbo177

Silver
Members
Forum Posts: 5
Member Since:
July 1, 2015
sp_UserOfflineSmall Offline

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.

July 9, 2015
4:11 pm
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

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

July 13, 2015
9:24 am
Avatar
sturbo177

Silver
Members
Forum Posts: 5
Member Since:
July 1, 2015
sp_UserOfflineSmall Offline

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?

July 13, 2015
1:15 pm
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

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:
12 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