Raspberry Pi3 Openhab2 GPIO - not working - please help

Hello from Puerto Rico!

I’m new to python, raspberry and openhab…

here what I’m trying to do.

I would like to to turn on and off an LED with my RPI3 GPIO from openhab2.

I have try what I have read on every search I had made for the past 5 days but without any luck… like I say I’m now to raspberry OS and python…

I’m able to turn the led on and off using the terminal but not using openhab2. I have installed the GPIO binding and nothing. I also try using openhabian and nothing…

any help will be really appreciate

I’m using the latest openhab2

GPIO is one of the hardest bindings to get working.

First, it is a whole lot easier to help when we are provided sufficient information.

what version of OH?

how was it installed?

what errors so you see in the log?

what is the binding config?

what are your relevant items and things?q

Did you consider to use the exce binding to control the pi?

For me that works well to read 1-wire sensors. But I have not yet tried to use it for output purposes.
I was following this tutorial GPIO 1-Wire Temp sensors on Raspberry Pi with openHABian

What are the major steps?

  1. Write a shell script to read the sensors
  2. Put in in the /ets/openhab/scripts directory
  3. Test this file (can be done on the pi)
  4. use the exec binding to run it from OH

Because you already have it working in a terminal, I would agree that using exec binding and scripted commands is going to be the fastest solution here. I have used GPIO on the pi for output as well as reading sensors.

For GPIO ouput control on the raspi, Check out the wiringPi library here http://wiringpi.com/
Very simple to implement, and you can just as easily script the commands. Then use exec binding to run commands for openhab switch ON/OFF.

Hi rlkoshak, thanks for the reply

I’m using the latest openhab2, I downloaded Raspbian and did the apt-update/upgrade and downloaded later the openhab2 and did the update…

Logs, I don’t know how to get them… like I say I’m new on this.

I installed the Wemo, and the GPIO biding… Wemo work perfect. but I don’t get anything on the GPIO…

I was able to find on the net to run this commands:
“sudo /etc/init.d/openhab2 stop” and “sudo /usr/share/openhab2/start.sh” and when I do it it runs with out any issues… so I’m thinking it could be a permission issues… that I don’t know how to fix it… when run this commands it works until I reboot the raspberry… and when I run that command my homekit MISC that is running just doesn’t work…

so I’m try to learn more, and I’m try to turn on and off some LED connected to GPIO so I can learn how its work so I can move forward and keep learning other stuff…

thanks again for your reply

HI Openhabiger thanks for you reply

no I have not, I would have to look for more information on how this works. I will read that link!

Thanks

The latest stable or the latest snapshot?

For an apt-get installation, the recommended and preferred installation method for operating systems that support it, logs are located in /var/log/openhab2. For any installation type you can see the logs in the Karaf console:

http://docs.openhab.org/administration/logging.html#karaf-console

Those are very old commands.

To stop oh you should use:

sudo systemctl stop openhab2

Agreed that points to a permission issue.

Did you read and verify the prerequisites documented in the binding’s readme?

http://docs.openhab.org/addons/bindings/gpio1/readme.html#prerequisites

In particular that you must either run OH as root or add the openhab user to the gpio group.

Yes it was a permission issue!!! I forgot to change the openhab.services to root… even openhab was added to the gpio group it was not working… but not it is!!! Thanks !!!

now I’m going to see how the exec binding works… since I would like to be able to read an DHT11 Temp & Humi Sensor Module. so lets see how that works!!!

Just in case. :wink: