MQTT for Ethernet Gateways
MQTT operates on a publish-subscribe model, allowing devices to communicate by publishing messages to specific topics and subscribing to topics to receive relevant messages. This section covers how to use MQTT with the Packet Power Ethernet Gateway.
Data Output from MQTT Gateways
Packet Power Gateways collect data from Packet Power wireless monitoring nodes and aggregate the data for transmission by MQTT, SNMP, Modbus TCP/IP and directly to the Packet Power EMX monitoring portal. Note that the Gateway can support transmission of data via MQTT, SNMP or Modbus TCP/IP while simultaneously serving data to the EMX portal.
MQTT Broker Software
You may choose to set up your own MQTT broker if you require control over the communication infrastructure. There are several open-source and commercial MQTT broker options available:
Mosquitto: An open-source MQTT broker that is lightweight and easy to set up.
HiveMQ: A commercial MQTT broker with advanced features and scalability options.
EMQ X: An open-source MQTT broker built for high performance and scalability.
Setting Up MQTT Communication
Setting up MQTT communication involves configuring your gateway to connect to an MQTT broker, defining topics for communication, and understanding the various options available. This section guides you through the steps required to establish MQTT connections and begin exchanging messages.
Configuring the Gateway for MQTT
Before you start, ensure that your gateway version supports MQTT communication. Gateway firmware 2.2.0 or higher is required. You can check your gateway firmware under Status>System Firmware.
For firmware upgrades see: System Updates
Configuring Channel Maps
To create a channel map for mapping node readings to MQTT messages go to MQTT>Channel Maps and click “add”.
Select the channels that correlate to the readings you want published to your MQTT broker.
Configuring MQTT Nodes
To publish a nodes readings to the MQTT stream, select a node and a channel map under Data Destinations → MQTT → Nodes. Use the “add” option in the Actions drop down. This will publish all readings from the node which correspond to the readings selected in the given channel map. If you intend to publish all readings from a node you can select “none” from the channel map drop down.
MQTT Connections
Connecting to an MQTT Broker
The gateway needs to establish a connection with the MQTT broker. This involves providing connection parameters, such as the broker's address, port number, and security credentials (if applicable). You will find these options under the main page of MQTT. Data destinations>MQTTtx.
Publishing Messages
The gateway can publish messages to specific topics using MQTT. This includes the message payload and the topic to which the message should be sent. If you want custom prefixes in addition to your node readings, enter them in the prefix area and they will show up before each node topic.
To publish all messages from all nodes you must select the “transmit everything” option. This will publish all node readings for all nodes connected to your gateway, whether or not you have added them to the node map.