Topics and wildcards
A tag can follow one topic or a filter: + matches one level and # matches the rest. A retained value is sent again when a tag is restarted.
MQTT SCADA driver
The MQTT driver connects to a broker, subscribes each tag to a topic and decodes the payload into a value. A write publishes it back. It comes with the core.
How you connect it
Under Connections, add an MQTT broker with its URL, such as mqtt://host:1883. Put the username and password in their own fields, not in the URL. Choose MQTT 5.0 or 3.1.1 and the default QoS.
Test connection connects with a throwaway client id, gives up after 5 seconds and reports the latency.
Browse topics scans the broker's topics and lists every one it sees, with the last payload and whether it was retained. By default it scans everything under #; you can limit the scan to the filters you choose.
Pick the topics and create the tags. Each is bound to a topic or a topic filter, with a payload format to decode it: text, number, boolean or JSON.
What it does
A tag can follow one topic or a filter: + matches one level and # matches the rest. A retained value is sent again when a tag is restarted.
Text as it is, a number, a boolean (true, 1, on or false, 0, off) or JSON. A payload that does not decode makes the tag bad, and says why.
Writing to a tag publishes the value to its topic at the connection's QoS, not retained. A tag bound to a wildcard filter cannot be written.
mqtts and wss use TLS and check the broker's certificate, unless you trust any certificate for a self-signed one. This version has no client certificates and no custom certificate authority.
While the broker is unreachable every bound tag is bad and keeps its last value, and the driver retries every 5 seconds.
Each connection publishes its state, message rates, topics seen and dropped samples as tags with history.
Settings
| Setting | What it does | Default |
|---|---|---|
| Broker URL | Where the broker listens: mqtt or tcp (port 1883), mqtts, ssl or tls (port 8883), ws and wss. Required. | None |
| Username and password | Credentials sent at connect. The password is stored encrypted and never returned by the API. | Empty |
| MQTT version | 5.0 or 3.1.1. Some brokers, mostly older ones, speak 3.1.1 only. | 5.0 |
| Default QoS | 0, 1 or 2, used for every subscription and every publish of the connection. | 0 |
| Trust any certificate | For a broker with a self-signed certificate. The connection is still encrypted. | Off |
What has been tried
The driver has run against Mosquitto. No other broker has been tried.
The driver comes with the core.
Questions
Other ways in
Tell us about your plant and what you run today, or what you want to build on it. We answer in plain language.