The Message Queuing Telemetry Transport (MQTT) is a lightweight, publish-subscribe network protocol. The original version was authored in 1999 to monitor oil pipelines and has released many iterations. MQTT relies on the TCP protocol for data transmission but there are versions of MQTT aimed for lower end, low powered (battery-powered) embedded devices. MQTT is similar to HTTP and sits on the application layer. What this means is, MQTT does not specify the payload that is transmitted over the protocol (API) and that is up to each vendor to implement themselves.
Figure 1: Overview of MQTT
Topics
A MQTT topic is a UTF-8 string user by brokers that allow clients (controllers, analytics software etc) to filter messages in a meaningful way (like http URLs). A MQTT broker contains multiple topics (URLs) that clients can publish their messages against. Clients can also subscribe to these topics and thus receive the published messages.
Clients can subscribe to multiple topics (filters) at the same time by using wildcards.
- Single-level Wildcard + eg. zencontrol/v1/{gatewayId}/ecg/+/levels this subscribes to all levels
- Multi-level Wildcard # eg zencontrol/v1/{gatewayId}/# subscribes to everything on the control system
Common Brokers
The following list is over common brokers. The list is in no particular order nor do we recommend one over another.
Broker | Link |
mosquitto | https://mosquitto.org/ |
Azure IoT Hub | https://azure.microsoft.com/en-us/services/iot-hub/ |
AWS IoT Core | https://docs.aws.amazon.com/iot/latest/developerguide/mqtt.html |
Google cloud MQTT bridge | https://cloud.google.com/iot/docs/how-tos/mqtt-bridge |
HiveMQ |
https://www.hivemq.com/ |
Apache Active MQ |
https://activemq.apache.org/mqtt |
Rabbitmq (as a plugin) |
https://www.rabbitmq.com/mqtt.html |
WebsphereMQ/IBM MQ |
https://www.ibm.com/docs/en/ibm-mq/7.5?topic=mq-introduction-websphere |
Getting started
To get started with MQTT you will need to setup a broker or use an existing MQTT broker. Once selecting or finding a broker to connect to (a common broker is mosquitto), the control system will need to be commissioned to connect to the broker. Visit https://support.zencontrol.com/hc/en-us/articles/360004742836 on information on how how to commission the control system to connect to the chosen MQTT broker.
A GitHub project has been provided https://github.com/zencontrol-int/mqtt-demo with all the basic requirements setup (broker, tls certificate) plus some extras for demonstration purposes.
Installers can use the attached reference documentation for information regarding the MQTT API that the zencontrol controllers expose over MQTT.
Comments
0 comments
Article is closed for comments.