MQTT (Message Queuing Telemetry Transport) is an open standard lightweight, publish-subscribe network protocol that transports messages between devices. The protocol runs over TCP/IP; It is designed for connections with remote locations where a “small code footprint” is required or the network bandwidth is limited.
The MXM MQTT Client is able to subscribe to specific topics as published by the MQTT broker it connects to; It can also publish to topics of choice. A variable is created for each subscribed topic.
Device Setup
Medialon MQTT Client setup:
The dialog box is comprised of two parts :
Broker configuration
Subscribed Topics
Broker configuration
IP Address / domain name: [string] IPV4 address of DNS of the broker
Port : [integer] listening port of the broker
Subscribed Topics
List of subscribed topics; Add/remove using the “+”/“-” buttons; Each subscribed topic will create an mxm variable. Topic format is “/root/folder/value”…
Add / Edit topic
Topic : fully qualified topic, as per format standard
Associated Variable Name : the name of the Manager variable that contains the value of this variable and will be updated upon receipt of new data from the MQTT broker If left blank, the variable name will use the Topic name, removing illegal characters
QoS : Quality of service of specific subscription; See Publish device command for a description of the QoS levels
QoS: [Enum] MQTT Quality of service for publication.
QoS 0 - at most once : Guarantees a best-effort delivery. There is no guarantee of delivery. The recipient does not acknowledge receipt of the message and the message is not stored and re-transmitted by the sender. QoS level 0 is often called “fire and forget” and provides the same guarantee as the underlying TCP protocol.
QoS 1 - at least once : Guarantees that a message is delivered at least one time to the receiver. The sender stores the message until it gets a PUBACK packet from the receiver that acknowledges receipt of the message. It is possible for a message to be sent or delivered multiple times.
QoS 2 - exactly once : Guarantees that each message is received only once by the intended recipients. QoS 2 is the safest and slowest quality of service level. The guarantee is provided by at least two request/response flows (a four-part handshake) between the sender and the receiver. The sender and receiver use the packet identifier of the original PUBLISH message to coordinate delivery of the message.
Retain: [Boolean] Indicates if this message should be retained and sent to all new subscribers to this variable as a default value (until overwritten)
Device Variables
ErrorCode
[Integer] latest errorcode reported by MQTT (usually on connection failure)
Common error codes are
- 128 : Unspecified Error
- 129 : Malformed Packet
- 132 : Unsupported Protocol Version
- 133 : Client Identifier Not Valid
- 135 : Not Authorized
- 136 : Server Unavailable
- 137 : Server Busy
- 140 : Bad Authentication Method
If you encounter a code not listed above, please contact support for more information
Status
[Enum] Indicates connection status to the broker;
“Disconnected”: disconnected from broker
“Connected”: active connection to the broker
“Error”: connection error; Either refused by broker or unresolved IP/DNS
TopicsList
[List] comma-separated list of subscribed topics.
Various*
[string] one variable is declared per subscribed topic.
Revisions
V 6.7.0
Initial version.
V 6.7.1
fixed: Projects’s references to variables get broken if you reopen the mxm setup window
fixed: enforced better validation of variable name to remove restricted characters
added : variable “ErrorCode” to mirror connection issues