Can't connect ESP8266 to Wifi

Hi
I got a WEMOS D1 Mini Pro with external antenna, and I can’t make it connect to my wifi with esphome.

I have two routers with different SSIDs, both of them are set up to have different SSIDs for 2.4 and 5GHz networks.

First one is Linksys Velop, and D1 doesn’t see it at all, not showing up in the network scan. Security is set to “WPA2 Personal”, Wi-Fi mode is “Mixed” whatever it means, there are no other options. Channel 3.

Second one is Cox Technicolor CGM4141.
Channel 11, bandwidth 20, 802.11 g/n, WPA2-PSK.
D1 sees 2.4GHz network, but fails to connect.

Initially it was failing with “Handshake Failed”. Then I moved the resistor and attached the external antenna, now if fails with “Auth Expired”.

Password and SSID in the secrets are correct.
Any ideas?

yaml:

esphome:
  name: water-heater

esp8266:
  board: d1_mini_pro

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

ota:
  password: "f097f89808334646eb6f63539809f847"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Water-Heater Fallback Hotspot"
    password: "xxx"

captive_portal:
    
esptool.py v3.3.1
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 68:c6:3a:f7:d0:bf
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00000000 to 0x00074fff...
Flash params set to 0x0340
Compressed 478608 bytes to 337645...
Wrote 478608 bytes (337645 compressed) at 0x00000000 in 8.1 seconds (effective 473.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200
[22:36:50]p\xf2n\xe0\x82l\x8c\x9cbn\xe2|\xec\x8e\x8eb\x8c\xf2nn\xeel\x8c\x8el`\x90nn\x8elnr\x8e\x92\x92nrr\x92`p\xf2n\xe0r\x8c\x9c\x9c\x9c\x80\x8cbn\xe2|\x8eb\x8c\xf2nn\xee\x8el`\x90nn\x8elnr\x8e\x92\x92nrl`r\x92\x92nrl`\x9c쎎\x9c|\x80l`\xfc\x82n\x9cl[I][logger:243]: Log initialized
[22:36:50][C][ota:465]: There have been 10 suspected unsuccessful boot attempts.
[22:36:50][E][ota:472]: Boot loop detected. Proceeding to safe mode.
[22:36:50][I][app:029]: Running through setup()...
[22:36:50][C][wifi:037]: Setting up WiFi...
[22:36:50][D][wifi:384]: Starting scan...
[22:36:56][D][wifi:399]: Found networks:
[22:36:56][I][wifi:442]: - 's-cox-2' [redacted]▂▄▆█
[22:36:56][D][wifi:444]:     Channel: 11
[22:36:56][D][wifi:445]:     RSSI: -76 dB
[22:36:56][D][wifi:447]: - [redacted] [redacted]▂▄▆█
[22:36:56][D][wifi:447]: - [redacted] [redacted]▂▄▆█
[22:36:56][D][wifi:447]: - [redacted] [redacted]▂▄▆█
[22:36:56][D][wifi:447]: - [redacted] [redacted]▂▄▆█
[22:36:56][D][wifi:447]: - [redacted] [redacted]▂▄▆█
[22:36:56][D][wifi:447]: - [redacted] [redacted]▂▄▆█
[22:36:56][I][wifi:255]: WiFi Connecting to 's-cox-2'...
[22:36:58][W][wifi_esp8266:482]: Event: Disconnected ssid='s-cox-2' bssid=[redacted] reason='Auth Expired'
[22:36:58][W][wifi:547]: Error while connecting to network.
[22:36:58][W][wifi:583]: Restarting WiFi adapter...
[22:36:58][I][wifi:255]: WiFi Connecting to 's-cox-2'...
[22:37:01][W][wifi_esp8266:482]: Event: Disconnected ssid='s-cox-2' bssid=[redacted] reason='Auth Expired'
[22:37:01][W][wifi:547]: Error while connecting to network.
[22:37:01][W][wifi:583]: Restarting WiFi adapter...

Hi @eprst

I seen this before but normally not in you wifi set up… as you said all passwords are good and that is the basic easy stuff… normally it is in the code that your doing (every thing below captive_portal:)… so a suggestion is to remove all the code below captive_portal: and just try the code you have posted above… if it stays connected then it is in your code… if that is the case and you can’t work out your code then you can post your code and someone may be able to help you…

That generally means bad security :unlock: as it allows TKIP beside CCMP (AES). Only the later should be used since TKIP (RC4) is broken since almost a decade already :put_litter_in_its_place:

Is the ap visible and can you connect to it (once the esphome node fails enough with connecting to your wifi) or does this fail too? :thinking:

board was bad, works fine with another one.