I have two Sonoff 4CHPRO R3 relays running ESPHome. They are operating garage doors in two separate buildings and have been working fine for about six months. A couple of days ago, I upgraded the wireless access point in one of the buildings. The Sonoff relay in that building will no longer connect.
I’m pretty sure the issue is not with the relay.
I am able to connect to it using a USB CH340 device.
If I switch back to the old access point, the relay connects to wifi immediately.
The network settings are managed by my network controller so there is no chance that the ssid or password is wrong. The new wireless access point is the same model that the other relay connects to quite successfully. I’ve tried a number of combinations of wifi frequency and channel width with no success.
If I ping the relay, the pings timeout. The log for the relay looks like this:
`I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[W][wifi:689]: Restarting WiFi adapter...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[W][wifi:689]: Restarting WiFi adapter...
[D][wifi:481]: Starting scan...
[D][wifi:496]: Found networks:
[I][wifi:539]: - 'IoT' (EE:FA:C4:0F:B0:1E) [redacted]▂▄▆█
[D][wifi:541]: Channel: 6
[D][wifi:542]: RSSI: -80 dB
[I][wifi:539]: - 'IoT' (A2:25:4A:57:25:44) [redacted]▂▄▆█
[D][wifi:541]: Channel: 11
[D][wifi:542]: RSSI: -87 dB
[I][wifi:539]: - 'IoT' (7E:FE:CE:CE:20:94) [redacted]▂▄▆█
[D][wifi:541]: Channel: 1
[D][wifi:542]: RSSI: -61 dB
[D][wifi:544]: - 'NicoNet'[redacted] (7A:FE:CE:CE:20:94) [redacted]▂▄▆█
[D][wifi:544]: - 'NicoNet_EXT'[redacted] (40:EE:15:E4:62:2C) [redacted]▂▄▆█
[D][wifi:544]: - 'LilyNet'[redacted] (74:FE:CE:CE:20:94) [redacted]▂▄▆█
[D][wifi:544]: - ''[redacted] (EA:FA:C4:0F:B0:1E) [redacted]▂▄▆█
[D][wifi:544]: - 'NicoNet'[redacted] (E4:FA:C4:0F:B0:1E) [redacted]▂▄▆█
[D][wifi:544]: - 'Cameras'[redacted] (F2:FA:C4:0F:B0:1E) [redacted]▂▄▆█
[D][wifi:544]: - 'NicoNet'[redacted] (40:ED:00:BA:8B:3A) [redacted]▂▄▆█
[D][wifi:544]: - ''[redacted] (9E:25:4A:57:25:44) [redacted]▂▄▆█
[D][wifi:544]: - 'NicoNet'[redacted] (98:25:4A:57:25:44) [redacted]▂▄▆█
[D][wifi:544]: - 'Cameras'[redacted] (A6:25:4A:57:25:44) [redacted]▂▄▆█
[D][wifi:544]: - ''[redacted] (56:96:04:68:16:54) [redacted]▂▄▆█
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=EE:FA:C4:0F:B0:1E[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=EE:FA:C4:0F:B0:1E[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=7E:FE:CE:CE:20:94[redacted] reason='Authentication Failed'
[W][wifi:652]: Error while connecting to network.
[D][wifi:696]: Retrying with hidden networks...
[I][wifi:312]: WiFi Connecting to 'IoT'...
[W][wifi_esp8266:504]: Event: Disconnected ssid='IoT' bssid=EE:FA:C4:0F:B0:1E[redacted] reason='Authentication Failed'`
The different BSSIDs for the same network ID result from multiple WAPs. During my hours of troubleshooting, at one point I was getting a message in the logs along the lines of “component mdns took a long time for an operation”.
Here is the wifi section of the ESPHome code for the device:
Both relays are meant to use the ‘IoT’ network, which is broadcasting only 2.4 GHz. The router is set to reserve 192.168.30.71 for the relay that is not connecting.
Other devices in that building connect to the new WAP without issue.
I know the relay is not connecting to the network because the device does not appear in the clients list of my network controller, the blue light on the relay is not illuminated, and my HA automations that interact with this relay do not work.
An authentication issue is shown in your logs. Are yo usure that the password to connect is correct on this new AP. Depending on how old the other AP is maybe it is configured for a different security method?
Yes, thanks for asking that. I forgot to mention it in my original post. All other devices in that building connect to the new WAP (many on the IoT network) without issue.
Configuration of the wireless networks (SSIDs, passwords, security mode, etc) are stored in the network controller. All I do is pick which networks I want the WAP to broadcast. The password is not the issue.
I upgraded from a TP-Link EAP245 to an EAP610.
Thanks for the suggestion on cycling the power. I tried that numerous times during my troubleshooting effort yesterday.
As for specifying which AP a client should use, that can only be done in the client config screen, to my knowledge. The device must first connect to the network to become a client, which is my main issue here.
Duh. I missed the obvious. You have the same EAPs that I do and I have noticed that clients are sometimes slow to find the closest EAP.
Forgive me for asking something you have already stated.
Try changing you logger level to verbose. It may reveal something you missed.
Is there NO CHANCE that the IP is already in use? Unplug the Sonoff and try to ping it.
I changed the logging level to verbose and removed the static IP portion of the ESPHome code. I also stopped the router from assigning a static address to the device. Here is the new code in full:
AI says it’s an authentication failure.
It’s a long shot, but delete:
fast_connect: true
It is my weak recollection that fast_connect: true uses WiFi credentials stored on the device.
On a slight tangent- I have a few ESP devices that just will not connect to WiFi when flashed with EspHome Version 2024.x, but the error I get in the log after all WiFi APs are scanned is “No networks found”. But, static IP fixes that. I do not usually use static IP because I have over 120 clients on my network and managing that many IP addresses would be difficult. (Only my servers have a static IP. Most of my IOT clients have a reserved IP in the router.)
Another fix to my new issue is to use an older version of ESPHome (2023.9) to compile the binary. If you wish, I could compile your configuration on 2023.9 and email the .bin file to you.
Solved it! I had previously bound the Sonoff relay to the WAP that I had taken out of service. That meant it was the only access point to which it would connect. I discovered this because I got searching through the controller settings to ensure I hadn’t blocked the device.
Lesson learned. Be cautious about assigning devices to a certain access point, or at least know you’ve done this when replacing network hardware.
Thanks to all for your ideas. You helped me to eliminate possibilities.