Calculate high and low temperatures and write to the channel | MATLAB IoT Analytics | Forum


Please consider registering

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
Calculate high and low temperatures and write to the channel
No permission to create posts
November 10, 2018
9:36 am
New Member
Forum Posts: 1
Member Since:
November 10, 2018
sp_UserOfflineSmall Offline

I need to determine max and min temperature in 24 hours. I use Example "Calculate high and low temperatures". When I want to write data to a channel, I have a problem. Calculation runs every 15 minutes using timecontrol. If the value is the same, then I get back errors.
Maximum Temperature for the past 24 hours is =
Note: To write data to another channel, assign the write channel ID
andAPI Key to 'WriteChannelID' and 'writeAPIKey' variables. Also
uncomment the line of code containing 'thingSpeakWrite'
(remove '%' sign at the beginning of the line.) Error using Calculate high temperature MAX Garden (line 56)
The server returned the status 500 with the message "Internal Server Error" in response to the request to URL

Can you please advise me?

November 12, 2018
3:40 pm

Forum Posts: 477
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

ThingSpeak requires unique timestamps. Since the code writes with the timestamp of the max or min, and you run it, it will repeatedly try to write the nonunique timestamp.
My suggestion is to write the present timestamp and then write the timestamp of interest to another field.

thingSpeakWrite(writeChannelID,[maxTempF String(timeMaxTemp)],'Writekey',writeAPIKey);
with this change, it will write the time of max literature in field 2, and the timestamp for the entry will be exactly when the timeControl ran.
Does that help?

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
43 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

JustinaAnoks, JerilynDernnida, JaketripDernnida, KenterDernnida, AlisaMiz, AriurinDernnida

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457