- MQTT Binding for OpenHAB
Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 3.1 and 3.1.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.
The MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.
First we need to Download the latest binary and execute it:
The Installer will ask to download and install the latest version of Win32OpenSSL and copy all
.dll's to the Mosquitto install directory:
And the same with this pthread.dll:
Download MQTT.fx as a MQTT Client for MQTT testing/debugging. Install and start the program and connect it to our local MQTT server:
We can test the MQTT Service by subscribing:
Going back to the Publish tab and sending a message:
The message should show up in the Subscribe tab:
Make sure that the Mosquitto Service is running: During the installation of Mosquitto you were given the option to automatically run the server as a Windows Service. This option is checked by default. You can verify that the service is actually active in your Windows Task Manager:
If you are running Mosquitto just for testing, you might have chosen to exclude the Windows Service during the installation step. In this case just run the mosquitto.exe from your Command Line (you might have to start CMD as Administrator):
You know that Node-RED has detected the MQTT server, when your MQTT Nodes say that they are connected:
To be able to use the MQTT Protocol in OpenHAB, you need to install the MQTT Binding from the OpenHAB Paper UI: