ratgdo / esphome-ratgdo

ratgdo for ESPHome
GNU General Public License v2.0
357 stars 108 forks source link

Deadband required for dry contact inputs #110

Closed PaulWieland closed 1 year ago

PaulWieland commented 1 year ago

An ESP Home user reported that their door was being unintentionally activated See here. They happened to notice that the dry contact input was the culprit.

I just did some testing and realized that there doesn't seem to be any deadband setup for these inputs which means noise can cause unwanted input triggers.

I would suggest we require the dry contact inputs to be closed for 500ms (that's what the mqtt firmware uses) before accepting that input as valid.

bdraco commented 1 year ago

Probably could use https://esphome.io/components/binary_sensor/#binary-sensor-filters

bdraco commented 1 year ago

I think https://github.com/ratgdo/esphome-ratgdo/pull/112 should do it, but I don't have these sensors actually hooked up so I'll have to do some debug log watching to validate it.

PaulWieland commented 1 year ago

I can test, but not until next week. All you have to do is connect a wire to GND and then quickly short it to one of the trigger pins - it should be ignored unless you hold it for the set duration.

bdraco commented 1 year ago

oh doh. I did it backwards (I did it on the outputs not the inputs)

Guess I should do this after coffee... fixing :)

bdraco commented 1 year ago
[08:56:05][D][binary_sensor:036]: 'Dry contact open': Sending state ON
[08:56:05][D][cover:076]: 'Door' - Setting
[08:56:05][D][cover:084]:   Position: 100%

yeah it works fine when I short the wire to open instead of door 🤦

bdraco commented 1 year ago
[08:59:26][D][binary_sensor:036]: 'Dry contact close': Sending state ON
[08:59:26][D][cover:076]: 'Door' - Setting
[08:59:26][D][cover:084]:   Position: 0%

close works as well

bdraco commented 1 year ago
[09:00:26][D][binary_sensor:036]: 'Dry contact light': Sending state ON
[09:00:26][D][light:036]: 'Light' Setting:
[09:00:26][D][light:047]:   State: ON
[09:00:26][D][ratgdo:467]: Collision detected, waiting to send packet

so gtg