[SOLVED] ESPHome DHCP client problems, temporary solution with manual fixed IP

I’m on hass.io and not sure how to do that, unfortunately.

@RGN01
I am too on HASS.io, using the ESPHome addon (on Arch Linux I have dependencies issues which prevent a quick installation of ESPHome CLI).

You can just add the arduino_version row in the device yaml, i.e.:

esphome:
  name: d1mini_test1
  platform: ESP8266
  board: d1_mini_pro
  arduino_version: 2.4.2

Then clean, compile, upload.

Thank you, I’ve learned something from that!

Unfortunately it did not help the problem, though.

I have a few of these NodeMCUs so am trying to find a common denominator for the affected two. Both these two are fairly heavily laden but, perhaps more significantly, they are the only two that have Dallas DS18b20 temperature sensors in use. I wonder if this is significant?

I really appreciate the help.

@PieBru I’m very limited in how much time I can spend on this during the week but I have done some basic testing. Before I started I observed the ‘resets’ (if that is what they are) and they occurred about 55 - 65 seconds apart

I started by commenting out the Dallas components and the timing component. This seemed to make a major difference. I then realised that the default Dallas update period is 60 seconds so I uncommented the Dallas components but left the timing component disabled.

This seems to have worked and my working assumption at this point is the time: component was causing the problem.

The part I commented out is:

time:
  - platform: sntp
    on_time:
      - seconds: 0
        minutes: /1
        then:
          - component.update: ds18b20

I’ll need to monitor it for longer but the signs are good - it is a lot more stable and I’ve not seen a ‘reset’ since I did this.

The other thing I did when I did this was enable debug - I’ll try disabling that later this week, leaving the rest the same.

I hope this helps.

Correction. It was not the time: aspect that prevented the ‘resets’ - it is monitoring the unit with ‘show logs’ . I noticed this a few minutes after writing the earlier message. While monitoring it with that, it appears to be rock solid, stop monitoring and the problem reoccurs.

Armed with that, I’m now testing the Dallas theory and it does seem to be a major contributing cause, if not the cause.

Before / problematic:

esphome:
  name: shed_multi
  platform: ESP8266
  board: nodemcuv2
  
wifi:
  ssid: !secret wifi_name
  password: !secret wifi_password
  domain: !secret wifi_domain

# Enable logging
debug: 
logger:
  level: DEBUG

# Enable Home Assistant API
api:

ota:

i2c:
  sda: D1
  scl: D2
  scan: True

dallas:
  - pin: D3
    id: "ds18b20"

binary_sensor:

  - platform: gpio
    pin:
      number: D4
      mode: INPUT_PULLUP
      inverted: FALSE
    id: shed_door
    name: "Shed Door"
    device_class: opening

  - platform: gpio
    pin:
      number: D5
      mode: INPUT_PULLUP
      inverted: FALSE
    id: shed_window_1
    name: "Shed Window 1"
    device_class: opening

  - platform: gpio
    pin:
      number: D6
      mode: INPUT_PULLUP
      inverted: FALSE
    id: shed_window_2
    name: "Shed Window 2"
    device_class: opening

  - platform: gpio
    pin:
      number: D7
      mode: INPUT_PULLUP
      inverted: FALSE
    id: shed_window_3
    name: "Shed Window 3"
    device_class: opening

output:
  - platform: gpio
    pin: D8
    id: gpio15   
    
# GPIO set as an output so that it can be used for reed switches but not interfere with boot
# if D4 is low at boot, goes to flash mode
  - platform: gpio
    pin: D0
    id: gpio16   

light:
  - platform: binary
    name: "Shed LED"
    id: shed_led
    output: gpio15    

