Connect with OpenHAB
OpenHAB, also known as open Home Automation Bus, is an open-source home automation software written in Java. With the strengths of integrating various devices, providing a clear user interface, and supporting the most flexible tools, openHAB becomes one of the most outstanding platforms in the field of home automation.
With the high flexibility and ease of use, openHAB provides a particular binding for users to connect MQTT Broker. In this article, we will introduce you to the process of setting up the EMQX Platform MQTT Broker with openHAB.
Prerequisites
Before connecting your OpenHAB application to the EMQX Platform, ensure you have deployed an MQTT broker.
Deploy MQTT Broker
OpenHAB Initialization
If you are using MQTT for OpenHAB for the first time, please refer to the quick start.
Install OpenHAB
In this example, we use Docker to quickly install OpenHAB.
bashdocker run -d --name=openhab --restart=always --network=host \ -v /opt/openhab/conf:/openhab/conf \ -v /opt/openhab/userdata:/openhab/userdata \ -v /opt/openhab/addons:/openhab/addons \ openhab/openhabThen access the OpenHAB service via the local IP with the corresponding port, e.g., x.x.x.x:8080, to create an account.

Next, you can select language, region, time zone, location of your home. Once configuration is finished, you will be redirected to openHAB console.

Install Bindings
Go to
Settings--->Bingdings--->MQTT Bindingand install MQTT Binding:
Add
MQTT BrokertoThings
Then select
MQTT Brokerand fill in the information of the deployment we created before.
Connect over TCP Port
This section describes how to connect an openhab client to MQTT broker over TCP port.
- Fill in the broker address, port, username and password (if it exists).
- Select
TCPfor MQTT transport.

Connect over TLS/SSL Port
This section describes how to connect an openhab client to MQTT broker over TLS/SSL port.
- Fill in the broker address, port, username, and password (if they exist).
- Enable
Secure Connection. - Select
TCPfor MQTT transport.


Test Connection
Go to Settings ---> Things ---> MQTT Broker, when there is a little green label that says "online", you are successfully connecting openHAB with EMQX Platform. Congrats!

You can also check the status from the EMQX Platform's monitor page.
