I have an ESPhome flashed AZ-delivery ESP32 Dev kit c V4 monitoring temp & humidity in my garage and I’m trying to add a simple reed switch linked to an automation that alerts when the door has been left open for 10 minutes.
I have wired the reed switch to gpio16 & Gnd and it all seems to work when I’m simulating it being open but when I fit to garage the open state is interrupted by closed signals every few mins which prevent the trigger happening. At one stage it was happening too fast to see but that seems to have been a one off.
I’ve proved its not the switch at fault or the cable by eliminating both.
Can anyone help me out here please?
binary_sensor:
- platform: gpio
name: "Garage Door State"
device_class: door
pin:
number: 16
#inverted: true
mode: INPUT_PULLUP
How long is the wire to the switch? If its too long, can pick up noise and glitch as you described.
Try with a few feet of wire, and see if that works. I have a few reed switches in my garage to monitor both garage doors and a refrigerator, and they all work fine for what you are trying to do. I use the older esp8266 but shouldn’t matter.
I’ve tried with just a couple of du pont jumpers and get same issue. When I think about it the only different factors are the power lead, the usb socket and the temperature.
The strange thing is that it only happens from open to closed, I get no issues when switch(door) is closed changing to open.
I’m new to this and wondered if the pin was an issue but it states its ok for digital in/out.
Closed is grounded, which is less likely to have any problems.
Which GPIO are you using?
And you should be doing all tests with it installed in your garage. Based on your different factors list, I don’t think you are. Try to only make one change at a time. Takes longer, but if you make multiple changes then you don’t really know which change made the difference.