ESP random disconnects from HA, no identifiable cause

There seem to be about 1,000 threads here already dealing with the issue of ESP’s that seem to randomly disconnect/reconnect to HA, without it being easily fixed by any of a hundred tweaks, from WiFi power-save to replacing the Access Point.
I tried most of them.
Until (and this is the point of this redundant post, since it was so surprising, and in case it’s helpful) I removed the ESP from the case I’d made for it. To which was attached a magnet salvaged from a disk drive to be used for holding the case on the side of a metal cabinet.
I had failed to observe that there was only a few mm of plastic between the ESP and this intense magnet. And since it was a static field, I never gave it a second thought.
But upon removing the proximity to the magnet, the ESP, the AP, the HA server, all now communicate perfectly with no random disconnects.
If anything, this post should serve to point out that the cause isn’t always in the system that’s failing. As a long-time IT goon, I forget that as often today as I did 40 years ago. But it’s a lesson worth repeating, and sharing, in hopes it helps someone else someday.


How do you have it mounted now?

The case had a hole for hanging, so now it hangs about 4" below the magnet by some nylon string.
So far, not a single hiccup from it.

Ok I was just wondering if it could actually be the metal actually shielding or interfering with the ESP’s antenna.

I would not have expected a magnet to make any difference, but stranger things have happened.

As it was originally positioned, the ESP’s antenna end protruded at least an inch past the metal cabinet, affording it an uninterrupted ‘view’ of the span between it and the AP. But it was apparently still surrounded by enough of the static magnet’s field to make WiFi semi-reliable but not unreliable enough to cause total disconnect.

Yeah, that’s not how magnets work. The strongest neodymium magnets would have little effect on the electromagnetic radiation.

Could have some effect on the radio circuit components though (saturating inductors for example).

Makes sense.
I figured it had to be either damping the EM radiation or messing with the circuits that [attempt to] generate it.
Either way, it’s a lesson I hope not to soon forget, because the symptoms were so easily mistaken for a more complex cause that it sent me down a rabbit-hole of diagnosis/isolation attempts.

The fact that the quality of the cheap Chinese ESP clones has plummeted would not have helped in diagnosis either. There are so many people reporting issues that can be attributed to shitty hardware (anaemic LDOs and crappy capacitors mostly) that some members of the community have taken it upon themselves to design and set up supply of quality ESPs. Check my recent post history (like twice tonight) if you are interested.

Helpful to know a good source.
In this case, I was using a Huzzah from Adafruit I’d bought about 2 years ago (before discovering the cheaper clones), and had tried swapping it with an identical device from the same source. I figured they were probably sourcing quality ESP’s, especially that far back, so had all but ruled-out the thought that they might both be defective devices failing in the same way. Of course, they did respond to the intense mag field in exactly the same way :wink:

I actually just bought one of these to test, as they are supposed to be of high quality, and the feature set looks quite interesting (onboard rgb led, type-c connector, E rev chip, RT9080 LDO):

I have not played around more than flashing some BLE detection code, but will eventually get to building sensor nodes and tag readers