< All Topics
Print

13. MQTT

MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol designed for constrained devices and unreliable networks. It operates on a publish/subscribe messaging model, where clients (devices or applications) can publish messages to specific topics, and other clients interested in those topics receive those messages. MQTT is commonly used in Internet of Things (IoT) scenarios, enabling efficient communication between devices, sensors, and applications in a scalable and reliable manner. It’s known for its low overhead, minimal bandwidth usage, and support for asynchronous communication, making it suitable for various IoT deployments.

Setting up a MQTT client

A MQTT client can be configured in the web interface under IIoT -> MQTT.

man mqtt

The MQTT client connects to a running MQTT server; currently, only connections over the MQTT protocol are enabled. To connect to a server, Enable the client, fill out your server parameters, and click Save & Apply.

Parameters

  • Enable: Enable the MQTT client.
  • Topic: Serves as a channel or subject to which the client can subscribe to receive messages. Topics are hierarchical, organized in a tree-like structure, with levels separated by forward slashes (/).
  • Server IP: IP or URL address of the MQTT server.
  • Server Port: Port of the MQTT server.
  • Login & Password: Set the login credentials if the MQTT requires authentication. If anonymous connections are allowed, these can be left empty.

Energy meter MQTT message structure

“em”: [ { “adr”: 1, “type”: 16, “vrms”: [0.1, 0.1, 0.1], “irms”: [0.01, 0.01, 0.01], “wat”: [0, 0, 0] } ]

adr: Identification of the hardware extension numbered right to left, starting at 1.

type: Type of the hardware extension, 16 signifies Energy meter.

vrms: Measured root-mean-square (RMS) voltage in volts (V) for each phase.

irms: Measured RMS current in ampere (A) for each phase.

wat: Measured power in kW/h, for each phase.

 

Table of Contents