Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:mervis-scada:80-mqtt [2020/08/27 10:56] l.osladil [Weintek compatible format] |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== MQTT ====== | ||
- | |||
- | ===== Basic properties and requirements ===== | ||
- | |||
- | * MQTT versions 3.1.0 a and **3.1.1** are supported | ||
- | * Any device must be registered in the Mervis cloud. Connection parameters are provided upon the registration (**DeviceID**, | ||
- | * Contact [[en: | ||
- | * possibility of a dynamic variable set (devices can specify what variables they publish) | ||
- | * only built-in types are supported (bool, integers, floating point numbers, string) | ||
- | * no commands/ | ||
- | * support for secured channel. A device can use secure or non-secure connection | ||
- | |||
- | ===== General behavior of the clients ===== | ||
- | |||
- | ==== Connect ==== | ||
- | |||
- | * ClientID corresponds to the DeviceID | ||
- | * User name and password | ||
- | * No special requirements considering flags or keep-alive periods (some reasonable value like 60 seconds are recommended) | ||
- | |||
- | ==== Publish/ | ||
- | |||
- | * Every topic starts with the DeviceId | ||
- | * The rest of the topic depends on the required functionality | ||
- | |||
- | ===== Supported formats ===== | ||
- | |||
- | ==== Wago compatible format ==== | ||
- | |||
- | === Registration of available variables === | ||
- | |||
- | * Informs the subscribers of available variables | ||
- | * Publish message with “At least once delivery” | ||
- | * Topic: deviceId/ | ||
- | * Combination of the collection ID and Tag must be unique for every device! | ||
- | * Payload: UTF-8 JSON document | ||
- | * /FormatId: (string), message ID | ||
- | * / | ||
- | * /Complete (bool), must be true now | ||
- | * / | ||
- | * /Id (int), ID of the collection | ||
- | * / | ||
- | * /SampleRate (int), collection sample rate in ms | ||
- | * / | ||
- | * /TagData (Array of variable descriptions) | ||
- | * /Tag (string), ID of the variable | ||
- | * /Unit (string), unit of the variable | ||
- | * /ValueType (string), ST type; only simple types are supported | ||
- | |||
- | **Example** | ||
- | |||
- | <code json> | ||
- | { | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | { | ||
- | " | ||
- | " | ||
- | " | ||
- | }] | ||
- | }, | ||
- | { | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | { | ||
- | " | ||
- | " | ||
- | " | ||
- | }] | ||
- | }] | ||
- | } | ||
- | </ | ||
- | |||
- | === Variable values === | ||
- | * Publishes values of variables | ||
- | * Publish message with “At least once delivery” | ||
- | * Topic: deviceId/ | ||
- | * Payload: UTF-8 JSON document | ||
- | * /FormatId: (string), message ID | ||
- | * / | ||
- | * / | ||
- | * /TagData (Array of value items) | ||
- | * /Time (datetime), timestamp in ISO format (YYYY-MM-DDTHH: | ||
- | * /Values (Collection of Tag and value tuples) | ||
- | |||
- | **Example** | ||
- | |||
- | <code json> | ||
- | { | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | } | ||
- | }] | ||
- | } | ||
- | |||
- | </ | ||
- | ==== Weintek compatible format ==== | ||
- | * We assume that all datetime values are in **UTC** | ||
- | === Variable values === | ||
- | * Publishes values of variables | ||
- | * Publish message with “At least once delivery” | ||
- | * Topic: $deviceId/ | ||
- | * Payload: UTF-8 JSON document | ||
- | * /d: root element | ||
- | * " | ||
- | * metadata format: | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | |||
- | **Example** | ||
- | |||
- | <code json> | ||
- | { | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | "My array" : [ 0, 10, 20 ] | ||
- | }, | ||
- | " | ||
- | } | ||
- | |||
- | </ | ||
- | === Command registration === | ||
- | * Topic: $deviceId/ | ||
- | * Format: | ||
- | * /d root element | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | < | ||
- | { | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | } | ||
- | </ | ||
- | ===Our supported types=== | ||
- | * our types: | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | * " | ||
- | ===Create subcribe topic for executing command=== | ||
- | * for previous command example | ||
- | * create topic $deviceId/ | ||
- | * with two addresses: | ||
- | * temperature(32-bit float) | ||
- | * date(string) |