How to install a new Binding in OpenHab – a simple 5 minute guide

Published by Oliver on

This is a very quick guide on what a “Binding” is in and how to install a new Binding in OpenHab 2. All the information you will need to get started in as few sentences as possible.

If you are new to OpenHab: welcome! It is an awesome open source project that I have used for years to build my own smart home. I do know from my own experience that it can be quite daunting in the beginning. To make it easier for you to start here is a super quick rundown of what a Binding is in OpenHab and how to install a new one.

Quick note before we start: while Bindings also existed in OpenHab 1 I will be concentrating on OpenHab 2 versions here.

What is a Binding in OpenHab?

OpenHab is an open source and technology agnostic system. This means unlike systems like Hue, Tradfri, Alexa… it is made to work together with as much hardware (and software) as possible.

To be able to work with all these different systems OpenHab internally uses a layered system. Items are virtual devices that exist in OpenHab only. They can be linked to Things which represent and connect to physical devices. As these Things can be anything from a Philips Hue light bulb to a smart vacuum OpenHab needs to know how to interact with those.

This knowledge about new Things can be added to OpenHab via so called “Bindings”, sometimes also called add-ons. A list of all official bindings can be found here. There are different ways of installing new bindings in OpenHab: via the PaperUI or via configuration files. Here is how to do both.

How to install a new Binding in OpenHab via the PaperUI?

A simple and visual way of installing a new Binding in OpenHab is using the PaperUI. Simply select the “Add-ons” tab on the left side and you will see a list of all available bindings, as well as other extensions like actions, pseristence, transformations and even new user interfaces. Click the bindings tab to see bindings.

PaperUI in Openhab. Lists all bindings and shows you how to install a new binding in openhab
PaperUI list of all (installed) bindings

All bindings you have already installed are marked by a blue icon and can be uninstalled via the “UNINSTALL” button. Uninstalling a binding will not remove any Things or Items but they might stop working. Underneath the binding you can see the version number which can be important for bugs. Usually you upgrade your bindings by upgrading the whole OpenHab instance.

To install a new binding here just use the search bar at the top to filter for the binding you are looking for. Once it is found simply click the “INSTALL” button and wait until the loading animation has finished. You can now use the new binding. If you are unsure how to do that just click on the binding name and you will be redirected to the bindings’ documentation.

How to install a new Binding in OpenHab via the config files?

Another way of adding Bindings to OpenHab is by directly adding them to a configuration file. The configuration files of OpenHab can usually be found in /etc/openhab2 or /opt/openhab2/conf. This directory will include a bunch of different folders for the different layers of OpenHab. Each folder can contain several configuration files.

To install a bindings this way you need to find the services/addons.cfg file. Usually it already contains some comments with the possible values. If you want to install a binding you need to add their ids to a comma-separated list in the binding = line. If you need to install OpenHab 1 bindings too, then change the legacy option in the same file to true.

# file
legacy = true
 #if needed

binding = astro,mqtt1 #...
# rest of file

To find out the id of the binding either check the PaperUI or the documentation of the binding. The PaperUI will show you the binding version as binding-astro - 2.5.5. Remove the “binding-” and the version and you will get the id: astro. You can also see that id in the URL of the documentation: https://www.openhab.org/addons/bindings/astro/.

Once you are done just save the file and OpenHab should install the new binding(s).

Additional ways of installing bindings

For advanced users there are even more ways of installing bindings. If you want to install a binding that is not yet available via the “app-store” of OpenHab you can download the .jar file and drop it into the addons folder of your OpenHab installation.

It is also possible to use the OpenHab console to manage bindings. I would personally recommend using one of the two solutions above though.

Categories: OpenhabBasics