Sorry for late reply but I wanted to test some things. Also, sorry I am busy and did not have time to check by Oscope but I think my result may be helpful to some. I will try to make clear what happened for me while setting up Binary Sensor as input for my home alarm sensors (only 2 doors so far)
GOAL
My goal was to take existing alarm contacts (door sensor and motions) and use with RasPi and HA Binary Sensor. I previously succeed with this without any problem and expected task to be simple but it was a little complicated
TEST#1 (Fail)
I started by testing on bench(kitchen table) just to verify I could remember the pinout and make sure HA didnt have some error that came along since I last used for this purpose. This had issue where hi/low was not consistently detected (edge detect error).
TEST#2(Fail)
I wanted to test with know good install. I pulled SD Card from the RasPi running my gate using Cover component. This has x1 magnetic sensor and is connected to relay controlling gate Open. When I use this HA Install in my test configured for Binary Sensor my result was same, hi/low not properly detected.
INSTALL#1 (Success)
As stated in previous post, I have done this same setup 5 time previously without problem so I decided to ignore test result and install. I use a RasPi HAT that has screw down terminals for GPIO and standard 5VDC micro USB power supply. Sensor are the standard door reed switch with magnets connected from 3VDC to GPIO input with 1K ohm resistor. This worked without issue. Open/Close resulted in high/low change. I try opening just enough to change state and immediate close (assume <1sec change) and function was OK. I considered this success and post my information. I notice there was lower voltage 3.17vdc when I have success so I thought this useful and put this information.
INSTALL#2 POWER SUPPLY UPGRADE (Fail)
I wanted single supply for Motion Detectors(12vdc) and RasPi(5vdc) so I install power supply that supply both voltage (MEAN WELL RD-65A). Immediately after install this supply I have edge detect problems again.
RESISTOR CHANGE (Success)
I remember for my other Alarm Box changeovers I use 2.2K ohm resistors and decide to change from the current 1K to 3.2k resistance. This worked but I did notice if I try quick open/close (approx 750ms) it did not detect always. I increase resistance to 5.4k and even quick open/close(less than 500ms) is properly detected. After this was working OK I decide to also lower “bouncetime” from 300 to 50
FINAL RESULT (success)
Circuit: 3vdc>>5.4K ohm>>gpio input
binary_sensor:
- platform: rpi_gpio
ports:
17: Garage Great Rm Door
26: Garage Kitchen Dr
pull_mode: DOWN
bouncetime: 50
scan_interval: 10
NOTE
I use HA for Doorbell previously. Basically directly wired button into HA with 2.2K resistor just like an alarm contact. Upon thought I did have some issue for presses less than 1 second, but this is like result I receive before my change from 3.2k to 5.4k. honestly I’ve used GPIO for 4 separate installs/implementations of GPIO with HA and function was always stable enough for production use.
My previous HA Alarm install consisted of 2doors, 4motions and 1 doorbell connected to GPIO.
https://www.amazon.com/gp/product/B005T7EZM8/ref=oh_aui_detailpage_o04_s00?ie=UTF8&psc=1
https://www.amazon.com/gp/product/B01M27459S/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1