sensor:
  - platform: wifi_signal
    name: "WiFi - Shed Multi"
    update_interval: 60s

  - platform: dallas
    address: 0xD680000007CE4128
    name: "Garage external"
  - platform: dallas
    address: 0x5E0316504B0AFF28
    name: "Shed internal"
  - platform: dallas
    address: 0x9E031647CAFAFF28
    name: "Hotbox"
  - platform: dallas
    address: 0x790316521536FF28
    name: "HW Return House End"
  - platform: dallas
    address: 0xAC041654CAFEFF28
    name: "Garage internal"
  - platform: dallas
    address: 0xF50316522561FF28
    name: "HW feed house end"
  - platform: dallas
    address: 0xFB03165186E1FF28
    name: "HW return shed end"
  - platform: dallas
    address: 0x250416553733FF28
    name: "HW feed shed end"

  - platform: bme280
    temperature:
      name: "BME280 Temperature"
      oversampling: 16x
    pressure:
      name: "BME280 Pressure"
    humidity:
      name: "BME280 Humidity"
    address: 0x76
    update_interval: 60s
    
  - platform: adc
    pin: A0
    name: "Brightness"
    update_interval: 10s
    unit_of_measurement: "Light"
    accuracy_decimals: 1
    filters:
      - calibrate_linear:
          # Map 0.0 (from sensor) to 0.0 (true value)
          - 0.0 -> 0.0
          - 0.75 -> 100.0
      - sliding_window_moving_average:
          window_size: 6
          send_every: 6

After / OK:

esphome:
  name: shed_multi
  platform: ESP8266
  board: nodemcuv2
  
wifi:
  ssid: !secret wifi_name
  password: !secret wifi_password
  domain: !secret wifi_domain

# Enable logging
debug: 
logger:
  level: DEBUG

# Enable Home Assistant API
api:

ota:

i2c:
  sda: D1
  scl: D2
  scan: True

binary_sensor:

  - platform: gpio
    pin:
      number: D4
      mode: INPUT_PULLUP
      inverted: FALSE
    id: shed_door
    name: "Shed Door"
    device_class: opening

  - platform: gpio
    pin:
      number: D5
      mode: INPUT_PULLUP
      inverted: FALSE
    id: shed_window_1
    name: "Shed Window 1"
    device_class: opening

  - platform: gpio
    pin:
      number: D6
      mode: INPUT_PULLUP
      inverted: FALSE
    id: shed_window_2
    name: "Shed Window 2"
    device_class: opening

  - platform: gpio
    pin:
      number: D7
      mode: INPUT_PULLUP
      inverted: FALSE
    id: shed_window_3
    name: "Shed Window 3"
    device_class: opening

output:
  - platform: gpio
    pin: D8
    id: gpio15   
    
# GPIO set as an output so that it can be used for reed switches but not interfere with boot
# if D4 is low at boot, goes to flash mode
  - platform: gpio
    pin: D0
    id: gpio16   

light:
  - platform: binary
    name: "Shed LED"
    id: shed_led
    output: gpio15    

sensor:
  - platform: wifi_signal
    name: "WiFi - Shed Multi"
    update_interval: 60s

  - platform: bme280
    temperature:
      name: "BME280 Temperature"
      oversampling: 16x
    pressure:
      name: "BME280 Pressure"
    humidity:
      name: "BME280 Humidity"
    address: 0x76
    update_interval: 60s
    
  - platform: adc
    pin: A0
    name: "Brightness"
    update_interval: 10s
    unit_of_measurement: "Light"
    accuracy_decimals: 1
    filters:
      - calibrate_linear:
          # Map 0.0 (from sensor) to 0.0 (true value)
          - 0.0 -> 0.0
          - 0.75 -> 100.0
      - sliding_window_moving_average:
          window_size: 6
          send_every: 6

The only difference is removing the Dallas components.

I was having the same ’ [api:067]: Disconnecting Home Assistant 0.107.7’ issue.

I have two dallas sensors so commented out just the sensors, not the dallas component, and the problem went away.

The logs show the dallas component being loaded and the connected sensors being found still.

So, in my experience, it’s the dallas sensor definitions that are causing the issue rather than the component.

Could someone else confirm this?

ESP-WROOM-32; HA 0.108.8; ESPHome 1.14.3
No Dallas components, still problems.
Changing arduino_version to last (1.0.4) make reconnections occur less frequently.

Hi,

Exact same problem here on the Sonoff basic:
At reboot all runs smooth for a couple of minutes and then:
"ERROR Error while reading incoming message… [error 104]…
I’m running HA 0.109.1 on a raspberry Pi 4.
Strange thing though is that I flashed exact same file to both sonoff’s (only changed the name and fixed IP) and only one of those two is dropping out while the other one runs smoothly.
Next to the sonoff’s I have a wemos D1 mini, there also no issue.
Only the one sonoff is giving me troubles.
Can’t seem to put my finger on the cause yet.

