OH on Synology Switching relais connected to Raspberry Pi

I have my setup of OH on a Synology server. This runs very stable. Now I have a raspberry Pi with Raspbian installed and connected to a relay module.
I am able to switch the relays by sending a command via SSH to the raspberry Pi from my laptop running a terminal screen.
Now I am looking for a way how to connect the raspberry pi to OH and being able to use the OH buttons to switch the relais.
Is the way to go using the GPIO binding,exec binding, MQTT or a different solution.
I would like to use it for my garage doors.

One of the possible options would be:

  • WebIOPi on Raspberry
  • HTTP binding in OH

I have WebIOPi running on the raspberry. Did check this with a webpage with one button to switch the GPIO pin on the raspberry. It is working correctly.

Now I am blocked by the HTTP connection. The raspberry is reachable on 10.10.10.16.
Some guidance is appriciated how to send switch commands to openhab.

WebIOPi supported command format is here: http://webiopi.trouch.com/RESTAPI.html
You will need to use HTTP binding in OH to send such commands.
Your item definition will be something like this:

Switch Heater "Heater" <heating> { http=">[ON:POST:http://10.10.10.16/GPIO/0/value/1] >[OFF:POST:http://10.10.10.16//GPIO/0/value/0]" }
Not tested though.

I can not get it to work after few day testing. With WebIOPi I am able to control the GPIO pins from a normal webpage. This works like a charm.
But from openhab it is not working. I have installed the 2 bindings for GPIO.
I have assumed that in the following code the 0 after GPIO has to be replaced with the pin number to be switched. In my case I would like to switch pin number 5 (GPIO 3).

Switch Heater "Heater" <heating> { http=">[ON:POST:http://10.10.10.16/GPIO/0/value/1] >[OFF:POST:http://10.10.10.16//GPIO/0/value/0]" }

`

You don’t need any bindings for GPIO as you’re not going to control any GPIO ports on the machine running OH.
For OH to talk with WebIOPi you need to use HTTP binding.
Try to manually test various Set & Get commands from your browser. Once you found them working - just use the same URL in your item configuration.

No, the page I mentioned says gpioNumber, it would be 3 in your case

I come closer to the solution but not completely there.
With the command : http://10.10.10.16:8000/GPIO/3/function I do get the reply “out”.
With the command : http://10.10.10.16:8000/GPIO/3/value I do get the reply “1”.
So far so good.
When I change this command to write it does give an error.
This is the command : http://10.10.10.16:8000/GPIO/3/value/0
The error is : Error response
Error code: 404
Message: 3/value/0 Not Found.
Error code explanation: 404 - Nothing matches the given URI.

Also with the command : : http://10.10.10.16:8000/GPIO/3/value/1 I do get the same error.
I have no clue how to construct the right command.

In fact you cannot send HTTP POST from the browser without installing some add-on.
Please try now from OH.