Open rafalyesware opened 2 years ago
Reviewing the ticket, it definitely happened on a totally barebones ESPHome config (aka w/out even the time sync, nor any sensors / components / frameworks), since I still had serial logging enabled at that point, which I disabled when I configured the device for https://github.com/geoffdavis/esphome-mitsubishiheatpump
I'm getting this error too with an energy meter (pulse counting) built using a Wemos D1 connected to a DD-WRT Netgear WNDR3700v4. Worked fine for a few days but after that I'm lucky if I get energy data for a couple of hours each day. Using esphome 2022.6.2. I may try to upgrade my router or connect to a different access point. My Sonoff S26 smart plug is also having connection issues since I upgraded esphome but was fine with a version from I guess about a year ago.
Running into this same issue. It just started today on a Wemos D1 hooked up to a Vista alarm system that ran fine for the last maybe four or five weeks. I didn't change anything in my setup (wifi, router, or esphome version/firmware). I think the Wemos D1 got bricked somehow. Going to try with another one.
Here's my esphome Wemos D1 log:
[09:26:02][I][wifi:248]: WiFi Connecting to '<ssid>'...
[09:26:02][W][wifi_esp8266:212]: wifi_apply_hostname_(esphome-vista-alarm): lwIP error -16 on interface st (index 0)
[09:26:02][W][wifi:536]: Error while connecting to network.
[09:26:02][I][wifi:248]: WiFi Connecting to '<ssid>...
[09:26:02][W][wifi_esp8266:212]: wifi_apply_hostname_(esphome-vista-alarm): lwIP error -16 on interface st (index 0)
Glancing at the lwIP code https://github.com/espressif/esp-lwip/blob/2.1.2-esp/src/include/lwip/err.h it appears that -16 is ERR_ARG=illegal argument. Hmm.
FWIW, I just gave my ESP32 devices static IP addresses and things look 10x better now. All my issues were due to something timing out / erroring / being unhappy during the DHCP transaction(s).
On Tue, Sep 13, 2022 at 12:25 PM Martin Ecker @.***> wrote:
Running into this same issue. It just started today on a Wemos D1 hooked up to a Vista alarm system that ran fine for the last maybe four or five weeks. I didn't change anything in my setup (wifi, router, or esphome version/firmware). I think the Wemos D1 got bricked somehow. Going to try with another one.
— Reply to this email directly, view it on GitHub https://github.com/esphome/issues/issues/3402#issuecomment-1245652429, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAM3FUIZGSORPMMNNETU73V6CTGHANCNFSM5ZYQOAUQ . You are receiving this because you authored the thread.Message ID: @.***>
-- RAFAL BONI | Engineering Team Lead e: @.***
Meet me here https://meet.yesware.com/me/rafalyesware
Ah, thanks for that tip. I assigned a static IP in my router to the Wemos D1 and indeed it was immediately able to reconnect.
Have same issues with my NodeMCU v3 of unknown origin with a ASUS AX58U router. Static ip via DHCP gave same error messages as original post. Then put the IP static in in Esphome config at connection got stable right away.
Had the same issue on a D1 uisng ESPHome version 2022.10.2. Fix was to disable "Wi-Fi Agile Multiband" based on this comment. Problem solved. https://github.com/esp8266/Arduino/issues/8299#issuecomment-966775021
I have the same issue, it happened on a Sonoff Basic R1 (pretty old module with a lot of flashes over time). I just experimented moving away from tasmota to esphome and everything worked fine with 2022.8.0 firmware. I have updated to 2022.10.2 and it was still ok. Then I have added publish_initial_state: true
on a binary sensor with multiple on_multi_click
timings and it started.
Got back to 2022.8.0, reverted publish_initial_state to false but this did not change anything.
a boot looks more or like this:
[I][logger:243]: Log initialized
[C][status_led:014]: Setting up Status LED...
[C][ota:461]: There have been 0 suspected unsuccessful boot attempts.
[I][app:029]: Running through setup()...
[C][switch.gpio:011]: Setting up GPIO Switch 'Relay'...
[D][switch:017]: 'Relay' Turning OFF.
[D][switch:037]: 'Relay': Sending state OFF
[D][switch:017]: 'Relay' Turning OFF.
[D][binary_sensor:034]: 'Button1': Sending initial state OFF
[D][text_sensor:067]: 'Esphome Version': Sending state '2022.8.0 Nov 16 2022, 11:59:17'
[D][text_sensor:067]: 'Wifi MAC Address': Sending state '5C:CF:7F:xx:xx:xx'
[C][wifi:037]: Setting up WiFi...
[D][wifi:373]: Starting scan...
[D][sensor:126]: 'Uptime': Sending state 0.14600 s with 0 decimals of accuracy
[D][sensor:126]: 'Wifi Signal': Sending state 100.00000 % with 0 decimals of accuracy
[D][binary_sensor:034]: 'Switch1': Sending initial state ON
[D][wifi:388]: Found networks:
[I][wifi:431]: - 'Xxxxxx' (50:C7:BF:xx:xx:xx ▂▄▆█
[D][wifi:433]: Channel: 11
[D][wifi:434]: RSSI: -79 dB
[D][wifi:436]: - 'Zzzz' (12:C7:BF:xx:xx:xx) ▂▄▆█
[D][wifi:436]: - 'Yyyy' (02:C7:BF:xx:xx:xx) ▂▄▆█
[D][wifi:436]: - 'Yyyy' (02:C7:BF:xx:xx:xx) ▂▄▆█
[D][wifi:436]: - 'Zzzz' (12:C7:BF:xx:xx:xx) ▂▄▆█
[I][wifi:248]: WiFi Connecting to 'Xxxx'...
[W][wifi:530]: Timeout while connecting to WiFi.
[I][wifi:248]: WiFi Connecting to 'Xxxx'...
[W][wifi_esp8266:212]: wifi_apply_hostname_(xxxx): lwIP error -16 on interface st (index 0)
[W][wifi_esp8266:482]: Event: Disconnected ssid='Xxxx' bssid=50:C7:BF:xx:xx:xx reason='Association Leave'
[W][wifi:536]: Error while connecting to network.
[W][wifi:572]: Restarting WiFi adapter...
[D][sensor:126]: 'Wifi Signal': Sending state 100.00000 % with 0 decimals of accuracy
[D][wifi:373]: Starting scan...
[D][wifi:388]: Found networks:
[I][wifi:431]: - 'Xxxx' (50:C7:BF:xx:xx:xx) ▂▄▆█
[D][wifi:433]: Channel: 11
[D][wifi:434]: RSSI: -85 dB
[D][wifi:436]: - 'Yyyy' (02:C7:BF:xx:xx:xx) ▂▄▆█
[D][wifi:436]: - 'Zzzz' (12:C7:BF:xx:xx:xx) ▂▄▆█
[I][wifi:248]: WiFi Connecting to 'Xxxx'...
[W][wifi_esp8266:212]: wifi_apply_hostname_(xxxx): lwIP error -16 on interface st (index 0)
[W][wifi:530]: Timeout while connecting to WiFi.
[I][wifi:248]: WiFi Connecting to 'Xxxx'...
[W][wifi_esp8266:212]: wifi_apply_hostname_(xxxx): lwIP error -16 on interface st (index 0)
[W][wifi_esp8266:482]: Event: Disconnected ssid='Xxxx' bssid=50:C7:BF:xx:xx:xx reason='Association Leave'
[W][wifi:536]: Error while connecting to network.
[W][wifi:572]: Restarting WiFi adapter...
Other reasons that show are all possible, Token expired, Association Expired, Auth Expired and so on. It just looks like if the wifi chip got somehow damaged.
What is however interesting - after flashing back tasmota 9.5 it was able to connect and work just fine?!? I flashed the same binary to a Sonoff R2 laying around and it connected without problems as well. Seems some weird combination of chip and firmware/esphome verison...
What I also observed - during some boots, scan reports wery poor RSSI (-85) and for some other boots a bit better (-79)... This does not seem to be signal related though...
Edit: after trying to revert back to tasmota i have found out, that after longer running it also looses wifi and gets in 'trying to connect' loop, so it seems that those few additional flash operations might have either weared out the flash chip or caused some other kind of damage as it does not work back with tasmota. I will have to replace the module entirely :/
Same issue with multiple ESP8266 devices (NodeMCU clones, D1 Mini clones), with or without any functionality attached. Haven't had any issues with ESP32 devices.
All of them are complaining about not being able to apply hostname
[13:21:06][W][wifi_esp8266:212]: wifi_apply_hostname_(central-heating-actuator): lwIP error -16 on interface st (index 0)
[13:21:06][W][wifi:549]: Error while connecting to network.
[13:21:06][I][wifi:257]: WiFi Connecting to 'xxxxx'...
[13:21:06][W][wifi_esp8266:212]: wifi_apply_hostname_(central-heating-actuator): lwIP error -16 on interface st (index 0)
What's noticeable is that if I leave them powered on for long enough, sometimes they do connect to WiFi.
The WiFi is running on a pair of Asus XT8 units, the DHCP server is powered by PiHole v5.19.2.
I'm having an exactly the same issue.
It seems unrelated to ESPHome at all. I've seen this problem with a brand new NodeMCU-v3 dev board with a factory firmware. Luckily I have two routers at home and the issue only exists with my Archer AX73. Everything works fine and blazingly fast with a good old TL-WR841N. I'm suspecting that it's some protocol issue. Probably with 802.11n that the good old TL-WR841N doesn't even support.
Hi, I have been struggling with this issue for a week now and I finally managed to solve it. Based on @SigSegFault 's comment I understood this is most probably a router issue. So I called Asus to help me fix it (I have Asus RT-AX55). After some experimenting, we (the support guy and I) figured out that:
And it works like a charm. Now the question is could something be done in ESPHome to make ESP8266 support Smart Connect as it not cool to have two SSIDs :P
I have an Asus XT8 (RT-AX95Q), but I have different SSIDs for each band and each guest network. I was connecting to the 2.4GHz SSID and still had the issue.
Sorry to hear that, Something I was told to check (I did not need to though) is to set the the Wireless mode for 2.4Ghz to "Legacy". Maybe this will help?
I got my devices working when I switched my Asus router to Wireless Mode = Legacy. Both my esphome device and my nest protects stopped being able access my 2.4Ghz network. I found this site that might have the explanation about what is happening: https://olimex.wordpress.com/2021/12/10/avoid-wifi-channel-12-13-14-when-working-with-esp-devices/
I'm almost a little embarrassed, but for me this behavior occurred because my DHCP range had no more free addresses...
The workaround to set the manual_ip in the wifi module also fixed the issue for me. Flashing the firmware to a brand new esp32 did not fix it.
The problem
I have a couple of cheap Wemos D1 mini clones that frequently get in a state which they can't recover from -- they error out trying set the hostname (via a DHCP renew, if I'm reading the code correctly) over and over again and then give up and eventually time out, then re-scan and fall back into the same pattern. Eventually, they may recover but I haven't found the clue to when and how.
Here's the loop of log messages I see when this happens:
The DHCP server is a DD-WRT router using
dnsmasq
for DHCP & DNS. Here's a capture of a snippet of the traffic for the ESP's MAC address at the router when it's in this state:The TL;DR appears to be that when it's in that state it does a DHCP DISCOVER, gets a DHCP OFFER back and then nada.
When it works, it looks like this:
IOW, now after the OFFER, the ESP sends a REQUEST with the hostname and the router sends back an ACK. Behavior matches the point in the networking code where the hostname is set, but I have no idea how to track down what the error is in the ESP / Arduino Wifi / Networking code since it appears that
dhcp_renew
which is actually causing the error is part of the (closed source?) Espressif SDK?Which version of ESPHome has the issue?
2022.6.2
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
2022.6.7 (core) 2022.06.0 (supervisor)
What platform are you using?
ESP8266
Board
Wemos D1 clone (https://www.amazon.com/dp/B07V84VWSM?_encoding=UTF8&psc=1&ref_=cm_sw_r_cp_ud_dp_84K8CM5B88XMAZWKPY2V)
Component causing the issue
Wifi
Example YAML snippet
I believe I saw this even before installing any of the additional components / sensors / fameworks as well, will grab a clean device to test with a minimal config.
Additional information
No response