OpenHAB is home automation software that connects to devices from different vendors. OpenHAB uses a Mosquitto (MQTT) server as a message broker so that clients and servers can post messages to each other. For example, OpenHAB posts a message for Light1 to turn on. Light1 is listening for Light1 messages and turns on.
I am using a couple of sources to install openHAB 2 as a virtual guest on my KVM server. I previously used Matt Kaczynski’s MK-SmartHouse excellent Video Guides for installing openHAB 2 on a Raspberry Pi using the openhabian image. I will use these guides in conjunction with openHAB’s installation guide for Linux. This works for apt based systemd systems. Note that Zulu 8 is a prerequisite.
$ sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys 0xB1998361219BD9C9
$ sudo apt-add-repository ‘deb http://repos.azulsystems.com/ubuntu stable main’
$ sudo apt-get install zulu-8
$ wget -qO – ‘https://bintray.com/user/downloadSubjectPublicKey?username=openhab’ | sudo apt-key add –
$ sudo apt-get install apt-transport-https
$ echo ‘deb https://dl.bintray.com/openhab/apt-repo2 stable main’ | sudo tee /etc/apt/sources.list.d/openhab2.list
$ sudo apt-get update
$ sudo apt-get install openhab2
$ sudo apt-get install openhab2-addons
$ sudo systemctl start openhab2.service
$ sudo systemctl status openhab2.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable openhab2.service
Next is the MQTT server installation:
$ sudo apt update
$ sudo apt install mosquitto
$sudo apt install mosquitto-clients
Use MQTT.fx to test the installation.
At this point I am switching to MK-SmartHouse for configuration. The openhabian image for the Raspberry Pi has already done the work to this point.
I am migrating from the openhabian server on my Raspberry Pi. I plan to configure the server then copy the config files and hosts file from the old server.
Upgrading to OpenHAB 2.4
I broke OpenHAB after upgrading to OpenHAB 2.4 on my Raspberry Pi. You must also upgrade the mosquitto server. MK SmartHouse has a video to describe the process.
$ sudo apt-get remove mosquitto
From paper ui Addons /Bindings uninstall mqtt 1.0 binding.
From paper ui Addons / Bindings install mqtt 2.4 binding.
From paper ui Addons / Misc install Embedded MQTT Broker.
From paper ui Inbox select System MQTT Broker and add as thing.
Optionally from paper ui Configuration / Services, configure MQTT Embedded Broker.
Test MQTT with MQTT.fx.
From paper ui Inbox serch for things and select MQTT Binding then add manually then select Generic MQTT Thing (9:53)
Pickup with New Migration Tutorial
This is from OpenHAB.org.
From PaperUI inbox, add new thing and select MQTT Thing binding.
Add a new thing in PaperUI and select a Generic MQTT Thing and give it a name.
Edit the thing and add a new channel