HTTP Client¶
The HTTP Client page allows you to configure HTTP requests to be sent periodically, as well as HTTP requests for use in the Events feature.
Elements of page¶
The HTTP client configuration form contains fields:
- enabling the function of sending via the GSM module instead of the Ethernet connection
- enable cyclical query sending to first address
- period of sending a cyclical query
- server addresses or rather URL to query (up to 4), in format
<host>:<port>/<path>
HTTP Client configuration¶
The client sends HTTP requests using the GET method to the specified server and port at a specified time.
The query can include values from the sensors with help of special phrase %xxy, where: In the query, you can insert values from sensors using a special expression %XXAB, where B is only used in OLED and ignored in the HTTP client. More information on this here.
An example of an HTTP GET query to the thingspeak server, which writes the value from the T1 sensor to the server
In the Server address field enter:
api.thingspeak.com:80/update?api_key=H2PN0O35KRVRG6Q0&field1=%141
As a result, the following text is sent to the server, where you can see the substitution of the sensor value in the indicated place:
update?api_key=H2PN0O35KRVRG6Q0&field1=26.3
The query can also be sent manually from a web browser without LC3 participation by pasting/entering the following text in the search bar:
http://api.thingspeak.com/update?api_key=H2PN0O35KRVRG6Q0&field1=26.3
Full content of the query:
GET /update?api_key=H2PN0O35KRVRG6Q0&field1=26.3 HTTP/1.0
Host: api.thingspeak.com
Connection: close
Sensor numbers¶
Current readings from sensors and selected parameters from the device can be accessed using a special format for HTTP client queries and displaying on the OLED display.
The format for use in the HTTP client is %XXA and for OLED it is %XXAB (with an additional B parameter).
%– a character that begins a special formatXX– sensor number, necessarily a two-digit value (list of codes below)-
A– divisor, range 0-3, allows you to match the decimal point for a specific reading, since values are returned as integers- 0 – do not divide the value
- 1 – divide by 10
- 2 – divide by 100
- 3 – divide by 1000
Different effect of divisor for some readings
For some variables, the divisor of
Aworks differently:- UPTIME:
- 0 - value in seconds
- 1 - value in minutes
- 2 - value in seconds
- 3 - value in hours
- Time:
- 0 - hh:mm:ss
- 1 - hhmmss
- Date:
- 0 - yyyy-mm-dd
- 1 - yyyymmdd
Recommended divisor settings
The divisor should take the following values to make the readings in the same format as on the page:
0for OUT, PWM, INPD, INPA_RAW, CO21for T1, H1, DS, PM2for P1, INPA, VCC/VIN, TEMP3for POWER, ENERGY
For DIFF1-3, the value of
Ashould be either1,2or3depending on the selected readings. -
B- cutter, range 0-9, shortens the value by a given number of characters
List of readings codes¶
{
"00": "INPA1",
"01": "INPA2",
"02": "INPA3",
"03": "INPA4",
"04": "INPA5",
"05": "INPA6",
"06": "VIN",
"07": "INPA1_RAW",
"08": "INPA2_RAW",
"09": "INPA3_RAW",
"10": "INPA4_RAW",
"11": "INPA5_RAW",
"12": "INPA6_RAW",
"13": "TEMP",
"14": "T1",
"15": "H1",
"16": "DS1",
"17": "DS2",
"18": "DS3",
"19": "DS4",
"20": "DS5",
"21": "DS6",
"62": "DS7",
"63": "DS8",
"22": "DIFF1",
"23": "DIFF2",
"81": "DIFF3",
"35": "POWER1",
"36": "POWER2",
"37": "POWER3",
"38": "POWER4",
"39": "ENERGY1",
"40": "ENERGY2",
"41": "ENERGY3",
"42": "ENERGY4",
"43": "OUT0",
"44": "OUT1",
"45": "OUT2",
"46": "OUT3",
"47": "OUT4",
"48": "OUT5",
"49": "PWM0",
"50": "PWM1",
"51": "PWM2",
"52": "PWM3",
"53": "INPD1",
"54": "INPD2",
"55": "INPD3",
"56": "INPD4",
"65": "PM1.0",
"57": "PM2.5",
"66": "PM4.0",
"58": "PM10.0",
"59": "P1",
"60": "CO2",
"61": "UPTIME",
"64": "IP",
"67": "sdm1 (Voltage/Total system power)",
"68": "sdm2 (Current/Import Energy since last reset)",
"69": "sdm3 (Active power/Export Energy since last reset)",
"70": "sdm4 (Apparent power/Total Energy)",
"71": "sdm5 (Reactive power/Settable total Energy)",
"72": "sdm6 (Power factor/Settable import Energy)",
"73": "sdm7 (Phase angle/Settable export Energy)",
"74": "sdm8 (Frequency/Import power)",
"75": "sdm9 (Import active energy/Export power)",
"76": "sdm10 (Export active energy/-)",
"77": "sdm11 (Import reactive energy/-)",
"78": "sdm12 (Export reactive energy/-)",
"79": "sdm13 (Total active energy/-)",
"80": "sdm14 (Total reactive energy/-)",
"24": "DUX0",
"26": "DUX1",
"28": "DUX2",
"30": "DUX3",
"32": "DUX4",
"34": "DUX5",
"25": "DUX6",
"27": "DUX7",
"29": "DUX8",
"31": "DUX9",
"33": "DUX10",
}
