Oh 3 gpio

Hi there,

i updated from OH 2.5 to OH 3, but the GPIO Binding does not exist anymore. I tried to install the “new” GPIO Binding manually but i can´t activate the Remote GPIO features with raspi-config, because i´m using openhabian. Is there any other way to enable remote gpio ?
I alteady tried to install mqttany but this also failes of couse the used Pi 4b.


Install raspi-config. Or you can look into what settings raspi-config changes when enabling Remote GPIO and do those manually.

Before mqttany and a number of other similar scripts were written, I had written sensorReporter to do this for me exactly. It supports MQTT or the OH REST API. However, I don’t think the REST API stuff works with OH 3 because of the addition of authentication so I’d stick to MQTT for now. I recently rewrote it to improve maintenance and support Python 3 and use it daily on a couple of RPis to command and access GPIOs on RPis.

could you be explaining this in more details, gpio binding was easy and now is gone, its an automation os, so why taking gpio binding off?!

can you provide a link to how to make this works, i have some lights connected to rpi3-oh3 using relay board

thanks in advanced

No one volunteered to reimplement it as a 2.x type binding.

The READE at that link to sensor_reporter is pretty extensive. Do you have and specific questions or did you not try it?

Alternatively you can:

  • continue to run OH 2.5
  • continue to run OH 2.5 on the RPi and run OH 3 separately and use the Remote openHAB binding to interact with the OH 2.5 Items from OH 3.

I will give it a try, it sounds to complicated for me, im not as good in coding, i just feel like gpio binding should have been kept and more improved not take it away and make such a system that meant for automation to be over complicated, Home Assisstant might be somthing i have to look for since i dont like using older version for security reasons but hopefully OH3 developers take care of this, i been using OH for 5 years now if not longer.

I will report back if i end up solving this with your option


Again, no one took away the GPIO binding. But the GPIO binding is not compatible with OH 3. It won’t run. An no one volunteered to rewrite it to be compatible. Who ever developed the binding in the first place appears to have abandoned it. No of the other developers appear to use the binding. A survey was done to see how many users of 1.x bindings were using which binding and the GPIO binding did not rank high in the number of users.

So someone who has both the need and the skills to develop a new GPIO binding will have to volunteer to do so, or you will have to use any of the already previously mentioned options. If having a GPIO binding is important enough to you, you indeed might be happier using HomeAssistant. Though I’m not sure how that would be any less complicated to learn how to use an entirely new home automation hub compared to running a small and relatively simple script.

i just tried to go with your option but im already hit with things i dont know how to slove, 2. create a sensorReporter user
3. write your config ini file

i did: adduser sensorReporter --force-badname and than ok- is that correct?
next in step 3 i have no clue and it has a lot of stuff that i never experienced, aside from that the new OH3 its totally new so i need to learn that, anyway im gonna to try to google an
alternative way to the old gpio binding option if available, someone with no experience must have a project like me with relay board that needs to use gpio in easy way and hopefully someone will make it happend

Continuing the discussion from Oh 3 gpio:

Hy Ramyr,

sorry i´m to busy this time…

I´m about to use Mqttany, i think this will work. Do you already use MQTT ? I already installed Mqttany on my Pi 4. After modifying some files it seems to work, only my relais are switched on by default. At this time im searching for the parameter to keep the relays off on starting mqttany.

All you hav to do, take a look at here:

If you get errors lige these:

[19:17:42] root@openhabian:/opt/mqttany# python3 mqttany/mqttany.py
2021-01-06 19:18:00,183 [INFO ] [core ] MQTTany 0.13.0 starting
2021-01-06 19:18:00,276 [ERROR] [core ]

Traceback (most recent call last):
File “mqttany/mqttany.py”, line 110, in
core.start(queue_core, args.config_file)
File “/opt/mqttany/mqttany/core.py”, line 382, in start
import gpio
File “/opt/mqttany/mqttany/gpio/init.py”, line 47, in
board = get_board()
File “/opt/mqttany/mqttany/gpio/boards/init.py”, line 56, in get_board
return all_boards.get(Detector().board.id, Unknown)()
File “/opt/mqttany/mqttany/gpio/boards/init.py”, line 42, in init
self._chips.append(999) # dummy
AttributeError: ‘Unknown’ object has no attribute ‘_chips’

Take a look at this:

If you are using an PI 4, you have to fix the files like this:

I just wondering why the files are not fixed in the avtually V13.

Then you have to add some details like these to /etc/mqttany/mqttany.yml, i am usin the 8 channel IO Board, you have to modify the paramters for your usage.

host: ‘localhost’

polling interval: 60
debounce: 10

pin: 5
topic: ‘/{root_topic}/relay/1’
pin mode: ‘output’
invert: true

pin: 6
topic: ‘/{root_topic}/relay/2’
pin mode: ‘output’
invert: true

pin: 13
topic: ‘/{root_topic}/relay/3’
pin mode: ‘output’
invert: true

pin: 16
topic: ‘/{root_topic}/relay/4’
pin mode: ‘output’
invert: true

pin: 19
topic: ‘/{root_topic}/relay/5’
pin mode: ‘output’
invert: true

pin: 20
topic: ‘/{root_topic}/relay/6’
pin mode: ‘output’
invert: true

pin: 21
topic: ‘/{root_topic}/relay/7’
pin mode: ‘output’
invert: true

pin: 26
topic: ‘/{root_topic}/relay/8’
pin mode: ‘output’
invert: true

Maybe you will find out how to disable the relays on start up and let me know :slight_smile:

Do anywone now why the Remote GPIO feature or the Network boot options will not be implemented in the Openhabian image?
Is the Network boot option not a good option to eliminate the SD card problems ?
I think if i will install raspi-config this will destroy my openhabian?


There is a new gpio binding for openHAB 3. It’s available in snapshot and will be in the next release: [gpio] GPIO Binding initial contribution by nils-bauer · Pull Request #1334 · openhab/openhab-addons · GitHub

1 Like

Hi Hilbrand,

yes i have seen this before, but in openhabian i think the binding doesn´t work. I already tried the snapshot, but in my case it does not work. You can´t activate the Remote GPIO feature with openhabian-config. Or is there any other way?

I haven’t tried it myself. But the binding documentation gives some commands that can/need to be run on the command line. I would expect this to also work in openhabian just on the command line, but it’s not supported in openhabian-config afaik.

Hi there!
I am the author of the new binding. The installation of pigpio needs to be improved. I hope for the help of the openhabian people. There is an issue here: Add pigpio package · Issue #139 · openhab/openhabian · GitHub

The thread for the binding is here: [GPIO] New GPIO Binding for OH3

1 Like

I don’t know. Does that user exist now? Can you use sudo -u sensorReporter to run a command?

If you post what you’ve tried I can help.

They did. Two of such projects are called sebsorReporter and MQTTany. You might be able to make something work using the Exec binding.

It solves one problem by introducing a new degree of complexity and brittleness. And since many users wouldn’t have the means but ability to set up the boot server the other remains unfixed for those users. The zram solution mitigates the problem for all.

openHABian is just a bunch of scripts that configure a stock Raspbian. You can install and run raspi-config. However you can also break things depending on what you do and any changes you do make will make your openHABian deviate from the default and make it harder for us to support. But I doubt enabling remote gpio would be a problem.

Tried that already, not working

I will try to give it a try, i always had problems with mqtt so i don’t think i can get this right .

I miss my gpio binding …

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.