Hi, I’ve read all the post on this forum relating to this error but none of the suggested solutions work for me. Basically my Wemos D1, using ESP Home on one particular unit is not connecting to WiFi. I have changed the Wemos and the result is the same so I assume it’s something in my configuration but I can’t figure out what. Could someone suggest how to get around this?
Thanks, I’ll try that and let you know. One quick question on the Static IP I thought (maybe incorrectly) that I need that to allow ESPHome to connect to this device over Wifi, otherwise it may not be able to find it. I can only connect to it over wifi as it’s nowhere near any computer.
You don’t need to use a static IP to connect over wifi, your router will issue your device with one. I use static IP’s but I don’t use ESP home to control this. I use my router to assign a static IP to the devices. I find it easer this way but you need to keep a list of all the static ip addresses you have used as if you have 2 with the same IP address you will get issues your having. If you use your router to assign static ip addresses it will not allow you to have duplicates. If you use ESPHome its up to you to keep a good file system of your Static IP’s as you can have duplicates. This is why I suggested you to remove this as it is the first step in resolving your issue.
Hm…
i did that in the past. The “breaking point” was when i’ve had to reset my router when one thing went wrong… as a result i would have to enter aaaalllll data again in my router… no thanks…too much work…so, from then on i rather use static IP in devices. I have excel list with all my devices, so i keep a record of what’s used and what’s free.
I use statip IP’s on all my esphome devices (and also cameras etc…) without any problems, so i don’t think that these lines are the culprit. I did have similar error in the past, but you can kill me if i remember what was the cause… i think that first thing you can do is to clean-compile yaml and upload again.
@Protoncek all depends on your skill level but we are just trying to eliminate what could be the problem first. As I said if you use ESPHome to set static IP’s its good to keep a update assignment of your Static IP’s (what you are doing). I would also suggest that if you do this, set aside a range of Static IP’s in your router for you to assign to devices.
@Blacky - I tried removing the Static IP (and also removed the _ from my device name) and it made no difference. If I let the unit run for a long time (sometimes hours) it sometimes connects to the WiFi network but that’s not a guarantee that it keeps working.
It is very strange, I have many different ESP home devices and this is the only one with this issue and again, I have replaced the Wemos device but it still happens. I’m sure it’s something specific to this hardware / display / yaml (which I have recompiled) but I can’t figure out what it is.
using HA 0.112.4, I can have a lot of things on my ESP8266 (display SSD1306, button for change screen on display, Pir sensor, RSSI sensor and a lot of sensors imported from HA that I want to see on display) and everything is all right;
using HA 2022.7.7, I can have or only display or all other sensor; if I configure display with just a sensor, this causes error “[wifi_esp8266:482]: Event: Disconnected ssid xxx bssid xxx reason=‘Auth Expired’”.
I did some more testing today and the issue for me appears to be the lambda code. If I remove that, the wifi connection works every time. If I add it back in - it fails, most of the time. It doesn’t matter what I try to display. E.g. only using the line “Initialising…” stops it from working.
I know you probably done all this but just lets try and check the ESP because of your last post.
Are you running the latest ESPHome? If not maybe a good idea to update.
Try work through each step… if you are good go to the next one.
1/ Are you close to your Access point? If not get really close… just trying to eliminate your ESP wi-fi.
2/ Have you done a clean build? If not maybe try this. On the 3 dots select “Clean Build Files”.
3/ Can you back up your code and just put in the basic information with a clean build. I added some stuff and changed some things
esphome:
name: kitchen_display
platform: ESP8266
board: d1_mini_pro
wifi: # Note this change try keep it symple
ssid: !secret wifi_ssid
password: !secret wifi_password
# manual_ip:
# static_ip: 192.168.1.20
# gateway: 192.168.1.254
# subnet: 255.255.255.0
ap:
ssid: "kitchen_display"
password: password
logger:
api: #do you have a api password?
# password: !secret esphome_secret
ota:
If this is stable then add your “i2C”…install test…then add your “sensor”…install test…then add your “binary_sensor”…install test… then add your “display”…install test…then your “time”… test. Lets try see if there is the fault where.
4/ If option 3 fails, do you have another ESP that you can try the same code on it? If so try this.
Hi @Blacky - Thanks for your reply. With regards to your suggestions:
I moved it to multiple locations, using different access points (I have 4) - no difference
I have - I have even changed all the hardware
Removing the lamda section makes it connect straight away and I spend all last night removing/adding settings to my code, so not sure that’s a solution?
See (2) - I already changes the hardware and that made no difference
What does happen is that this “Auth Expired” happens but if I just leave it on, sometimes for hours, it sometimes, finally connects but when we reboot the device for any reason: we start again
Hi @Blacky - I tried making the suggested network changes previously and using DHCP instead of static IP but it made no difference. I was playing around with this for hours last night and concluded that the configuration below (removing lambda) made all the difference. I then changed everything back, left it overnight and it was connected again in the morning. When you asked the question just now, took this lambda code out again, did a clean compile and the device, unfortunately, is back in its Auth Expired loop without the lambda code being present so I’m afraid: I’m clutching at straws. I’m sorry and really not sure what is going on (just to be clear - the code below worked last night but doesn’t work today anymore so I will leave it a couple of hours to see if it reconnects)
esphome:
name: kitchen_display
platform: ESP8266
board: d1_mini_pro
wifi:
manual_ip:
static_ip: 192.168.1.20
gateway: 192.168.1.254
subnet: 255.255.255.0
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
i2c:
sda: D2
scl: D1
scan: true
sensor:
- platform: homeassistant
id: outside_humidity
entity_id: sensor.outside_humidity
internal: true
- platform: homeassistant
id: outside_temp
entity_id: sensor.outside_temperature
internal: true
- platform: homeassistant
id: outside_illuminance
entity_id: sensor.outside_illuminance
internal: true
- platform: homeassistant
id: outside_max_temp
entity_id: sensor.weather_today_max_temp
internal: true
- platform: homeassistant
id: outside_min_temp
entity_id: sensor.weather_today_min_temp
internal: true
- platform: homeassistant
id: kitchen_pressure
entity_id: sensor.kitchen_pressure
internal: true
- platform: homeassistant
id: kitchen_temp
entity_id: sensor.kitchen_temperature
internal: true
- platform: bme280
temperature:
name: "Kitchen Temperature"
oversampling: 16x
filters:
- calibrate_linear:
# # Map 0.0 (from sensor) to 0.0 (true value)
- 27.5 -> 24.5
- 20.0 -> 18.6
- 18.8 -> 17.0
- 19.2 -> 17.6
pressure:
name: "Kitchen Pressure"
address: 0x76
update_interval: 20s
binary_sensor:
- platform: gpio
pin: 14
name: "PIR Sensor"
device_class: motion
on_press:
then:
- binary_sensor.template.publish:
id: backlight
state: ON
- binary_sensor.template.publish:
id: backlight
state: OFF
- platform: template
id: backlight
filters:
- delayed_off: 90s
on_press:
then:
- lambda: |-
id(my_display).backlight();
//id(my_display).no_backlight();
// it.print(0,19,".");
on_release:
then:
- lambda: |-
id(my_display).no_backlight();
// it.print(0,19," ");
display:
- platform: lcd_pcf8574
id: my_display
dimensions: 20x4
address: 0x27
# lambda: |-
#
# // How to use character based display: https://esphome.io/components/display/lcd_display.html
#
# // id(my_display).no_backlight();
# // Check above link to see how to manage backlight using motion sensor
#
# it.print(0,0,"Initializing...");
#
# // Print the current time
# auto timeVar = id(homeassistant_time).now();
# if (timeVar.is_valid()) {
# it.strftime(0,1,"%H:%M:%S ",timeVar);
# it.printf(13,1,"%4.0f lx", id(outside_illuminance).state);
# it.strftime(0,0,"%a %d %b %Y", timeVar);
# // Result for 10:06 on august 21st 2018 -> "It is 10:06 on 21.08.2018"
# }
# // Outside Measurements
# // Example of how to display homeassistant data in ESPHome: https://esphome.io/cookbook/display_time_temp_oled.html
# // sensor.outside_temperature
# if (id(outside_temp).has_state()) {
# if (id(outside_temp).state < 10) {
# it.printf(0,2,"Out: %02.1f", id(outside_temp).state);
# }
# else {
# it.printf(0,2,"Out: %02.1f", id(outside_temp).state);
# }
# }
# if ((id(outside_min_temp).has_state()) && (id(outside_max_temp).has_state())) {
# it.printf(9,2," (%0.0f to %0.0f) ", id(outside_min_temp).state,id(outside_max_temp).state);
# }
# if (id(kitchen_temp).has_state()) {
# it.printf(0,3,"In : %02.1f", id(kitchen_temp).state);
# }
# if (id(outside_humidity).has_state()) {
# it.printf(12,3,"Hum: %02.0f%%", id(outside_humidity).state);
# //it.print(19,3,"%");
# }
# (Optional) For displaying time:
time:
- platform: homeassistant
id: homeassistant_time