openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.71k forks source link

Gpio Binding doesn't work correct with pin 17 and 4 #5905

Open FirstWithThisName opened 4 years ago

FirstWithThisName commented 4 years ago

If openhab reloads the item file with the gpios this error messages appears:

2019-10-16 14:19:41.649 [ERROR] [ab.binding.gpio.internal.GPIOBinding] - Error occurred while creating backend object for item RELAY_1, exception: The pin with number '17' is already registered 2019-10-16 14:19:41.795 [ERROR] [ab.binding.gpio.internal.GPIOBinding] - Error occurred while creating backend object for item RELAY_2, exception: The pin with number '4' is already registered

This is a snippet my related items file: ` / relays connected to gpio /

Switch RELAY_1 "RELAY_1" { gpio="pin:17 force:yes" } Switch RELAY_2 "RELAY_2" { gpio="pin:4" } Switch RELAY_3 "stall" (outdoor, light) { gpio="pin:16" } ` I have more gpios in use, and the work fine.
After a reboot, all pins are working as expected. I found out that the pins are configured as input by looking at the file /sys/class/gpio/gpio(4|17/direction

After changing the direction I am able to control them via bash, but don't via openhab. If openhab reloads the items file I get the same error message.

I am using a raspberry pi b+ with raspbian and openhab version 2.4.0. The user openhab is member of openhab tty dialout pi bluetooth gpio.