Skip to main content

Connecting to Enapter Gateway Public MQTT with MQTTX Client

What is MQTT?

MQTT, which stands for Message Queuing Telemetry Transport, is a lightweight and open-source messaging protocol designed for efficient communication between devices in a network, particularly in situations where low bandwidth, high latency, or unreliable networks are common.

What is Enapter Gateway Public MQTT Broker

Enapter Gateway comes with a built-in MQTT broker which is used to provide public MQTT interface for integration with energy devices connected through Enapter Gateway over MQTT protocol as well as provides public MQTT interface for 3rd party applications, for example, Zigbee2MQTT.

Requirements

Setting up MQTT Broker on Enapter Gateway

Enapter Gateway has the built-in MQTT broker which can be used for receiving devices telemetry as well as publishing MQTT messages from other services.

We need to set public MQTT username and password. To make that you need to connect to the Gateway Terminal either over SSH or Cloud, switch to configuration mode with configure command and run several commands:

set public-mqtt authentication username "public"
set public-mqtt authentication password "password"
commit
save

Don't forget to choose a unique username and password instead of the default (public/password) ones in this example.

Public MQTT broker is running on port 9883.

This information is needed for the next steps.

note

More information can be found at Enapter Handbook

Installing MQTTX Desktop Client

Download and install the latest version of MQTTX Desktop Client from official site suitable for your operating system.

Setting Up MQTTX Desktop Client Connection with Public MQTT

Start the MQTTX Desktop Client and click on + New Connection button.

Zigbee2MQTT Web Interface

Set connection settings for your new connection:

  • Name: Connection name, for example, EnapterGW
  • Client ID: keep a random name
  • Host: mqtt://192.168.123.10 — IP address of your Enapter Gateway
  • Port: 9883
  • Username: PUBLIC MQTT USER SET IN CLI (public)
  • Password: PUBLIC MQTT PASSWORD SET IN CLI (password)
  • SSL/TLS: disabled
Setup MQTT connection settings in MQTTX

Click Connect button in the top right corner.

MQTTX successfully connected

Now you are connected to Enapter Gateway public MQTT.

Subscribing to MQTT Topics

In order to start receiving messages you need to subscribe to a specific topic. In this example we will connect to the general topic telemetry/# which is designed to receive all telemetry from Enapter devices.

note

When you use the hash(#) symbol - the multi-level wildcard — it allows covering multiple topic levels. It must be placed as the last character in the topic, preceded by a forward slash. It will allow receiving of all messages under child topics, for example, telemetry/v1/ABCD and so on.

To create a new subscription click on the + New Subscription button and add at least one topic name in the opened window, and click Confirm to apply settings.

Zigbee2MQTT Web Interface

You will start receiving new messages in the selected topic. In case there are retained messages — you will see them immediately after connection.

Tips

  • Use # as topic to subscribe to all topics in MQTT server.

Contacts

Feel free to ask any questions or give any proposals for improving this guide in our Discord

Hardware diversity is welcome. Integrate any device into a unified energy network.
© 2024 Enapter
Developer toolkit
DocumentationReference