Reading a button input using the GPIO binding

Tags: #<Tag:0x00007f617a734ff0> #<Tag:0x00007f617a734578>

Hello!
I want to connect a simple button to the GPIO pins of my Raspberry Pi which is also running OpenHAB 2. Controling pin output using a Switch item works perfectly without issues, but I’m having trouble using a pin for input.
I installed the GPIO binding and set up an item according to the docs:

Contact Button {gpio="pin:2 debounce:10 activelow:yes"}

I connected the button to GPIO pin 2 and a 3.3 V pin and pushed the button. But it doesn’t work.

After some investigation, I found out that as soon as OpenHAB reloads my item (e.g. by restarting OpenHAB or reloading the items file after I changed it), some voltage comes out of Pin 2. If i put an LED between pin 2 and a ground, it gets about half-way lit. The item remains in the CLOSED state no matter what I do to the physical button.

But as soon as I run pigs p 2 0, the button and item start to behave as expected until the items file is reloaded again. I can of course set up a rule to run this command automatically, but that really doesn’t seem like the right way to go.

What is going on? Why does the binding seem to start a duty cycle on a pin it is supposed to read from?

I’m running OpenHAB 2.4 on Arch Linux ARM on a Raspberry Pi 4B. Thanks!

You’ve not mentioned using a pulldown with that?
This may help