ESPHome - Wifi - Auth Expired

Wow thanks for this hint :smiley:
I have the same problem with my Wemos D1 mini v3.0.0 and I can confirm that the I2C frequency hack works.
It doesnt matter if you use I2C or not but adding these lines made wifi work again:

i2c:
  sda: GPIO3
  scl: GPIO1
  frequency: 800kHz

This problem also accoured only for the v3.0.0. I generally use the v2 wemos boards and none of them had this issue.

2 Likes

Thanks for this! It’s solved my wifi connection issue but now does mean once connected the display refresh is a bit slow. This is normally fine but my screen is reacting to a rotary encoder (with possible gif) so I could do with it being speedy. Is there a way to say “once connected drop this back to 1s” at all?

Edit… For anyone looking for the answer to my post. This is what works for me and allows me to have a display refresh rate of 0.1s. For some reason I still needed the frequency bit, even with the wait on boot.

esphome:
  name: "blah"
  on_boot:
    priority: 200  
    then:
      - wait_until:  
          condition:
            wifi.connected: 
          timeout: 5s

# Display
i2c:
  sda: D7
  scl: D6
  frequency: 200kHz
2 Likes

I had this, and fixed it, by connecting the ESP to a 2.4 GHz network and selecting “Legacy” wireless mode on my router (which is an Asus ZenWiFi AX). My hypothesis is that the WiFi driver is incompatible with one of the 802.11 a/b/g/n/ac protocols.

1 Like

WOW !!!

It´s works for me too.

I´m having trouble with I2C SH1106. With display plugged, wifi can´t connect.

With your code, works !!!

Thaks

1 Like

Hi, do not understand the solution flagged?

does this solve the wifi auth expired?

I assume not.

having also same error but no no i2c device, not even any

I recently encountered this sort of issue when making some network changes. All of a sudden 3 esphome devices and 3 tasmota plugs started having connectivity issues. Each esphome device would spew out various “auth expired”, “4-way handshake timeout”, “authentication failed”, “probe request unsuccessful” and other wifi errors.

After trying a bunch of recommended fixes and getting nothing working, I realized that my router had automatically changed to channel 11, near the end of the range. Seeing as some people mentioned noise/interference causing these issues, I tried changing this to channel 5, closer to the middle of the road, and suddenly all of the devices stopped having issues. So, I’m pretty sure that’s part of the problem.

Did anyone get a solution for this? Got another pack of ESP32-S2 (S2 Mini) and could not get them to connect to Wifi because of “Auth expired” errors…

I had this issue and determined mine to be caused by band steering on my wifi/router. That is when the 2.4 Ghz wifi delays its response to your esp32 so that the 5ghz can respond first and try to get you to associate there instead. Unfortunately I could not turn this off on my wifi router but was able to work around it by specifying the BSSID to connect to in the esphome wifi config. And used the BSSID specific to the 2.4 Ghz radio along with fast connect setting.

Ended up ditching that router/wifi though after a while and getting something else.

1 Like

Could you share this code?

I’ve read this thread and I am having the same problem but I have an ESP32 dev board so the solution isn’t applicable to me.

any suggestions?

substitutions:
  device_name: multisensor-tvroom-01
  friendly_name: multisensor-tvroom-01

esphome:
  name: ${device_name}

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

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

ota:
  password: "password"


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

# Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    password: "password"

captive_portal:

# Motion Sensor Configuration #    
sensor:
  - platform: adc
    name: motion_one ${friendly_name}
    pin: 36
    update_interval: 250ms

  - platform: adc
    name: motion_two ${friendly_name}
    pin: 35
    update_interval: 250ms


# LED Configuration
output:
  - platform: ledc
    id: output_component1
    pin: 25
  - platform: ledc
    id: output_component2
    pin: 33
  - platform: ledc
    id: output_component3
    pin: 32
  - platform: ledc
    id: output_component4
    pin: 18
  - platform: ledc
    id: output_component5
    pin: 19
  - platform: ledc
    id: output_component6
    pin: 21

# RGB Configuration
light:
  - platform: rgb
    name: led_one ${friendly_name}
    blue: output_component1
    green: output_component2
    red: output_component3
    id: led_one
    effects:
      - strobe:
      - strobe:
          name: strobe1
          colors:
            - state: true
              brightness: 80%
              red: 0%
              green: 0%
              blue: 100%
              duration: 750ms
            - state: false
              duration: 250ms
            - state: true
              brightness: 50%
              red: 100%
              green: 100%
              blue: 100%
              duration: 750ms
  - platform: rgb
    name: led_two ${friendly_name}
    blue: output_component4
    green: output_component5
    red: output_component6
    id: led_two
    effects:
      - strobe:
      - strobe:
          name: strobe2
          colors:
            - state: true
              brightness: 80%
              red: 0%
              green: 0%
              blue: 100%
              duration: 750ms
            - state: false
              duration: 250ms
            - state: true
              brightness: 50%
              red: 100%
              green: 100%
              blue: 100%
              duration: 750ms

# Turn off board status LED #
  - platform: status_led
    name: Switch state ${friendly_name}
    pin: GPIO2
    
bluetooth_proxy:
  active: true

I cured it on one of my devices by giving it a fixed IP address. Not had a problem with it since although it does not show on my DHCP list.

I have had the same problem with a Wemos D1 ESP32 board very useful to reuse the shields of the Wemos D1 Mini.

But when connecting I always got the same error

Auth Expired or Authentication Failed

After several tests I have realized that so that it does not disconnect, the logger line must be commented out

logger:

This has worked for me so far. In case it helps someone.

Not relevant to Mini discussed above, but may help someone with Auth Expired problem on a bigger board that is suposed to be powered via DC barrel jack.

