This the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Generic

1 - HTTP Client

This protocol allows you to fetch data from an HTTP server using GET requests.

Supported Devices and Prerequisites

The HTTP Client connection can fetch data from any HTTP or HTTPS URL.

Optionally, basic authentication or bearer authentication (token) is supported.

Configuration

The following configuration settings are available:

Server configuration:

  • URL: This is the URL that the HTTP GET request is performed on.
  • Auth User and Auth Password: Fill in values here if your server requires HTTP Basic authentication.
  • Auth Token: Enter an optional token if your server uses HTTP Bearer authentication.

Options:

  • Polling Interval: Enter the interval (in milliseconds) between two HTTP calls. The default is 5000 milliseconds (five seconds).
  • Enable Polling: Uncheck to disable automatic polling. In this case, the HTTP request will only be performed when the trigger parameter is used (see below).
  • Parse Mode: Select the desired mode in which the content returned by the server is parsed (or not). The currently supported modes are None and JSON. See the Parameters section below for details.

Parameters

A write-only trigger parameter is provided which can be used to manaully trigger an HTTP call, whether or not periodic polling is enabled. When automatic polling is disabled, this is the only way to fetch HTTP data from the server.

The received data is provided under in data part of the parameter tree. It depends on the parsing mode set in the configuration:

No Parsing

In parsing mode None, the data returned from the server is exposed as a single read-only string parameter data.

JSON Parsing

In parsing mode JSON, the returned document is considered a JSON document (regardless of the Content-type returned by the server), and it is parsed into a parameter tree (with data as the root) that corresponds to the JSON document.

Any kind of JSON value (object, array, string, number, boolean) is supported at any level of the tree.

  • JSON strings will be turned into string parameters.
  • JSON booleans will be turned into boolean parameters.
  • JSON numbers will be turned into integer or float parameters, depending on whether the number is a whole number or not.
  • JSON objects will be turned into sub-trees.
  • JSON arrays will be turned into indexes subtrees, starting with 0.

For example, the following JSON document

{ 
	"event": "meeting",
	"room": 12,
	"people": [
		{
			"first_name": "Joe",
			"last_name": "Smith",
		},
		{
			"first_name": "Mary",
			"last_name": "Miller",
		}
	]
}

will be translated into these parameters and values:

  • data/event (string): meeting
  • data/room (integer): 12
  • data/people/0/first_name (string): Joe
  • data/people/0/last_name (string): Smith
  • data/people/1/first_name (string): Mary
  • data/people/1/last_name (string): Miller

All parameters are read-only.

2 - MQTT Client