Skip to content

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.

HTTP Client

Elements of page

The HTTP client configuration form contains fields:

  • enabling the sending function via the LTE module instead of the Ethernet connection (option available only with the LTE module)
  • using the double % character to insert readings from the device (allows the % character to be entered)
  • using Digest Authentication (after attempt with Basic Authentication)
  • cyclic sending configuration
    • enable the function
    • sending period
    • URL to use in the request
  • configuration for the Events function (4 sections HTTP1-4)
    • URL to use when the condition is met
    • URL to use when the condition is no longer met

HTTP Client configuration

The client sends HTTP requests using the GET method to the specified server and port at a specified time.

In the query, you can insert the readings available on the device using the special expression %XXXA. More information on this here.

An example HTTP GET query to the thingspeak server with T1 reading

In the Server address field enter:

http://api.thingspeak.com:80/update?api_key=H2PN0O35KRVRG6Q0&field1=%0101

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 tcPDU 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.

The format for inserting readings is %XXXA, where:

  • % – a character that begins a special format
  • XXX – sensor number, necessarily a three-digit value (list of codes below)
  • A – range 0-3, usually specifies the number of decimal places, but for some readings it has a special effect

    • 0 – no decimal places
    • 1 – 1 decimal place
    • 2 – 2 decimal places
    • 3 – 3 decimal places

    Special effect of parameter A for selected readings

    For some variables, the parameter A works differently:

    • UPTIME:
      • 0 - value in seconds
      • 1 - value in minutes
      • 2 - value in hours
      • 3 - value in format dd hh:mm:ss
    • Time:
      • 0 - hh:mm:ss
      • 1 - hhmmss
    • Date:
      • 0 - yyyy-mm-dd
      • 1 - yyyymmdd
    • OUT1-7, VAR1-8, INPD1-2 (only in OLED):
      • 0 - text 0 or 1
      • 1 - graphical representation of the state (0 is an empty square, 1 is a full one)

    Recommended settings for parameter A

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

    • 0 for OUT, INPD (iDValue)
    • 1 for T1 (i2cTemp), H1 (i2cHum), DS, UAC
    • 2 for IAC
    • 3 for POWER, ENERGY, DIFF

List of readings codes

{
    '000': 'UAC',
    '001': 'IAC',
    '002': 'DS1',
    '003': 'DS2',
    '004': 'DS3',
    '005': 'DS4',
    '006': 'DS5',
    '007': 'DS6',
    '008': 'DS7',
    '009': 'DS8',
    '010': 'T1',
    '011': 'H1',
    '012': 'DIFF1',
    '013': 'DIFF2',
    '014': 'DIFF3',
    '015': 'DIFF4',
    '016': 'DIFF5',
    '017': 'DIFF6',
    '018': 'INPD1',
    '019': 'INPD2',
    '020': 'OUT1',
    '021': 'OUT2',
    '022': 'OUT3',
    '023': 'OUT4',
    '024': 'OUT5',
    '025': 'OUT6',
    '026': 'OUT7',
    '027': 'POWER1',
    '028': 'POWER2',
    '029': 'POWER3',
    '030': 'POWER4',
    '031': 'POWER5',
    '032': 'POWER6',
    '033': 'ENERGY1',
    '034': 'ENERGY2',
    '035': 'ENERGY3',
    '036': 'ENERGY4',
    '037': 'ENERGY5',
    '038': 'ENERGY6',
    '039': 'VAR1',
    '040': 'VAR2',
    '041': 'VAR3',
    '042': 'VAR4',
    '043': 'VAR5',
    '044': 'VAR6',
    '045': 'VAR7',
    '046': 'VAR8',
    '047': 'UPTIME',
    '048': 'IP',
    '049': 'Time',
    '050': 'Date',
    '51': 'Dew Point', // added in SW 1.14
}

The current list of readings codes is available on the device's website in sections where it can be used: HTTP Client, OLED, Email, Modem LTE. It looks like on picture below (excerpt from the HTTP Client page).

HTTP Client - list of readings codes

Use with a Dahua camera

The HTTP Client can be used to send data to be displayed on the image of the Dahua camera, e.g. readings from sensors.

To do this, configure the HTTP Client as follows:

  • select Use Digest Authentication
  • within Cyclic Sending section

    • in the field URL enter

      http://<USERNAME>:<PASSWORD>@<CAMERA_IP_ADDRESS>:80/cgi-bin/configManager.cgi?action=setConfig&ChannelTitle[0].Name=<TEXT_TO_DISPLAY>
      

      , e.g.

      http://admin:admin@192.168.1.14:80/cgi-bin/configManager.cgi?action=setConfig&ChannelTitle[0].Name=T %0101 H %0111|U %047
      

      (%0101 - T1 reading, %0111 - H1 reading, %047 - uptime).

    • select Enable cyclic sending

    • set Sending period to 30 (the lower the value, the more frequent updates of the text on the camera view)

As a result, the given text will be visible in the camera view, and the text will be updated every 30 seconds. The image below shows the function in question on the Dahua IPC-HFW5241T-ASE camera.

If HTTPS access is enabled on the camera (System > Safety > HTTPS), please use https instead of http in the URL.

Dahua