OpenHab gpio button

Eran Goldman-Malka · September 13, 2017

I started with openhab and figured out that getting a button pressed to react is considered one of the most challenging tasks

The setup is simple, raspberry pi 3 with two jumpers from pin four and GND. To simulate button press, I connect them.

  1. Get your openhabian and install it on the pi – this step took me around 3 hours

  2. Go to http://[openhabian_ip]:8080/paperui/

  3. Install the GPIO addon

  4. Connect the device with ssh and add two files:
    vim /etc/openhab2/items/btn.items
    

    Contact NormallyOpenPushButton “Normally Open Push Button [%s]” { gpio=”pin:4 debounce:10” }

    vim /etc/openhab2/things/btn.things
    

    contact:gpio:NormallyOpenPushButton

    vim /etc/openhab2/sitemaps/test.sitemap
    

    sitemap default label=”My first sitemap.” { Text item=NormallyOpenPushButton } ```

  5. Go to http://[openhabian_ip] :8080/basicui/

and choose the test sitemap

you should see one line that indicates if the button is close or open, touch the two wires and refresh, and you’ll see it change state

That’s a basic example, but it seems that a lot of people find it hard to figure out what’s going in openhab,

more examples in the future when I’ll learn some more about openhabian

Twitter, Facebook