Going around in circles again! I have a simple reed switch, monitoring a door, that's been working for several months. I noticed the door was showing as having been closed for 2 days when I know it's been open. Power cycled the ESP-wroom-32 but still showing closed when open. Pulled it apart and tested the reed OK with a multimeter. Reconnected but still stuck on.
I've tried another reed switch but still stuck on. The other weird thing is that ESP is showing as online even when it is not (ie depowered). The log says it can't connect but the ESP is still shown as online.
Suggestions gratefully accepted !
INFO ESPHome 2026.6.2
INFO Loaded validated config cache for esphome-web-q3.yaml, skipping validation.
INFO Starting log output from 192.168.1.56 using esphome API
INFO Successfully resolved esphome-web-q3 @ 192.168.1.56 in 0.000s
WARNING Can't connect to ESPHome API for esphome-web-q3 @ 192.168.1.56: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.1.56', port=6053))]: [Errno 113] Connect call failed ('192.168.1.56', 6053) (SocketAPIError)
INFO Trying to connect to esphome-web-q3 @ 192.168.1.56 in the background
Sure, that's a fix. I was hoping there was some known issue with 2026.6.2 (as unlikely as that would be) or some suggestion of other evaluation to localise the problem. Thanks anyway.
You have the input pull-up enabled and the sensor inverted.
So the switch should be shorting GPIO 16 to ground when active.
Most reed switches are normally open. Meaning when the magnet is near the reed switch it closes and shorts the GPIO to ground. As your GPIO is inverted this turns the binary sensor on and the device class translates this to open.
You want the opposite of this (magnet near reed = closed), so remove the inverted: true option from your binary sensor pin configuration.
Thanks Tom. Hmm, didn't notice the T - was working like this but fixed now.
Yes, the reed is NO. Changing to inverted: false changed the state to open but it still doesn’t change state when the magnet is beside the reed. Yet I'm certain the reed closes when the magnet approaches (as per multimeter continuity).
I'll try GPIO17 ?
Ok, action! It works on GPIO17, although unexpectedly the wrong way around. With no magnet, state is on & with magnet state is off.
I can deal with that by re-adding inverted: true
However, the reed is definitely open with no magnet, closed with magnet.
I have used magnetic reed switches, the "raw" ones and I have found them to be finicky. They are not particularly reliable in that they get "stuck". They cannot handle much current. The orientation of the magnet relative to the switch is important (As I remember, with round magnets, the axis of the magnet should be parallel to the switch? check me on this.)
On the ESP devices, an input can go bad. A pullup resister is always advisable. Test the input with a button switch (with pull up resistor) to see if it has truly gone bad. A failure of this test indicates damage from ESD (electrostatic discharge). This kind of damage can migrate and eventually kill the device.
The reed, I think, is good - works consistently when I test it with a multimeter. Testing with a switch/external pullup is a good idea - I'll do that. Reflashing is worth a try too.
ESD seems very unlikely. The board has been working for months, inside a project box attached to the wall. It only has the fully sealed reed attached & there are no power sources that could induce a current in the wires.
Thanks for the thoughts. One has to love the helpful community