[GPIO] New GPIO Binding for OH3

Hi there!
I developed a GPIO Binding for openHAB 3. It is expected to be available in openHAB 3.1.

If you want to test it before the official release, you have to type the following commands in the openHAB console (not the console of your system):

bundle:install https://openhab.jfrog.io/artifactory/libs-pullrequest-local/org/openhab/addons/bundles/org.openhab.binding.gpio/3.1.0-SNAPSHOT/org.openhab.binding.gpio-3.1.0-SNAPSHOT.jar
bundle:start org.openhab.binding.gpio

For usage instructions, please take a look at the README and keep in mind that pigpio needs to be installed on the Raspberry Pi that you want to connect to.

Known problems:

  • If pigpio or a remote Raspberry Pi is restarted, the thing needs to be disabled an re-enabled. I am searching for a better solution.
  • The installation procress of pigpio on openhabian is not easy enough.

Happy testing!

Best regards,
Nils

13 Likes

you are a rock star buddy! :+1:
lots of folks have been asking for this and I have a project in the planning stages which this will help with, thank you for your contribution

2 Likes

Hi @nbauer
This is great! thanks for sharing this.

I use pigpio as a replacement for lirc. My usecase is something like i documented here
In summary, i use the irrp.py file as detailed on the page here and pass a series of on/gap/off codes to simulate an IR remote for my air conditioner. In the backend its using pgipiod.

If i understand correcty, at the moment the binding sends or receives a unitary on signal which it writes to the switch. Is there any possibility to extend this to mirror the functionality of the irrp.py file?

thanks in advance.

This is great news to hear. The documentation is not clear on if this can be used to connect to the local pins on the pi that is running OH3 installed with openhabian. Do you just use the IP of the OH3 pi that you are running on? Raspi-config is not part of the openhabian installation anymore. I will see if I can get it going tonight. Thank you.
UPDATE: I can only see an option to add a remote GPIO thing. When I add that as a thing with the IP of the OpenHAB raspberry pi, there is a comm error. I am suspecting that pigpio is not being installed correctly and that is why I cannot see a local option for the gpio thing.

First of all Big Thank You @nbauer for your work, i haven’t tested this yet but i will as my whole OH system based on GPIO BINDING, unfortunately i dont understand why the Dev Team for OH3 deprecated GPIO BINDING, to me it makes no sense making such a beautiful system that dont have Such a beautiful Binding that actually shuld be the heart of the OH period.

Thanks again and i will report back

3 Likes

Good day,
I am trying to input the command through SSH and I keep getting the error
“-bash: bundle:install: command not found”

Am I doing something wrong.

Thank you.

Yes, you need to enter openHAB’s console first. Without knowing what you’re working on, try this command after your have SSH’d in:

openhab-cli console

and enter the password which is normally habopen. Then try your bundle commands again.

4 Likes

By default, pigpiod runs in local mode (with -l option) and for some reason, it’s preventing openHab from connecting. Running raspi-config will remove that option, but as openHabian has removed raspi-config, you will need to set Remote GPIO manually. Just create a new service config and reload:

sudo mkdir -p /etc/systemd/system/pigpiod.service.d/
sudo nano /etc/systemd/system/pigpiod.service.d/public.conf
[Service]
ExecStart=
ExecStart=/usr/bin/pigpiod
sudo systemctl daemon-reload
sudo systemctl restart pigpiod
sudo systemctl status pigpiod
3 Likes

Hi, I will have a look on this when I have more time. I use this library for communicating with pigpio. If you find a solution using this, I can maybe add this feature it faster.

Thanks a lot for writing this down!
I have to try this out myself, update the README and send this also to the openhabian team. Unfortunately, my studies are currently taking up a lot of time, but I’m trying to work it in as soon as possible. But of course you can also make a pull request if you like to.

Thank you for the instructions. I will give this a try when I get home and report back any successes or failures. It would be nice if these instructions made it into the README for us users using openhabian.

Thanks for your work. I am happy
A little problem:
After a restore with “openhab-cli backup”
the GPIO-Binding ist lost.
I have to reinstall and restart the GPIO bundle.
Is there a workaround?
Does anyone have an idea for an automatic script?

mic (DE)

This solved my automatic start problem with openhabian, thanks!

I am using this binding since a month, just for setting three gpio pins but this works as expected - thanks to Nils!

1 Like

How can I control local gpio? Please any one help me

1 Like

i am using openhab 2 gpio home automation. running very good. but i want upgrade openhab 3.
when i am installing this bindings openhab 2 system running.
openhab-binding-expire1
openhab-binding-gpio1
openhab-io-gpio1

but openhab3 is missing.
i am using banana pi pro.

what am i wrong. thank you.
Note: i am installed binding-gpio and openhab-cli showlogs controlled
openhab-cli showlogs
2021-02-09 18:07:22.147 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘RaspiLED2’ received command OFF
2021-02-09 18:07:22.167 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘RaspiLED2’ changed from ON to OFF

binding-gpio
Adds GPIO support to openHAB.

Author

Nils Bauer

Version

3.1.0.M1

PR is in: [gpio] Update README.md by SebBoulet · Pull Request #9899 · openhab/openhab-addons (github.com)

1 Like

I am also the fan of gpio, would like to use al the gpios, as both output and input, for controlling relays and knowing signals from sensors.
I am waiting for the update of functioning gpios.
Thanks.

i don’t have any update yet. stick to OH2 or change System!
for me i don’t like the idea of not having gpio binding working on system made for automation.

1 Like

I think this would be fixed when the binding is included in the next openHAB version

Install pigpio on your local raspberry pi as descibed in the readme. Than use “localhost” as host in the config

1 Like