Can't connect to wifi - lwIP error -16

Hi,

Suddently, my Esp stoppet connecting to my wifi network. I can see this log:


[15:28:53][I][wifi:248]: WiFi Connecting to 'wifi'...
[15:28:53][W][wifi_esp8266:212]: wifi_apply_hostname_(espco): lwIP error -16 on interface st (index 0)

Can anyone help me? I already tried to connect with another ESP and didn’t work. I already have 7 more Esp’s connected. I tried to connect new devices to my network and all of them worked. This is my xaml file:

esphome:
  name: espcompressor
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "wifi"
  password: "wifipass"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
#  ap:
#    ssid: "Esp Compressor Fallback Hotspot"
#    password: "smDfhO4n25pl"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
#api:

ota:

output:
  - platform: gpio
    pin: 12  #D6
    id: 'compressor_onoff_out'
  
switch:
  - platform: output
    name: " ESP Compressor ON/OFF"
    output: 'compressor_onoff_out'

    
binary_sensor:
  - platform: gpio
    name: "Input_estado_rele_compressor"
    pin:
      number: 0 #D2
      inverted: true
      mode: INPUT_PULLUP

  - platform: gpio
    name: "Input_Botao"
    pin:
      number: 5 #D1
      inverted: true
      mode: INPUT_PULLUP

Thanks in advance

Hi,

same problem here:

[I][wifi:257]: WiFi Connecting to 'myWifi'...
[W][wifi_esp8266:212]: wifi_apply_hostname_(ventilation-controller): lwIP error -16 on interface st (index 0)
[W][wifi:549]: Error while connecting to network.

Interesting enough this only happens if I use the mqtt client component.
If i remove those two lines at the end of the yaml, everything works as expected.

Also interesting @amcjoao: We’re both on a 1 MiB ESP8266.

My yaml file:

esphome:
  name: ventilation-controller

esp8266:
  board: esp8285

api:
  encryption:
    key: !secret api_key

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

  ap:
    ssid: "ventilation-controller"
    password: !secret wifi_password

captive_portal:

logger:

ota:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode:
        input: true
        pullup: true
      inverted: true
    name: "Taster"
    on_press:
      - switch.toggle: relay

switch:
  - platform: gpio
    name: "Pumpe"
    pin: GPIO12
    id: relay

status_led:
  pin:
    number: GPIO13
    inverted: yes

dallas:
  - pin: GPIO14

sensor:
  - platform: dallas
    address: 0xb90316b5a610ff28
    name: "Zuluft Lüftungsanlage"
  - platform: dallas
    address: 0xb50316b5ade8ff28
    name: "Temperatur Nord"
  - platform: dallas
    address: 0xe70416c168deff28
    name: "Abluft Lüftungsanlage"
  - platform: dallas
    address: 0xb10316b5b9fbff28
    name: "Sole Rücklauf"

mqtt:
  broker: 192.168.1.10

I have this exact error after upgrading esphome to the latest version on my SonOff Basic.
Any news about this?

After updating a few esp8266, I now have the same issue: they keep looping on a lwIP error -16 on interface st (index 0) error. I have 5 of them with the same problem. The only one that still works hasn’t been updated.

Having the same issue. Anyone find a solution? At times I can even see my devices as connected on the router but the devices give this error.

Too many people asking similar questions. I will only address the OP.

lwIP uses memory pools for network packet and buffer management. Error -16 could potentially be related to memory allocation issues.

You don’t need captive_portal:. Delete this line- it will save memory.

You don’t say which ESP development board you are using, but I have several ESP8266-01, 1MB boards all over my house and I’ve never seen this error. However, I have seen one instance where two ESP devices had the same MAC address. One was a Sonoff Basic and the other was an ESP8266-01. Needless to say the ESP-01 is trash now.