ESPHome device is unable to connect to Wi-Fi automatically

Since the last update, my ESPHome devices have been unable to connect to my Wi-Fi network without manually entering the CaptivePortal. Even after rebooting, I have to repeatedly enter the Wi-Fi network generated by the device and try to reconnect…

esphome:
  name: esphome-web-f95646
  friendly_name: Tira Led Funkos

esp8266:
  board: esp07

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_encryption_key

ota:
  platform: esphome
  password: !secret ota_password

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Funkos-led-strip"
    password: !secret wifi_ap_password

captive_portal:

#============================================================================

output:
  - platform: esp8266_pwm
    pin: GPIO4
    id: output_R
    min_power: 0
  - platform: esp8266_pwm
    pin: GPIO12
    id: output_G
    min_power: 0
  - platform: esp8266_pwm
    pin: GPIO14
    id: output_B
    min_power: 0
  - platform: esp8266_pwm
    pin: GPIO13
    id: output_T
    min_power: 0
  - platform: esp8266_pwm
    pin: GPIO5
    id: output_W
    min_power: 0

light:
  - platform: rgbww
    name: light
    id: strip_led
    red: output_R
    green: output_G
    blue: output_B
    warm_white: output_T
    cold_white: output_W
    cold_white_color_temperature: 6535 K
    warm_white_color_temperature: 2000 K
    color_interlock: True
    default_transition_length: .4s
      
binary_sensor:
  - platform: gpio
    id: power_button
    internal: true
    pin:
      number: GPIO0
      inverted: true
      mode:
        input: true
        pullup: True
    on_release: 
      then:
        light.toggle: strip_led
        

Try setting static ip in yaml file.

One of the devices that also disconnects has a static IP set.
This is the yml config file, also in previous versions it was working perfectly.
I have also tried putting the keys directly in the device’s yml and it still doesn’t work.

wifi_ssid: "Villa_Polvoretes"
wifi_password: "password"
wifi_ap_password: "12345678"
api_encryption_key: "key"
ota_password: "otapassword"

Logs

These are the logs that the terminal throws

e[0;32m[I][wifi:313]: WiFi Connecting to 'Villa_Polvoretes'...e[0m
e[0;33m[W][wifi_esp8266:505]: Event: Disconnected ssid='Villa_Polvoretes' bssid=e[5m02:EB:D8:25:5B:66e[6m reason='Auth Expired'e[0m
e[0;33m[W][wifi:653]: Error while connecting to network.e[0m
e[0;36m[D][wifi:697]: Retrying with hidden networks...e[0m
e[0;32m[I][wifi:313]: WiFi Connecting to 'Villa_Polvoretes'...e[0m
e[0;33m[W][wifi_esp8266:505]: Event: Disconnected ssid='Villa_Polvoretes' bssid=e[5m02:EB:D8:25:5B:66e[6m reason='Auth Expired'e[0m
e[0;33m[W][wifi:653]: Error while connecting to network.e[0m
e[0;36m[D][wifi:697]: Retrying with hidden networks...e[0m
e[0;32m[I][wifi:313]: WiFi Connecting to 'Villa_Polvoretes'...e[0m
e[0;33m[W][wifi_esp8266:505]: Event: Disconnected ssid='Villa_Polvoretes' bssid=e[5m02:EB:D8:25:5B:66e[6m reason='Auth Expired'e[0m
e[0;33m[W][wifi:653]: Error while connecting to network.e[0m
e[0;36m[D][wifi:697]: Retrying with hidden networks...e[0m
e[0;32m[I][wifi:313]: WiFi Connecting to 'Villa_Polvoretes'...e[0m
e[0;33m[W][wifi_esp8266:505]: Event: Disconnected ssid='Villa_Polvoretes' bssid=e[5m02:EB:D8:25:5B:66e[6m reason='Auth Expired'e[0m
e[0;33m[W][wifi:653]: Error while connecting to network.e[0m
e[0;36m[D][wifi:697]: Retrying with hidden networks...e[0m
e[0;32m[I][wifi:313]: WiFi Connecting to 'Villa_Polvoretes'...e[0m
e[0;33m[W][wifi_esp8266:505]: Event: Disconnected ssid='Villa_Polvoretes' bssid=e[5m02:EB:D8:25:5B:66e[6m reason='Auth Expired'e[0m
e[0;33m[W][wifi:653]: Error while connecting to network.e[0m
e[0;36m[D][wifi:697]: Retrying with hidden networks...e[0m
e[0;32m[I][wifi:313]: WiFi Connecting to 'Villa_Polvoretes'...e[0m
e[0;33m[W][wifi_esp8266:505]: Event: Disconnected ssid='Villa_Polvoretes' bssid=e[5m02:EB:D8:25:5B:66e[6m reason='Auth Expired'e[0m
e[0;33m[W][wifi:653]: Error while connecting to network.e[0m
e[0;36m[D][wifi:697]: Retrying with hidden networks...e[0m

Without the colour codes would have been better.

If you google

esphome “Auth Expired”

you’ll fine plenty of results, like this one ESPHome - Wifi - Auth Expired