GPIO Support - OpenHAB 2

I tried to boot up openHAB 2 which looks promising.
I didnt found a binding for GPIO within the release.

Is this feature dropped in openHAB 2?

I doubt it would be dropped. I might not yet be ported however.

It is not about porting them, it is about testing them and adding them to the distro.
I noticed that this wasn’t yet well documented, which I have just done here now:

1 Like

I was wondering if someone did try the GPIO Binding in the meantime?

I’d love to test it myself, but my time to play with it is very limited -.-

Well, thanks to an other sleepless night I was able to test it.

It works for me using the latest Jenkins build #1203

Just put it in the addons folder, make sure to unexport the GPIOs before starting OH2 and it works.

I use the binding to realize a switch item:

Switch Rasen1 “Rasen rechts” {gpio=“pin:4” }

1 Like

Thanks, that’s good news!
@maintainer Anybody willing to add it to the distro then?

@maintainer To make it easier for everybody, I have just enhanced the documentation on how to add a binding to the distro.

If nothing changed recently openHAB is still using the Eclipse SmartHome as its core framework. :wink:
“openHAB 2 used Eclipse SmartHome”… used => uses

Thanks, why don’t you fix it yourself next time? :sunglasses:

1 Like

I’m having problems getting it to work at all. I had a working OpenHab 1 with GPIO then I wanted the Hue emulator which is only on version 2 so I upgraded.

I have got 2 working just fine, but not GPIO. It acts as if it the addon is ignored. What I’ve done is:

feature:install openhab-runtime-compat1x
Copied org.openhab.binding.gpio-1.8.2.jar and to /opt/openhab2/addons/

I copied my old openhab.cfg to /opt/openhab2/conf/services/

In the items file I have lines like this:

Switch BlindUp “26” (gBlinds) { gpio=“pin:26” }

The switches appear on the UI but no gpio is changed.

openhab2 is running as root

ls /sys/class/gpio/ gives:
export gpiochip0 gpiochip100 unexport

Which shows nothing is binding.

Controlling the gpio from the command line outside openhab works fine.

I see no errors in any logs that might suggest what the problem is.

This is with a Raspberry Pi 3 with Rasbian.

Any ideas?

Please try the 1.9 snapshot version of the binding instead!

Now you say that it sounds obvious!

I can’t find anywhere to download a 1.9 snapshot, I take it I need to set up the IDE and build it?

Edit: Found here:

The nightly builds can be furnished from cloudbees. Search for “openhab cloudbees” and I’m sure you will find it.

1 Like

Thanks, I grabbed the 1.9 snapshot. It would not work at first until I renamed the files to have no version number, i.e.:

 $ ls /opt/openhab2/addons/
org.openhab.binding.gpio.jar  README


Cool - so will you create a PR to add it to the distro then?

I will give it a go. It will take some time with some learning curves but I should be able to.

BTW, it stopped working after restarting. Tailing logs suggested it still had 1.8 hanging around so I did a fresh clean install of oh2 and copied over the files and it works now even after a restart. No need to rename any addon jar files either.

I’m stuck and need some help from someone:

I could make a pull request but it would be pulling something known to produce build errors.

1 Like

Fixed. PR made.


i have the same Problem with GPIO after Updating Openhab2. I am using Openhab2 on Opehabian. That why it is maybe different with you. I found the folder Opt but under this Folder i did not find the different Folder (openhab2 or addons).
I found some folders with name Openhab2:

  • /usr/share/openhab2 ( addons, bin, runtime,
    -/etc/openhab2 (html, icons, items, persistence, rules, scripts, services, sitemaps, sounds, things, transform)
    -/var/lib/openhab2 (cache, config, etc, hueemulation, jsondb, kar, log, openhabcloud, persistence, tmp, zwave)

can you tell me what kind of folde i should put in? or did you yourself these folders?

Thank you for your help, i am waiting for your reply.


1 Like


any luck?