Caution! Article for developers
Information on this page is intended particularly for users with advanced technical knowledge.How to set up an MQTT broker
Mar 6, 2024 · 2 minutes to read
Introduction
An MQTT broker can be used to monitor your Node data and to send DM messages to the Treon 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
ipconfig
and find your computer’s IP address on the local network.
Enable an MQTT connection from your Treon Gateway through the Configuration UI configuration mode. Type your computer’s IP address and port, as well as user and password, and enable insecure connection.
Keep the broker on and open a new 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:pswd@192.168.1.123:1883/treon/devices/1234abcd
Replace the host and password values. Replace ‘host’ with your computer’s IP address and replace ‘topic’ with your Treon Gateway’s MQTT publishing topic. By default it is:
treon/devices/ID/#
and replace ‘ID’ with your Treon Gateway’s device ID. Now you can see the incoming messages in real time.
Treon Support
You still have questions? Our dedicated team of experts is happy to help you! Please contact Treon Support directly by e-mail.
Did you know? Treon offers Premium Support and Maintenance Packages for our customers. Get even more out of Treon and boost your sales - inquire now about features and prices!