Caution! Article for developersInformation on this page is intended particularly for users with advanced technical knowledge.
How to set up an MQTT broker
Dec 1, 2022 · 2 minutes to read
An MQTT broker can be used to monitor your Node data and to send DM messages to the Gateway. You can easily setup an MQTT broker on your computer for testing or configuration purposes. For example, Mosquitto can be used for that purpose on Windows 10:
Download and install Mosquitto on your computer. On Windows it will attempt to install to Program files, that means you’ll need admin rights to edit the configuration files and use some of the commands.
Navigate to the installation folder and create a configuration file (example treon.conf)
per_listener_settings true listener 1883 password_file C:\Program Files\mosquitto\pswd.conf
Navigate to the installation folder and open command prompt on it (admin rights might be needed).
Create password file (example pswd.conf) user is the username you want to create. Then type the password twice.
mosquitto_passwd -c pswd.conf user
- Mosquitto MQTT broker can be started using command
mosquitto -v -c treon.conf
- Open another command prompt window and type
and find your computer’s IP address on the local network.
Enable an MQTT connection from your Gateway through the Config UI configuration mode. Type your computer’s IP address and port, as well as user and password, and enable insecure connection.
Open another command prompt window on your computer to subscribe to the MQTT broker by typing in:
mosquitto_sub -L mqtt(s)://[username[:password]@]host[:port]/topic mosquitto_sub -L mqtt://user:email@example.com:1883/treon/devices/1234abcd
Replace the host and password values. Replace ‘host’ with your computer’s IP address and replace ‘topic’ with your Gateway’s MQTT publishing topic. By default it is:
and replace ‘ID’ with your Gateway’s device ID. Now you can see the incoming messages in real time.