[SOLVED] [ESPHome] Disconnected ssid='wifinetworkname' reason='4-Way Handshake Timeout'

Hi,
I created my own ESP32 based device, I installed ESPHome on it using a RPI (home assistant hosting) but it seems it cannot connect to my wifi due to ‘4-Way Handshake Timeout’

Do you know what does that means?

Thanks!

[17:29:41][I][logger:170]: Log initialized
[17:29:41][C][ota:378]: There have been 0 suspected unsuccessful boot attempts.
[17:29:41][I][app:029]: Running through setup()...
[17:29:41][C][wifi:037]: Setting up WiFi...
[17:29:41][D][wifi:380]: Starting scan...
[17:29:43][D][wifi:395]: Found networks:
[17:29:43][I][wifi:441]: - 'wifinetworkname' (98:DA:C4:97:FB:56) [redacted]▂▄▆█
[17:29:43][D][wifi:442]: Channel: 10
[17:29:43][D][wifi:443]: RSSI: -47 dB
[17:29:43][D][wifi:445]: - 'TeroTero'[redacted] (04:18:D6:04:F2:58) [redacted]▂▄▆█
[17:29:43][D][wifi:445]: - ''[redacted] (06:18:D6:04:F2:58) [redacted]▂▄▆█ 
[17:29:43][I][wifi:250]: WiFi Connecting to 'wifinetworkname'...
[17:29:47][W][wifi_esp32:441]: Event: Disconnected ssid='wifinetworkname' bssid=98:DA:C4:97:FB:56[redacted] reason='4-Way Handshake Timeout' 
[17:30:13][W][wifi:541]: Timeout while connecting to WiFi. 
[17:30:13][I][wifi:250]: WiFi Connecting to 'wifinetworkname'...
[17:30:16][W][wifi_esp32:441]: Event: Disconnected ssid='wifinetworkname' bssid=98:DA:C4:97:FB:56[redacted] reason='4-Way Handshake Timeout' 
[17:30:41][I][wifi:137]: Starting fallback AP!
[17:30:41][C][wifi:202]: Setting up AP... 
[17:30:41][C][wifi:204]: AP SSID: 'Hamodule Fallback Hotspot' [17:30:41][C][wifi:205]: AP Password: 'bvFRy5WVZ131' 
[17:30:42][C][wifi:214]: IP Address: 192.168.4.1 
[17:30:43][W][wifi:541]: Timeout while connecting to WiFi. 
[17:30:48][D][wifi:380]: Starting scan... 
[17:30:53][D][wifi:395]: Found networks: 
[17:30:53][I][wifi:441]: - 'wifinetworkname' (98:DA:C4:97:FB:56) [redacted]▂▄▆█ 
[17:30:53][D][wifi:442]: Channel: 10 [17:30:53][D][wifi:443]: RSSI: -33 dB
[17:30:53][D][wifi:445]: - 'TeroTero'[redacted] (04:18:D6:04:F2:58) [redacted]▂▄▆█ [17:30:53][D][wifi:445]: - ''[redacted] (06:18:D6:04:F2:58) [redacted]▂▄▆█ 
[17:30:53][D][wifi:445]: - 'spi-der'[redacted] (00:18:4D:DA:46:C6) [redacted]▂▄▆█ [17:30:53][I][wifi:250]: WiFi Connecting to 'wifinetworkname'... 
[17:30:56][W][wifi_esp32:441]: Event: Disconnected ssid='wifinetworkname' bssid=98:DA:C4:97:FB:56[redacted] reason='4-Way Handshake Timeout' [17:31:23][W][wifi:541]: Timeout while connecting to WiFi.
[17:31:23][I][wifi:250]: WiFi Connecting to 'wifinetworkname'...
[17:31:26][W][wifi_esp32:441]: Event: Disconnected ssid='wifinetworkname' bssid=98:DA:C4:97:FB:56[redacted] reason='4-Way Handshake Timeout'

I restarted the router and it started working again… no clue what was the problem

Replying that this also solved my issue.
ESPHome devices were constantly disconnecting/reconnecting with ‘Beacon Timeout’ as the reason, but no other devices were having issues.
Rebooted the APs and the router and the issue went away. No idea what was causing it or what ESPHome was having issues with.

In my case it was simply that I had a typo in the wifi password in the esphome yaml file config.

So for me “4-way handshake timeout …” actually meant “bad password”.

2 Likes

I also encountered this 4-way Handshake Timeout. Lots of posts on the internet about it being caused by incorrect passwords, which confused me, because I copy pasted the password.

But of course there are more ways for a password to end up incorrect. For example: if there’s a \ in your password, you need to write \\ there. I assume \ is an escape character that needs to be escaped itself to be used correctly.

[edit] Fun fact: this forum also does weird things to backslashes.

I had the same issue with 2 ESP32 boards.
Changing the framework to esp-idf solved it for me:

esphome:
  name: esp-basement2
esp32:
  board: esp32dev
  framework:
    type: esp-idf