[SOLVED] GPIO binding not working on Raspbian Strech


I installed today a fresh image of Raspbian Strech to test OpenHAB2 (2.3.0-1) on a RaspberryPI 2.
I am trying to control some GPIO port so I installed the GPIO Binding (binding-gpio1 - 1.12.0).

User openhab has been added to the gpio group; I checked the openhab user can put the GPIO port off and on using the command:

sudo -u openhab gpio write 23 0 or sudo -u openhab gpio write 23 1

I created the following item in home.items:
Switch Relay1 “Relay1” { gpio=“pin:23 activelow:yes initialValue:high” }

and the following sitemap in home.sitemap;

sitemap home label=“Test GPIO”
Switch item=Relay1

From BasicUI, I can see my Relay1 switch but it does not trigger anything on the GPIO.

In the log, I don’t have any error, I see this related to the GPIO:

In openhab.log:
[DEBUG] [org.openhab.io.gpio ] - BundleEvent STARTING - org.openhab.io.gpio
[DEBUG] [org.openhab.io.gpio ] - ServiceEvent REGISTERED - {org.openhab.io.gpio.GPIO}={service.id=313, service.bun$
[DEBUG] [org.openhab.io.gpio ] - ServiceEvent REGISTERED - {org.osgi.service.cm.ManagedService}={service.pid=org.o$
[DEBUG] [org.openhab.io.gpio ] - BundleEvent STARTED - org.openhab.io.gpio

and in events.log:

[vent.ItemStateChangedEvent] - Relay1 changed from NULL to OFF
[ome.event.ItemCommandEvent] - Item ‘Relay1’ received command ON
[vent.ItemStateChangedEvent] - Relay1 changed from OFF to ON

Does someone knows what’s wrong ?

Thank you

Find the solution of my problem, issue was due to the definition of the item where I used the GPIO number instead of the BCM number.
So in my case on a Raspberry Pi, for GPIO 23, I have to use this:

Switch Relay1 “Relay1” { gpio=“pin:13 activelow:yes initialValue:high” }

Where “pin: 13” is the BCM value reported by the command: gpio readall

Working great now.

PS: By the way, I also removed the JAVA_ARGS from /etc/default/openhab2 and it’s stil lworking.