I am so not at the level you guys are but i am in the same boat just as a fyi building a solar weather station project my first esp stab and my WiFi connection is below poor keeps having connection problems when use a static ip dhp works better not after many tries just thought i would drop my 2 cents oh yes a d1 mini pro

[17:57:50][C][wifi:033]: Setting up WiFi…
[17:57:51][D][wifi:304]: Starting scan…
[17:57:51][D][adc:056]: ‘digiWTHR Battery’: Got voltage=0.01V
[17:57:51][D][sensor:092]: ‘digiWTHR Battery’: Sending state 0.04056 V with 2 decimals of accuracy
[17:57:57][D][wifi:319]: Found networks:
[17:57:57][I][wifi:365]: - ‘rspeed1’ (42:37:86:26:31:8F) ▂▄▆█
[17:57:57][D][wifi:366]: Channel: 4
[17:57:57][D][wifi:367]: RSSI: -47 dB
[17:57:57][I][wifi:365]: - ‘rspeed1’ (42:37:86:2A:27:44) ▂▄▆█
[17:57:57][D][wifi:366]: Channel: 4
[17:57:57][D][wifi:367]: RSSI: -64 dB
[17:57:57][D][wifi:369]: - ‘’ (46:37:86:2A:27:44) ▂▄▆█
[17:57:57][D][wifi:369]: - ‘DIRECT-UB-VIZIOTV’ (02:6B:9E:A4:80:E5) ▂▄▆█
[17:57:57][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:58:02][W][wifi_esp8266:334]: Event: Disconnected ssid=‘rspeed1’ reason=‘Probe Request Unsuccessful’
[17:58:02][W][wifi:451]: Error while connecting to network.
[17:58:02][W][wifi:488]: Restarting WiFi adapter…
[17:58:03][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:58:05][W][wifi_esp8266:337]: Event: Disconnected ssid=‘rspeed1’ bssid=42:37:86:26:31:8F reason=‘Auth Expired’
[17:58:05][W][wifi:451]: Error while connecting to network.
[17:58:05][W][wifi:488]: Restarting WiFi adapter…
[17:58:10][D][wifi:304]: Starting scan…
[17:58:16][D][wifi:319]: Found networks:
[17:58:16][I][wifi:365]: - ‘rspeed1’ (3E:94:ED:22:8C:40) ▂▄▆█
[17:58:16][D][wifi:366]: Channel: 4
[17:58:16][D][wifi:367]: RSSI: -56 dB
[17:58:16][I][wifi:365]: - ‘rspeed1’ (42:37:86:26:FA:0D) ▂▄▆█
[17:58:16][D][wifi:366]: Channel: 4
[17:58:16][D][wifi:367]: RSSI: -62 dB
[17:58:16][D][wifi:369]: - ‘’ (46:37:86:26:FA:0D) ▂▄▆█
[17:58:16][D][wifi:369]: - ‘’ (42:94:ED:22:8C:40) ▂▄▆█
[17:58:16][D][wifi:369]: - ‘’ (46:37:86:2A:27:44) ▂▄▆█
[17:58:16][D][wifi:369]: - ‘DIRECT-UB-VIZIOTV’ (02:6B:9E:A4:80:E5) ▂▄▆█
[17:58:16][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:58:22][W][wifi_esp8266:334]: Event: Disconnected ssid=‘rspeed1’ reason=‘Probe Request Unsuccessful’
[17:58:22][W][wifi:451]: Error while connecting to network.
[17:58:22][W][wifi:488]: Restarting WiFi adapter…
[17:58:22][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:58:23][D][adc:056]: ‘digiWTHR Battery’: Got voltage=0.01V
[17:58:23][D][sensor:092]: ‘digiWTHR Battery’: Sending state 0.04056 V with 2 decimals of accuracy
[17:58:28][W][wifi_esp8266:334]: Event: Disconnected ssid=‘rspeed1’ reason=‘Probe Request Unsuccessful’
[17:58:28][W][wifi:451]: Error while connecting to network.
[17:58:28][W][wifi:488]: Restarting WiFi adapter…
[17:58:33][D][wifi:304]: Starting scan…
[17:58:39][D][wifi:319]: Found networks:
[17:58:39][I][wifi:365]: - ‘rspeed1’ (42:37:86:26:FA:0D) ▂▄▆█
[17:58:39][D][wifi:366]: Channel: 4
[17:58:39][D][wifi:367]: RSSI: -55 dB
[17:58:39][I][wifi:365]: - ‘rspeed1’ (42:37:86:26:31:8F) ▂▄▆█
[17:58:39][D][wifi:366]: Channel: 4
[17:58:39][D][wifi:367]: RSSI: -49 dB
[17:58:39][D][wifi:369]: - ‘’ (46:37:86:26:31:8F) ▂▄▆█
[17:58:39][D][wifi:369]: - ‘’ (46:37:86:26:FA:0D) ▂▄▆█
[17:58:39][D][wifi:369]: - ‘’ (42:94:ED:22:8C:40) ▂▄▆█
[17:58:39][D][wifi:369]: - ‘’ (46:37:86:2A:27:44) ▂▄▆█
[17:58:39][D][wifi:369]: - ‘DIRECT-UB-VIZIOTV’ (02:6B:9E:A4:80:E5) ▂▄▆█
[17:58:39][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:58:41][W][wifi_esp8266:337]: Event: Disconnected ssid=‘rspeed1’ bssid=42:37:86:26:FA:0D reason=‘Auth Expired’
[17:58:41][W][wifi:451]: Error while connecting to network.
[17:58:41][W][wifi:488]: Restarting WiFi adapter…
[17:58:41][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:58:45][W][wifi_esp8266:337]: Event: Disconnected ssid=‘rspeed1’ bssid=42:37:86:26:FA:0D reason=‘Association Expired’
[17:58:45][W][wifi:451]: Error while connecting to network.
[17:58:45][W][wifi:488]: Restarting WiFi adapter…
[17:58:50][D][wifi:304]: Starting scan…
[17:58:56][D][wifi:319]: Found networks:
[17:58:56][D][wifi:369]: - ‘’ (46:37:86:26:31:8F) ▂▄▆█
[17:58:56][D][wifi:369]: - ‘’ (46:37:86:26:FA:0D) ▂▄▆█
[17:58:56][D][wifi:369]: - ‘’ (46:37:86:2A:27:44) ▂▄▆█
[17:58:56][W][wifi:374]: No matching network found!
[17:58:58][D][adc:056]: ‘digiWTHR Battery’: Got voltage=0.01V
[17:58:58][D][sensor:092]: ‘digiWTHR Battery’: Sending state 0.04056 V with 2 decimals of accuracy
[17:59:01][D][wifi:304]: Starting scan…
[17:59:07][D][wifi:319]: Found networks:
[17:59:07][I][wifi:365]: - ‘rspeed1’ (42:37:86:2A:27:44) ▂▄▆█
[17:59:07][D][wifi:366]: Channel: 4
[17:59:07][D][wifi:367]: RSSI: -68 dB
[17:59:07][I][wifi:365]: - ‘rspeed1’ (42:37:86:26:31:8F) ▂▄▆█
[17:59:07][D][wifi:366]: Channel: 4
[17:59:07][D][wifi:367]: RSSI: -50 dB
[17:59:07][I][wifi:365]: - ‘rspeed1’ (3E:94:ED:22:8C:40) ▂▄▆█
[17:59:07][D][wifi:366]: Channel: 4
[17:59:07][D][wifi:367]: RSSI: -57 dB
[17:59:07][D][wifi:369]: - ‘’ (42:94:ED:22:8C:40) ▂▄▆█
[17:59:07][D][wifi:369]: - ‘’ (46:37:86:2A:27:44) ▂▄▆█
[17:59:07][D][wifi:369]: - ‘DIRECT-UB-VIZIOTV’ (02:6B:9E:A4:80:E5) ▂▄▆█
[17:59:07][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:59:09][W][wifi_esp8266:337]: Event: Disconnected ssid=‘rspeed1’ bssid=42:37:86:2A:27:44 reason=‘Auth Expired’
[17:59:09][W][wifi:451]: Error while connecting to network.
[17:59:09][W][wifi:488]: Restarting WiFi adapter…
[17:59:10][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:59:12][W][wifi_esp8266:337]: Event: Disconnected ssid=‘rspeed1’ bssid=42:37:86:2A:27:44 reason=‘Auth Expired’
[17:59:12][W][wifi:451]: Error while connecting to network.
[17:59:12][W][wifi:488]: Restarting WiFi adapter…
[17:59:17][D][wifi:304]: Starting scan…
[17:59:23][D][wifi:319]: Found networks:
[17:59:23][I][wifi:365]: - ‘rspeed1’ (42:37:86:26:31:8F) ▂▄▆█
[17:59:23][D][wifi:366]: Channel: 4
[17:59:23][D][wifi:367]: RSSI: -49 dB
[17:59:23][I][wifi:365]: - ‘rspeed1’ (42:37:86:2A:27:44) ▂▄▆█
[17:59:23][D][wifi:366]: Channel: 4
[17:59:23][D][wifi:367]: RSSI: -63 dB
[17:59:23][I][wifi:365]: - ‘rspeed1’ (42:37:86:26:FA:0D) ▂▄▆█
[17:59:23][D][wifi:366]: Channel: 4
[17:59:23][D][wifi:367]: RSSI: -62 dB
[17:59:23][D][wifi:369]: - ‘’ (46:37:86:2A:27:44) ▂▄▆█
[17:59:23][D][wifi:369]: - ‘’ (46:37:86:26:FA:0D) ▂▄▆█
[17:59:23][D][wifi:369]: - ‘DIRECT-UB-VIZIOTV’ (02:6B:9E:A4:80:E5) ▂▄▆█
[17:59:23][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:59:26][W][wifi_esp8266:337]: Event: Disconnected ssid=‘rspeed1’ bssid=42:37:86:26:31:8F reason=‘Auth Expired’
[17:59:26][W][wifi:451]: Error while connecting to network.
[17:59:26][W][wifi:488]: Restarting WiFi adapter…
[17:59:26][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:59:29][W][wifi_esp8266:337]: Event: Disconnected ssid=‘rspeed1’ bssid=42:37:86:26:31:8F reason=‘Auth Expired’
[17:59:29][W][wifi:451]: Error while connecting to network.
[17:59:29][W][wifi:488]: Restarting WiFi adapter…
[17:59:33][D][adc:056]: ‘digiWTHR Battery’: Got voltage=0.01V
[17:59:33][D][sensor:092]: ‘digiWTHR Battery’: Sending state 0.04056 V with 2 decimals of accuracy
[17:59:35][D][wifi:304]: Starting scan…
[17:59:40][D][wifi:319]: Found networks:
[17:59:40][D][wifi:369]: - ‘’ (42:94:ED:22:8C:40) ▂▄▆█
[17:59:40][W][wifi:374]: No matching network found!
[17:59:45][D][wifi:304]: Starting scan…
[17:59:51][D][wifi:319]: Found networks:
[17:59:51][I][wifi:365]: - ‘rspeed1’ (3E:94:ED:22:8C:40) ▂▄▆█
[17:59:51][D][wifi:366]: Channel: 4
[17:59:51][D][wifi:367]: RSSI: -57 dB
[17:59:51][I][wifi:365]: - ‘rspeed1’ (42:37:86:2A:27:44) ▂▄▆█
[17:59:51][D][wifi:366]: Channel: 4
[17:59:51][D][wifi:367]: RSSI: -66 dB
[17:59:51][I][wifi:365]: - ‘rspeed1’ (42:37:86:26:FA:0D) ▂▄▆█
[17:59:51][D][wifi:366]: Channel: 4
[17:59:51][D][wifi:367]: RSSI: -51 dB
[17:59:51][D][wifi:369]: - ‘’ (46:37:86:26:FA:0D) ▂▄▆█
[17:59:51][D][wifi:369]: - ‘’ (42:94:ED:22:8C:40) ▂▄▆█
[17:59:51][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:59:54][W][wifi_esp8266:337]: Event: Disconnected ssid=‘rspeed1’ bssid=3E:94:ED:22:8C:40 reason=‘Auth Expired’
[17:59:54][W][wifi:451]: Error while connecting to network.
[17:59:54][W][wifi:488]: Restarting WiFi adapter…
[17:59:54][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[17:59:56][W][wifi_esp8266:337]: Event: Disconnected ssid=‘rspeed1’ bssid=3E:94:ED:22:8C:40 reason=‘Auth Expired’
[17:59:56][W][wifi:451]: Error while connecting to network.
[17:59:56][W][wifi:488]: Restarting WiFi adapter…
[18:00:01][D][wifi:304]: Starting scan…
[18:00:07][D][wifi:319]: Found networks:
[18:00:07][I][wifi:365]: - ‘rspeed1’ (3E:94:ED:22:8C:40) ▂▄▆█
[18:00:07][D][wifi:366]: Channel: 4
[18:00:07][D][wifi:367]: RSSI: -57 dB
[18:00:07][D][wifi:369]: - ‘’ (46:37:86:26:31:8F) ▂▄▆█
[18:00:07][D][wifi:369]: - ‘’ (46:37:86:26:FA:0D) ▂▄▆█
[18:00:07][D][wifi:369]: - ‘DIRECT-UB-VIZIOTV’ (02:6B:9E:A4:80:E5) ▂▄▆█
[18:00:07][I][wifi:193]: WiFi Connecting to ‘rspeed1’…
[18:00:08][D][adc:056]: ‘digiWTHR Battery’: Got voltage=0.01V
[18:00:08][D][sensor:092]: ‘digiWTHR Battery’: Sending state 0.04056 V with 2 decimals of accuracy
[18:00:12][I][wifi:423]: WiFi Connected!
[18:00:12][C][wifi:283]: SSID: ‘rspeed1’
[18:00:12][C][wifi:284]: IP Address: 192.168.1.16
[18:00:12][C][wifi:286]: BSSID: 3E:94:ED:22:8C:40
[18:00:12][C][wifi:287]: Hostname: ‘solar_weather’
[18:00:12][C][wifi:291]: Signal strength: -62 dB ▂▄▆█
[18:00:12][C][wifi:295]: Channel: 4
[18:00:12][C][wifi:296]: Subnet: 255.255.255.0
[18:00:12][C][wifi:297]: Gateway: 192.168.1.1
[18:00:12][C][wifi:298]: DNS1: 8.8.8.8
[18:00:12][C][wifi:299]: DNS2: (IP unset)
[18:00:12][C][ota:029]: Over-The-Air Updates:
[18:00:12][C][ota:030]: Address: 192.168.1.16:8266
[18:00:12][C][mqtt:025]: Setting up MQTT…
[18:00:12][I][mqtt:162]: Connecting to MQTT…
[18:00:12][I][ota:046]: Boot seems successful, resetting boot loop counter.
[18:00:13][I][mqtt:202]: MQTT Connected!
[18:00:13][C][deep_sleep:013]: Setting up Deep Sleep…
[18:00:13][I][app:058]: setup() finished successfully!
[18:00:13][I][app:100]: ESPHome version 1.14.3 compiled on May 7 2020, 17:56:04
[18:00:13][C][wifi:415]: WiFi:
[18:00:13][C][wifi:283]: SSID: ‘rspeed1’
[18:00:13][C][wifi:284]: IP Address: 192.168.1.16
[18:00:13][C][wifi:286]: BSSID: 3E:94:ED:22:8C:40
[18:00:13][C][wifi:287]: Hostname: ‘solar_weather’
[18:00:13][C][wifi:291]: Signal strength: -67 dB ▂▄▆█
[18:00:13][C][wifi:295]: Channel: 4
[18:00:13][C][wifi:296]: Subnet: 255.255.255.0
[18:00:13][C][wifi:297]: Gateway: 192.168.1.1
[18:00:13][C][wifi:298]: DNS1: 8.8.8.8
[18:00:13][C][wifi:299]: DNS2: (IP unset)
[18:00:13][C][i2c:028]: I2C Bus:
[18:00:13][C][i2c:029]: SDA Pin: GPIO4
[18:00:13][C][i2c:030]: SCL Pin: GPIO5

Hi,
small update on my situation here.
setup: 2x sonoff basic, 1xesp-01, 2x wemos D1 mini
Problem: 1 sonoff and the esp-01 continuous disconnects.
Several restarts and reboots of my Hassio didn’t help.

I removed the esp-01 from my setup, restart Hassio and ever since all is working fine.
It looks like one of the sonoff’s had an issue with the esp-01 or visa versa.
Do not yet know why that only one sonoff was affected while the other one didn’t had a problem.
I still have a spare esp-01 and will hook that one up to my system to see if I can reproduce the problem. Otherwise might be faulty esp-01 causing some kind of interference or same mac address as the one sonoff (very wild guess and what are the odds of this last one).

Looks like your wifi setup is sub-optimal. You appear to have several access points broadcasting rspeed1 all on channel 4, and all with good strength (a bad thing when on the same channel). The recommended setup is to use channels 1, 6 and 11 on the 2.4GHz band, as that gives three no-overlapping channels.

That may not be the problem here, but worth looking at. Of course, if you have some sort of wireless mesh network, you may not be able to run on separate channels.

thanks for you suggestion but it is a orbi mesh network so i have no control of channels etc…dhcp works just fine but i can not force a static ip crazy weird i have no other problems on my system with other devices

@robertw, you could set up your own DHCP server (on e.g. a RPI) if you can disable your out-of-the-box DHCP server/settings in order to set up reserved IPs (“static”).

Hello, this topic is marked as solved, but I do not understand what the solution is …
I have an ESP WROOM32 that was running quite ok for a few months, unfortunately the VM where I used to generate the firmware crashed, so I reflashed it from EspHome addon in HA, and then in a new esphome installation in a old VM, as the EspHome compilation is crashing on the RPi4.
Anyway, I used the fixed ip from the start and I had no problems, but now with the new compilation the Wifi is very unstable and always giving the mentioned errors.

Found multiple options, please choose one:
  [1] /dev/ttyUSB0 (CP2102 USB to UART Bridge Controller)
  [2] Over The Air (192.168.0.106)
  [3] MQTT (192.168.0.113)
(number): 2
INFO Starting log output from 192.168.0.106 using esphome API
INFO Connecting to 192.168.0.106:6053 (192.168.0.106)
INFO Successfully connected to 192.168.0.106
ERROR Error while reading incoming messages: Error while receiving data: [Errno 104] Connection reset by peer
WARNING Disconnected from API: Error while receiving data: [Errno 104] Connection reset by peer
INFO Connecting to 192.168.0.106:6053 (192.168.0.106)
WARNING Couldn't connect to API (Error connecting to 192.168.0.106: [Errno 111] Connection refused). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.0.106:6053 (192.168.0.106)
WARNING Couldn't connect to API (Error connecting to 192.168.0.106: [Errno 111] Connection refused). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.0.106:6053 (192.168.0.106)
WARNING Couldn't connect to API (Error connecting to 192.168.0.106: [Errno 9] Bad file descriptor). Trying to reconnect in 2 seconds
INFO Connecting to 192.168.0.106:6053 (192.168.0.106)
WARNING Couldn't connect to API (Error connecting to 192.168.0.106: [Errno 111] Connection refused). Trying to reconnect in 3 seconds
INFO Connecting to 192.168.0.106:6053 (192.168.0.106)
WARNING Couldn't connect to API (Error connecting to 192.168.0.106: [Errno 111] Connection refused). Trying to reconnect in 5 seconds
INFO Connecting to 192.168.0.106:6053 (192.168.0.106)
WARNING Couldn't connect to API (Error connecting to 192.168.0.106: [Errno 111] Connection refused). Trying to reconnect in 7 seconds
INFO Connecting to 192.168.0.106:6053 (192.168.0.106)
WARNING Couldn't connect to API (Error connecting to 192.168.0.106: [Errno 111] Connection refused). Trying to reconnect in 11 seconds

And some logs via USB:

esp32@esp32:~/Projects/esphome$ esphome living.yaml logs
WARNING You're using ESPHome with python 3.5. Support for python 3.5 is deprecated and will be removed in 1.15.0. Please reinstall ESPHome with python 3.6 or higher.
INFO Reading configuration living.yaml...
Found multiple options, please choose one:
  [1] /dev/ttyUSB0 (CP2102 USB to UART Bridge Controller)
  [2] Over The Air (192.168.0.106)
  [3] MQTT (192.168.0.113)
(number): 1
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200
[13:41:42][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:42][D][dht:048]: Got Temperature=24.4°C Humidity=66.2%
[13:41:42][V][sensor:013]: 'Living Room Temperature': Received new state 24.400000
[13:41:42][D][sensor:092]: 'Living Room Temperature': Sending state 24.40000 °C with 1 decimals of accuracy
[13:41:42][V][sensor:013]: 'Living Room Humidity': Received new state 66.200005
[13:41:42][D][sensor:092]: 'Living Room Humidity': Sending state 66.20000 % with 0 decimals of accuracy
[13:41:43][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:43][D][adc:056]: 'Soil Moisture Level': Got voltage=0.00V
[13:41:43][V][sensor:013]: 'Soil Moisture Level': Received new state 0.000000
[13:41:43][D][sensor:092]: 'Soil Moisture Level': Sending state 100.00000 % with 2 decimals of accuracy
[13:41:43][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:44][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:44][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:45][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:45][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:46][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:46][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:47][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:47][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:48][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:48][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:48][W][AsyncTCP.cpp:963] _poll(): ack timeout 4
[13:41:48][V][api.connection:672]: Error: Disconnecting Home Assistant 0.112.4 (192.168.0.113)
[13:41:48][D][api:067]: Disconnecting Home Assistant 0.112.4 (192.168.0.113)
[13:41:49][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:49][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:50][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:50][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:51][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:51][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:52][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:52][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:52][D][dht:048]: Got Temperature=24.4°C Humidity=66.2%
[13:41:52][V][sensor:013]: 'Living Room Temperature': Received new state 24.400000
[13:41:52][D][sensor:092]: 'Living Room Temperature': Sending state 24.40000 °C with 1 decimals of accuracy
[13:41:52][V][sensor:013]: 'Living Room Humidity': Received new state 66.200005
[13:41:52][D][sensor:092]: 'Living Room Humidity': Sending state 66.20000 % with 0 decimals of accuracy
[13:41:53][W][AsyncTCP.cpp:950] _poll(): pcb is NULL
[13:41:53][D][adc:056]: 'Soil Moisture Level': Got voltage=0.00V
[13:41:53][V][sensor:013]: 'Soil Moisture Level': Received new state 0.000000
[13:41:53][D][sensor:092]: 'Soil Moisture Level': Sending state 100.00000 % with 2 decimals of accuracy
[13:41:53][W][mqtt:247]: MQTT Disconnected: TCP disconnected.
[13:41:53][I][mqtt:162]: Connecting to MQTT...

@robertw did you ever solve. Having same issue on Orbi WiFi.

After changing to fast_connect and reboot_timeout, did it fix your wifi issue? I am having wifi dropping issue as well. Just added the fast_connect and reboot_timeout and adding the manual ip. Let’s see if this will fix it.

Before you read on:

The fix that is discussed below has become a lot easier with the release of ESPHome v1.18.0. The required fix is now included by default. So instead of following the below recipe, you can also upgrade to the latest ESPHome, rebuild the firmware and flash your device.

Also, if you are already using the below fix, then it might still be a good idea to upgrade. The fix has been developed further since I posted it, and it has become better over time. On my test device, I can now run a Home Assistant API connection, alongside mulitple OTA logging sessions, without skipping a beat.

Thanks to all who have helped testing the patch!

Okay, here’s the original message …

I am currently working on an ESPHome project to make a Yeelight Bedside Lamp v2 work. In this project I saw a lot of these “ack timeout 4” messages and accompanying disconects. All the usual tips did not work (fixed ip, fast connect, power management changes). Chaning the log level had some effect it seemed, but that was very unsatisfying and not a perfect solution.

After a debugging slurry, I think I might have found a race condition cause for these disconnects in the AsyncTCP library. I created an issue for my findings. Maybe this can help the people in this thread, who are running into the same issue.

Update:

I created a patch for the AsyncTCP-esphome lib as used for ESPHome.
It can be found on my github account:

If you want to try out this change, then create a library directory for your esphome instance, and checkout the repository to that directory. Then add lib_extra_dirs to your device yaml file to point to that library directory.
E.g., on my system, I use /config/libs for this, and I do:

# cd /config/libs
# git clone https://github.com/mmakaay/AsyncTCP.git

The relevant part of my device config looks like:

esphome:
  platformio_options:
    lib_extra_dirs: /config/libs

This way, the repository version of the library will override the esphome version of the library.
Build the device firmware and flash the device like you would normally do.

My own device has been stable for hours now, while before it would disconnect Home Assistant every few minutes. I’m not sure this is a final fix (it still feels like a foreign code base), but I’m happy with these results so far.

5 Likes

@mmakaay Good catch and explanations!
Hope your finding will help to solve those pesky apparently random problems.
Piero

1 Like

This is amazing!!! Thanks so so much… I had the same issue and this fixed it nicely. Great job! Thanks again!

That is great news! :smiley: Thanks for reporting back!

My issue report didn’t get noticed by the author of the original AsyncTCP library on github, but @OttoWinter was willing to accepte a pull request for the AsyncTCP-esphome fork. So this fix is now official.

2 Likes