[GPIO] New GPIO Binding for OH3

Tags: #<Tag:0x00007efecfc4f318> #<Tag:0x00007efecfc4f0e8>

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

6 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

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.

2 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
1 Like

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.