Home automation has gained a lot of popularity nowadays as it enables people to live a smart life. With MQTTRoute integrated into the home automation platform you can easily develop your own home automation system. OpenHAB is one such open source platform you can use to automate your home devices. Here is a step by step tutorial on how to integrate MQTTRoute with the OpenHab.
MQTTRoute integration with openHAB
OpenHAB : Installation
OpenHAB can be run on different versions of macOS and Windows and many different variants of Linux (Ubuntu, Raspbian, etc.).
Prerequisites : You need to get any of the JAVA platform installed mentioned below
Now download & install Java 11
Check your current java version by opening a command line
Then Set up variants by Downloading and extract a platform independent zip archive: macOS, Windows, Linux.
Now install the downloaded packages using the below link
Installation in Raspberry pi
For installing OpenHAB on Raspberry Pi, first, download the appropriate OpenHabian Disk Image for your Raspberry Pi. Here I have choosen Raspberry pi 3.
Go to https://etcher.io/ and install Etcher on your computer.
Once installation is done, open Etcher select the openhabian disk image you have downloaded in the first step.
Choose the right SD card and click Flash. Before this have your SD card formatted.
Insert the SD card on your pi & connect an Ethernet cable & power it up. To configure wi-fi, please check this post.
Once done, navigate either to the http://localhost:8080 or https://localhost:8443
It is better to use https://localhost:8443 as MQTTRoute UI also opens in the default port 8080.
OpenHAB : Configuration
First & foremost sign up with the new account.
Follow the steps mentioned by Open HAB. You can either finish up with the configurations or can be done it later.
Once you finish your set up. Let us move on to Add-ons which is present under the settings tab.
- Click Bindings under Add-ons
- Select MQTT-binding in the given list.
Your MQTT-binding set up is completed now.
OpenHAB : MQTTRoute Integration
Complete your download & installation step of MQTTRoute.
You can check the link for step by step procedure for installation.
Once done, go to Bevywise/MQTTRoute/conf You need to enable authentication in broker.conf file.
AUTHENTICATION_ENABLED = YES
# YES || NO
Save your changes.
Now move to the openHAB UI.
- Let us add MQTT Broker using Things tab.
- Add things by clicking the + icon present at the bottom.
- Now select MQTT Broker as Thing type from the list.
- The configuration need to be set correctly to make MQTT Broker & OpenHAB communication.
- Click show advanced.
- Provide IP or host name of MQTTRoute 127.0.0.1
- By default port will be set as 1883. In case if TLS is enabled in the broker.conf file. You need to change the port here.
- Now enter username and password which is provided in the security tab of MQTTRoute UI.
Once done click submit. If your configurations are set correctly the toggle button will show Online. You can view the OpenHAB device connected to the MQTT Broker in Devices tab. You can now connect your home devices in the devices tab of OpenHAB UI.
Hope this article provide you a detailed view on openHAB integration with MQTT Broker. Try setting up with the home automation platforms by yourself & integrating MQTTRoute to control your home devices.