I had the same errors on WeMos D1 R32 (ArduinoUno-ish board with ESP33 and barrel connector for 5-12V power source)

Found this thread and tried to play with fixed IP, channel, etc. But nothing helped.

No matter what I was doing to the yaml - I was getting Auth Expired errors when it reboots after flashing.

Turned out that when this board is powered via Micro-USB port - it gets enough power to flash ESP32, but not enough power for it to work in the normal mode. Basically it was browning out after flashing and rebooting, while still connected to my laptop’s USB.

As soon as I disconnected it from usb and plugged it with 12v power adapter - it happily connected to WiFi. It has been working stable for multiple weeks since then.

1 Like

Hello! I just dealt with a similar problem with ESP32 and Dallas sensors. Thanks my friend for the advice.
When used with an ESP32, Dallas sensors must be powered strictly at 3.3V, not 5V. If you use 5V, the chip is overloaded and gives 'Auth Expired' error.

2 Likes

power was the cause of my “auth expired” issues with my ESP-WROOM-32 boards. I am working on using one for a hall sensor project and it was very sporadic. Tried multiple boards and wifi networks with same result of “Auth Expired”, tried with board powered via computer usb so could read logs and also direct powered.

I then tried with the power supply cable to the hall sensor disconnected and it connects to wifi right away. Then I can connect the hall sensor and everything works. But it seems it will not boot and connect to wifi and power the hall sensor at the same time. Hall sensor wants 5V and it connected to the VIN pin on board.

So i guess I need to power the hall sensor not through the board?

It’s so stupid idea, but it works and… I don’t understand why.

I had similar problem.
My esphome script worked fine, then I updated esphome, installed new script and it stopped connecting to WiFi. I tried everything what I found, disabled all modules, changing passwords in router etc…, just only WiFi left - no progress. Then switched channel to 2 - no changes, then channel 5 - it started working.

It’s stupid, but simple to do, so please check and forget till next problems.

You switched your wifi channel to 5 and it worked without changes to esp config?

I tried going through all the channels and it didn’t resolve the issue for me. Still get auth expired attempting to connect.

I tried setting up 3 different esp32s and they can’t connect with esp-home. But the same dev boards with demo sketches from platformio and arduino connect just fine. I currently just can’t use esphome and I don’t understand what’s going on.

[I][wifi:277]: WiFi Connecting to 'MyWiFi2.4'...
[W][wifi_esp32:465]: Event: Disconnected ssid='MyWiFi2.4' bssid=[redacted] reason='Auth Expired'
[W][wifi:591]: Error while connecting to network.
[I][wifi:277]: WiFi Connecting to 'MyWiFi2.4'...
[W][wifi_esp32:465]: Event: Disconnected ssid='MyWiFi2.4' bssid=[redacted] reason='Auth Expired'
[W][wifi:591]: Error while connecting to network.

Same issue here.

Right away when i flash the esp32 it works but after I disconnect it and connect it to the same PC it gives me the auth expired error.

[W][wifi_esp32:640]: Event: Disconnected ssid='TCH 2.4GHZ' bssid=[redacted] reason='Auth Expired'
[W][wifi:591]: Error while connecting to network.
[W][wifi:627]: Restarting WiFi adapter...
[D][esp-idf:000]: I (344622) wifi:
[D][esp-idf:000]: mode : softAP (48:e7:29:97:11:81)
[D][esp-idf:000]: 

[I][wifi:277]: WiFi Connecting to 'TCH 2.4GHZ'...
[D][esp-idf:000]: I (344733) wifi:
[D][esp-idf:000]: mode : sta (48:e7:29:97:11:80) + softAP (48:e7:29:97:11:81)
[D][esp-idf:000]: 

[D][esp-idf:000]: I (344734) wifi:
[D][esp-idf:000]: enable tsf
[D][esp-idf:000]: 

[D][esp-idf:000]: I (344750) wifi:
[D][esp-idf:000]: Set ps type: 1

[D][esp-idf:000]: 

[D][esp-idf:000]: I (344826) wifi:
[D][esp-idf:000]: new:<1,1>, old:<1,0>, ap:<1,1>, sta:<1,0>, prof:1
[D][esp-idf:000]: 

[D][esp-idf:000]: I (344829) wifi:
[D][esp-idf:000]: state: init -> auth (b0)
[D][esp-idf:000]: 

I am having the same issue, It is purely wifi code, I have nothing attached to the Esp32-S2-mini
Here is the code, and it is getting run.

esphome:
  name: s2-mini
  friendly_name: s2-mini
  
esp32:
  board: lolin_s2_mini
  variant: ESP32S2
  framework:
    type: arduino
    version: 2.0.6
    platform_version: 5.4.0

status_led:
  pin: 15

# Enable logging
logger:
  level: debug
wifi:
  ssid: Sweet_Spot_IoT
  password: *redacted*
  power_save_mode: none
  enable_on_boot: True
  fast_connect: On
  output_power: 8.5

this is the output on the serial after the restart

[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...
[W][wifi_esp32:458]: Event: Disconnected ssid='Sweet_Spot_IoT' bssid=88:B1:E1:2D:12:F2 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...
[W][wifi_esp32:458]: Event: Disconnected ssid='Sweet_Spot_IoT' bssid=88:B1:E1:2D:12:F2 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...
[W][wifi_esp32:458]: Event: Disconnected ssid='Sweet_Spot_IoT' bssid=88:B1:E1:2D:12:F2 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...

I also have the ability to scan the ring buffer on my APs for the client itself and any probes its making, and the MAC that is showing when I erase the chip using esptool is either not the mac it uses in the airspace, or my APs aren’t hearing a packet come out of it. This is looking like a driver issue or something at a much lower level than configuration.