Skip to content

HTTP Client

HTTP Client

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
  • using double % sign to insert readings from device (allows to enter % sign)
  • using Digest Authentication (after attempt with Basic Authentication)
  • 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 %XXXAB, 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, displaying on the OLED display, e-mail and SMS texts (since HW3.5+ SW 1.40).

The format for use in the HTTP client is %XXXA and for OLED it is %XXXAB (with an additional B parameter). This is the case since version HW3.5+ SW 1.36, for the previous versions it is %XXA for the HTTP client and %XXAB for OLED.

  • % – a character that begins a special format
  • XXX – sensor number, necessarily a three-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

    Tip

    For some variables, the divisor of A works 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

    Tip

    The divisor should take the following values to make the readings in the same format as on the page:

    • 0 for OUT, PWM, INPD, INPA_RAW, CO2
    • 1 for T1, H1, DS, PM
    • 2 for P1, INPA, VCC/VIN, TEMP
    • 3 for POWER, ENERGY

    For DIFF1-3, the value of A should be either 1, 2 or 3 depending on the selected readings.

  • B - cutter, range 0-9, shortens the value by a given number of characters

List of readings codes

{
    "000": "INPA1",
    "001": "INPA2",
    "002": "INPA3",
    "003": "INPA4",
    "004": "INPA5",
    "005": "INPA6",
    "006": "VCC",
    "007": "INPA1_RAW",
    "008": "INPA2_RAW",
    "009": "INPA3_RAW",
    "010": "INPA4_RAW",
    "011": "INPA5_RAW",
    "012": "INPA6_RAW",
    "013": "TEMP",
    "014": "T1",
    "015": "H1",
    "016": "DS1",
    "017": "DS2",
    "018": "DS3",
    "019": "DS4",
    "020": "DS5",
    "021": "DS6",
    "062": "DS7",
    "063": "DS8",
    "022": "DIFF1",
    "023": "DIFF2",
    "067": "DIFF3",
    "035": "POWER1",
    "036": "POWER2",
    "037": "POWER3",
    "038": "POWER4",
    "039": "ENERGY1",
    "040": "ENERGY2",
    "041": "ENERGY3",
    "042": "ENERGY4",
    "043": "OUT0",
    "044": "OUT1",
    "045": "OUT2",
    "046": "OUT3",
    "047": "OUT4",
    "048": "OUT5",
    "049": "PWM0",
    "050": "PWM1",
    "051": "PWM2",
    "052": "PWM3",
    "053": "INPD1",
    "054": "INPD2",
    "055": "INPD3",
    "056": "INPD4",
    "065": "PM1.0",
    "057": "PM2.5",
    "066": "PM4.0",
    "058": "PM10.0",
    "059": "P1",
    "060": "CO2",
    "061": "UPTIME",
    "064": "IP",
    "068": "Distance sensor",
    "069": "Time",
    "070": "Date",
    "071": "m1",
    "072": "m2",
    "073": "m3",
    "074": "m4",
    "075": "m5",
    "076": "m6",
    "077": "m7",
    "078": "m8",
    "079": "m9",
    "080": "m10",
    "081": "m11",
    "082": "m12",
    "083": "m13",
    "084": "m14",
    "085": "m15",
    "086": "m16",
    "087": "m17",
    "088": "m18",
    "089": "m19",
    "090": "m20",
    "091": "m21",
    "092": "m22",
    "093": "m23",
    "094": "m24",
    "095": "m25",
    "096": "m26",
    "097": "m27",
    "098": "m28",
    "099": "m29",
    "100": "m30",
    "024": "DUX0",
    "026": "DUX1",
    "028": "DUX2",
    "030": "DUX3",
    "032": "DUX4",
    "034": "DUX5",
    "025": "DUX6",
    "027": "DUX7",
    "029": "DUX8",
    "031": "DUX9",
    "033": "DUX10",
}
{
    "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",
}

Last update: 2021-05-13
Back to top