I’ve done a lot of searching, and posted a few specific questions, and I’m still floundering. Maybe if I ask this more generically someone can point me in the right direction…
Does anybody successfully use GPIO pins for a simple input binary switch? How?
I have a Raspberry Pi 3B+ running a Hass.io and HA at the current version. I have three GPIO pins connected to some relay contacts which are always either “on” (closed) or “off” (open.) It works exactly as designed… usually.
But, at least several times a day, one of the changes (on to off, or off to on) is simply not identified by HA.
I verified that electrically, everything is OK. I moved the relays close so there are no long wires to pick up interference. Even that short run I replaced with Cat6 shielded, twisted pair cable. I added external pull-up resistors. I bought a screw terminal connector so all the connections are tight; no breadboard. I experimented with different “debounce” values.
At this point, based on some reading in this forum and elsewhere, I’ve come to the conclusion that HA sometimes doesn’t detect the “edge” between “on” and “off.”
This was a real shock. Somehow I thought the RPi, and HA, would be looking at the state of the switch, not just the change. The revelation came when I realized that, if it misses the change, say, from on to off, then in HA it will show as “on” forever.
I’d appreciate any suggestions for overcoming this.