<< thingspeak_channelinfo bytecode_iot_module thingspeak_newentry >>

bytecode_iot_module >> bytecode_iot_module > thingspeak_fieldvalues

thingspeak_fieldvalues

Find (GET) values from a field in a ThingSpeak channel

Syntax

fieldvalues=thingspeak_fieldvalues(channelID,privacy,apiReadKey,fieldnbr)
fieldvalues=thingspeak_fieldvalues(channelID,privacy,apiReadKey,fieldnbr,optionName,optionValues)

Parameters

channelID :

ID of the channel in ThingSpeak

privacy :

Specify whether the channel is 'public' or 'private'

apiReadKey :

Read API Key of the channel (required for private channels)

fieldnbr :

The field number to retrieve the data from (1-8)

optionName, optionValues :

Additional options on how to retrieve the field values

fieldvalues :

Return the field's values

Description

This function is used to get values from the thingspeak channel. The additional options are:

results : number of values to retrieve

days : retrieve values up to x number of days

min : minimum values to retrieve

max : maximum value to retrieve

sum : sum of values in time intervals

average : average values in time intervals

median : median values in time intervals

timescale : first value for each time interval

startdate : Retrieve the values starting from the given date. The format is "yyyy-MM-dd HH:mm:ss". The default timezone for the date is UTC. You can change the timezone using the 'offset' option.

enddate : Retrieve the values up to the given date. The format is "yyyy-MM-dd HH:mm:ss". The default timezone for the date is UTC. You can change the timezone using the 'offset' option.

offset : Change the timezone used by 'startdate' and 'enddate' options.

status : Boolean input on whether to include status for each entry.

location : Boolean input on whether to include the location (latitude, longitude,elevation) for each entry.

The allowed time intervals for sum, median, average and timescale are 10, 15, 20, 30, 60, 240, 720 and 1440 minutes.

Examples

fv1=thingspeak_fieldvalues(channelID,'private','','readkey',1) //  By default, retrieve entries entered within the last 24 hours
fv2=thingspeak_fieldvalues(channelID,'private','','readkey',1,'results',5) // Get the last 5 entries
fv3=thingspeak_fieldvalues(channelID,'private','','readkey',1,'days',10,'min',4) // Get from the last 10 days, entries with minimum value of 4
fv4=thingspeak_fieldvalues(channelID,'private','','readkey',1,'startdate',"2015-05-12 8:25:00") // Get values starting from 2015-05-12 8:25:00 (UTC)
fv5=thingspeak_fieldvalues(channelID,'private','','readkey',1,'startdate',"2015-05-12 8:25:00","offset",8) // Get values starting from 2015-05-12 8:25:00 (+8 GMT)
fv6=thingspeak_fieldvalues(channelID,'private','','readkey',1,'results',10,'status',%t,'location',%t) // Include the status and location fields

See also


Report an issue
<< thingspeak_channelinfo bytecode_iot_module thingspeak_newentry >>