ebaauw / homebridge-rpi

Homebridge plugin for Raspberry Pi.
Apache License 2.0
308 stars 18 forks source link

Button device not working #176

Closed tinkerer9 closed 5 months ago

tinkerer9 commented 5 months ago

I tried to connect a button with both GPIO pins 5 and 18 on my Raspberry Pi 4B. I tried both pullup with the GPIO pin connected to GND and also none with the GPIO pin connected to either '3V3' or GND. It always shows that it is not pressed both on the Homebridge dashboard and on the Home app. I tried the same setup with the contact switch and it worked perfectly.

I'm not sure why this isn't working. The logs show no errors or warnings. I'm happy to provide more information.

ebaauw commented 5 months ago

Please provide more information.

tinkerer9 commented 5 months ago

Updated issue

ebaauw commented 5 months ago

If the log shows no debug messages that the GPIO pin changes state, this is an issue with your wiring, and not with Homebridge RPi.

Not sure what type of hardware button you have, but the ones I know need three out of the four pins connected: lower right: 3.3V, lower left: ground (with a resistor), and upper right: the GPIO pin. I suppose you could replace the ground by a pull-down resistor, but I don't think I've ever tried that. Normally button connects the pins straight (so GPIO is pulled down to ground), but when pressed it crosses the connections (so the GPIO is connected to 3.3V).

Note that stateless programmable switches just bounce when activated. As the name suggest, they don't have state to show that a button was pressed. Also note that you need a HomeKit hub for these to work (i.e. to assign an action to the button press).

tinkerer9 commented 5 months ago

Alright, I'll try that when I get home.

On Mon, Apr 29, 2024 at 9:08 AM Erik Baauw @.***> wrote:

If the log shows no debug messages that the GPIO pin changes state, this is an issue with your wiring, and not with Homebridge RPi.

Not sure what type of hardware button you have, but the ones I know need three out of the four pins connected: lower right: 3.3V, lower left: ground (with a resistor), and upper right: the GPIO pin. I suppose you could replace the ground by a pull-down resistor, but I don't think I've ever tried that. Normally button connects the pins straight (so GPIO is pulled down to ground), but when pressed it crosses the connections (so the GPIO is connected to 3.3V).

Note that stateless programmable switches just bounce when activated. As the name suggest, they don't have state to show that a button was pressed. Also note that you need a HomeKit hub for these to work (i.e. to assign an action to the button press).

— Reply to this email directly, view it on GitHub https://github.com/ebaauw/homebridge-rpi/issues/176#issuecomment-2083130950, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2JQL6ZM4D22LZWVTWBJK2DY7ZV75AVCNFSM6AAAAABG5PF23SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGEZTAOJVGA . You are receiving this because you authored the thread.Message ID: @.***>

--

Max Parisi

tinkerer9 commented 5 months ago

Thank you! It seems like neither Homebridge nor Homekit shows if a button is currently pressed, which makes sense. I looked in the logs again and it shows single presses, double presses, and long presses. My bad.