How to avoid electromagnetic interference on ESP32 input
I have to check better, but it seems that other have this issue with reed switches that in some configuration act like antennas and receive interferences (see here and here).