MQTT-SN Gateway setup using HiveMQ Edge

Table of contents Table of contents

These instructions were tested with HiveMQ Edge version 2024-09. Note that if you're using other version there may be differences.

This is a simple tutorial showing how to set up a MQTT-SN gateway using HiveMQ Edge.

This step is usually needed if you want to use the MQTT-SN client for embeNET.

Introduction

In this simple tutorial we will set up the HiveMQ Edge as MQTT-SN Gateway. HiveMQ Edge is a product by HiveMQ availabe as open source software. The software is distributed using Apache License and is available for Linux and Windows operating systems.

This MQTT-SN Gateway service we will set up allows to translate the UDP-based MQTT-SN communication to a standard TCP-based MQTT protocol. The job of the gateway is to connect MQTT-SN enabled clients to a standard MQTT broker. in this turotial we will use a popular mosquitto test broker avaliable at test.mosquitto.org.

Step 1: Download and install HiveMQ Edge

Follow the official instructions on how to download and install the HiveMQ Edge from here.

Step 2: Enable IPv6 support

In order to use IPv6 we need to modify the run script. If you are using Windows you need to edit the run.bat file and add this line:

set "JAVA_OPTS=-Djava.net.preferIPv4Stack=false %JAVA_OPTS%"

If you are using Linux you need to edit the run.sh file and add this line:

JAVA_OPTS="-Djava.net.preferIPv4Stack=false $JAVA_OPTS"

Step 3: Configure the gateway

The HiveMQ Edge Gateway is configured using the conf/config.xml file. You can download the configuration file for this tutorial here: config.xml.

Step 4: Start the gateway

To start the gateway simply run the run.bat or run.sh script.

Once started the gateway can be accessed through a web inteface at default port 8080. Open the http://localhost:8080 URL and you should see the web interface. The default username and password is admin / password (can be changed in the config.xml file). Within the web interface you can go to MQTT Bridges to see if the bridge to the mosquitto broker is established.

During the startup look for the following log messages indicataing that the gateway is started and the bridge to the mosquitto broker is established:

INFO - Starting adapters
INFO - Started MQTT-SN UDP Listener on address :: and on port 1885
WARN - Server overwrote the Client Identifier with auto-648E464D-D53D-E628-F1A1-810516932BDC
INFO - Started WebServer with protocol 'http' on port 8080 in 627ms
INFO - Started HiveMQ Edge in 2774ms
INFO - Bridge 'mosquitto' to remote broker test.mosquitto.org:1884 started in 1054ms.

Support

If you have any questions or need help with the setup please contact us.

Contact us

Any question or remarks? Just write us a message!

Contact Information

Feel free to get in touch

ikona youtube kanał ikona linkedin kanał