ESP8266 with ESPHome keeps losing connection to HA

I’m having a problem with the connection between ESPHome and HA. An SCD41 CO2 sensor is connected to the ESP8266. So far, everything is working perfectly. After an unspecified amount of time, the connection to HA is lost. The sensor values are displayed as unavailable. When I then check the log in HA (ESPHome Builder) via Wi-Fi, everything looks fine, and suddenly the values reappear. What could be causing this? Any idea?

Welcome to forum.
Sounds like HA or api problem, if esphome logs keep on running.
Without logs and code difficult to guess.

My guess is that your wi-fi is dropping out, and there are various reasons it could happen.

Or are you asking why the log doesn’t show the wi-fi dropout ?
The ESPHome log at the HA end shows the messages it receives. It doesn’t receive any message that the wi-fi connection drops, or the wi-fi connection being re-established, and after the wi-fi connection has been re-established it happily continues to display any subsequent log messages it receives.

So the big question is … did the log show any other messages from the time period that the sensor values were missing ?

The simplest tet you cn do is to place the ESP8266 very close to the WiFi router and see if this makes it work. If so then all you have is a simple signal strengh issue

Nest easy test is to rmove all the YAML that has to do with collecting and reportig sensor data so all you have is a minimal ESPHome device that does nothing. If that fixes the problem then you can blame somethjoing in the parts you removed.

And then you might try using a differen ESP8266 to verify you son’t have defective hardware.

how are you powering the ESP8266? Is the power reliable?

I’d bet it is one of the above causing the issue

1 Like

I like @Chrisalbertson 's process for debugging the problem.

I had a problem that matched your symptoms. I discovered that I had in the range of 20-30 WiFi devices connected to my Asus router. I did the experiment of taking them off one at a time to see which one was causing the problem. The problem went away when I had 21 connections. Ah ha! #22 was it. so I reconnect the rest without #22. The problem came back. It was my router, it couldn’t handle that many connections.

Now I have three access points and converted as many as possible to wired.

1 Like

Thanks for your suggestions. I’ll run a few tests. Do you know if it’s possible to program a new ESP8266 using the same YAML file, or will that cause a problem for HA?

Being a bit harsh on everybody, but it would have made it far easier to have a properly formatted </> posting of your yaml code, as well as compile log (with a short period of the device running well) to look at, rather than all the guessing to start with.

Are there any errors in your logs?

Let’s get some facts and then we can guess, based on our individual experiences.

Please put the yaml logging mode in VERY VERBOSE so we can see what is happening behind the scenes in a little more detail. (Remember to put it back to the old value once the problem is resolved)

The problem may become self-evident or at least guide us in the right direction.

There has been some ESPHome love given to ESP8265 devices recently, and your code may need tweaks, or it could be an external condition.

Don’t keep us guessing…

esphome:
  name: wohnzimmer-temperatur
  friendly_name: Wohnzimmer Temperatur
  
esp8266:
  board: d1_mini

logger:
  level: VERY_VERBOSE

api:
  encryption:
    key: "MDJsNmG6IYcdakgUSXIIn1VXVOMU03yKzf0rsLDP0e4="

ota:
  - platform: esphome
    password: "a493271da843fd5e31249bf793bd89e8"

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

  ap:
    ssid: "Wohnzimmer-Temperatur"
    password: "61838MN5pBM2"

captive_portal:

i2c:
  sda: 4
  scl: 5
  scan: true

sensor:
  - platform: scd4x
    id: co2_sensor
    co2:
      name: "CO2 Wert"
      id: co2_value
      unit_of_measurement: "ppm"
      icon: "mdi:waves"
      filters:
        - offset: -4
    temperature:
      name: "Temperature"
      unit_of_measurement: "°C"
      icon: "mdi:temperature-celcius"
      state_class: "measurement"
      filters:
        - offset: -0.4
      accuracy_decimals: 1    
    humidity:
      name: "Luftfeuchtigkeit"
      unit_of_measurement: "%"
      icon: "mdi:water"
      state_class: "measurement"
      filters:
        - offset: -20
      accuracy_decimals: 0 

  - platform: aht10
    variant: AHT10
    temperature:
      name: "AHT10-Temperatur"
      unit_of_measurement: "°C"
      icon: "mdi:temperature-celcius"
      state_class: "measurement"
      accuracy_decimals: 1    
    humidity:
      name: "AHT10-Luftfeuchtigkeit"
      unit_of_measurement: "%"
      icon: "mdi:water"
      state_class: "measurement"
      accuracy_decimals: 0 
    update_interval: 60s    

text_sensor:
  - platform: template
    name: "CO2 Farbe"
    lambda: |-
      // Rohwerte ohne Brightness-Faktor
      int r = 0, g = 0, b = 0;
      float co2 = id(co2_value).state;
      if (co2 < 600) {
        float t = (co2 - 400) / 200.0;
        b = (int)(255 * (1 - t));
        g = (int)(255 * t);
      } else if (co2 < 800) {
        g = 255;
      } else if (co2 < 1200) {
        float t = (co2 - 800) / 400.0;
        r = (int)(255 * t);
        g = 255;
      } else if (co2 < 1600) {
        float t = (co2 - 1200) / 400.0;
        r = 255;
        g = (int)(255 * (1.0 - t));
      } else if (co2 < 20000) {
        r = 255;
      } else {
        r = 190;
        g = 190; 
        b = 120;
      }
      char buf[20];
      sprintf(buf, "#%02X%02X%02X", r, g, b);
      return std::string(buf);

INFO ESPHome 2026.3.1
INFO Reading configuration /config/esphome/wohnzimmer-temperatur.yaml…
WARNING The minimum WiFi authentication mode (wifi → min_auth_mode) is not set. This controls the weakest encryption your device will accept when connecting to WiFi. Currently defaults to WPA (less secure), but will change to WPA2 (more secure) in 2026.6.0. WPA uses TKIP encryption which has known security vulnerabilities and should be avoided. WPA2 uses AES encryption which is significantly more secure. To silence this warning, explicitly set min_auth_mode under ‘wifi:’. If your router supports WPA2 or WPA3, set ‘min_auth_mode: WPA2’. If your router only supports WPA, set ‘min_auth_mode: WPA’.
INFO Generating C++ source…
INFO Compiling app… Build path: /data/build/wohnzimmer-temperatur
Processing wohnzimmer-temperatur (board: d1_mini; framework: arduino; platform: platformio/[email protected])

HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
ESPHome: Excluding Updater.cpp from build (using native OTA backend)
ESPHome: Excluding core_esp8266_waveform_phase.cpp from build (waveform not required)
ESPHome: Excluding core_esp8266_waveform_pwm.cpp from build (waveform not required)
Dependency Graph
|-- ESPAsyncTCP @ 2.0.0
|-- ESP8266WiFi @ 1.0
|-- ESPAsyncWebServer @ 3.9.6
|-- DNSServer @ 1.1.1
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.11
|-- Wire @ 1.0
Compiling .pioenvs/wohnzimmer-temperatur/src/esphome/core/application.cpp.o
Compiling .pioenvs/wohnzimmer-temperatur/src/main.cpp.o
remove_scanf_float_flag([“.pioenvs/wohnzimmer-temperatur/firmware.elf”], [“.pioenvs/wohnzimmer-temperatur/src/esphome/components/aht10/aht10.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/api/api_buffer.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/api/api_connection.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/api/api_frame_helper.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/api/api_frame_helper_noise.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/api/api_pb2.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/api/api_pb2_dump.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/api/api_pb2_service.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/api/api_server.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/api/list_entities.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/api/proto.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/api/subscribe_state.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/captive_portal/captive_portal.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/esp8266/core.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/esp8266/gpio.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/esp8266/helpers.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/esp8266/preferences.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/esp8266/printf_stubs.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/esp8266/waveform_stubs.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/esphome/ota/ota_esphome.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/i2c/i2c.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/i2c/i2c_bus_arduino.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/logger/logger.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/logger/logger_esp8266.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/logger/task_log_buffer_zephyr.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/md5/md5.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/mdns/mdns_component.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/mdns/mdns_esp8266.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/network/util.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/ota/ota_backend.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/ota/ota_backend_esp8266.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/ota/ota_backend_host.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/safe_mode/safe_mode.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/scd4x/scd4x.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/sensirion_common/i2c_sensirion.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/sensor/automation.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/sensor/filter.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/sensor/sensor.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/sha256/sha256.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/socket/lwip_raw_tcp_impl.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/socket/socket.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/template/text_sensor/template_text_sensor.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/text_sensor/filter.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/text_sensor/text_sensor.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/web_server/ota/ota_web_server.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/web_server_base/web_server_base.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/wifi/wifi_component.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/components/wifi/wifi_component_esp8266.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/application.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/color.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/component.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/component_iterator.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/controller_registry.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/entity_base.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/gpio.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/helpers.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/log.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/lwip_fast_select.c.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/scheduler.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/time.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/time_64.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/esphome/core/util.cpp.o”, “.pioenvs/wohnzimmer-temperatur/src/main.cpp.o”])
ESPHome: Removing _scanf_float (saves ~8KB flash)
Linking .pioenvs/wohnzimmer-temperatur/firmware.elf
RAM: [==== ] 42.0% (used 34428 bytes from 81920 bytes)
Flash: [===== ] 47.0% (used 491337 bytes from 1044464 bytes)
Building .pioenvs/wohnzimmer-temperatur/firmware.bin
esp8266_copy_factory_bin([“.pioenvs/wohnzimmer-temperatur/firmware.bin”], [“.pioenvs/wohnzimmer-temperatur/firmware.elf”])
esp8266_copy_ota_bin([“.pioenvs/wohnzimmer-temperatur/firmware.bin”], [“.pioenvs/wohnzimmer-temperatur/firmware.elf”])
========================= [SUCCESS] Took 10.03 seconds =========================
INFO Build Info: config_hash=0xa913d725 build_time_str=2026-03-28 10:17:59 +0100
INFO Successfully compiled program.
INFO Connecting to 192.168.178.190 port 8266…
INFO Connected to 192.168.178.190
INFO Uploading /data/build/wohnzimmer-temperatur/.pioenvs/wohnzimmer-temperatur/firmware.bin (495488 bytes)
INFO Compressed to 348827 bytes
Uploading: [============================================================] 100% Done…

INFO Upload took 5.93 seconds, waiting for result…
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.178.190 using esphome API
INFO Successfully resolved wohnzimmer-temperatur @ 192.168.178.190 in 0.000s
INFO Trying to connect to wohnzimmer-temperatur @ 192.168.178.190 in the background
INFO Successfully connected to wohnzimmer-temperatur @ 192.168.178.190 in 0.013s
INFO Successful handshake with wohnzimmer-temperatur @ 192.168.178.190 in 3.453s
[10:18:47.834][I][app:231]: ESPHome version 2026.3.1 compiled on 2026-03-28 10:17:59 +0100
[10:18:47.834][C][logger:229]: Logger:
[10:18:47.834][C][logger:229]: Max Level: VERY_VERBOSE
[10:18:47.834][C][logger:229]: Initial Level: VERY_VERBOSE
[10:18:47.834][C][logger:236]: Log Baud Rate: 115200
[10:18:47.834][C][logger:236]: Hardware UART: UART0
[10:18:47.879][C][i2c.arduino:064]: I2C Bus:
[10:18:47.879][C][i2c.arduino:065]: SDA Pin: GPIO4
[10:18:47.879][C][i2c.arduino:065]: SCL Pin: GPIO5
[10:18:47.879][C][i2c.arduino:065]: Frequency: 50000 Hz
[10:18:47.879][C][i2c.arduino:079]: Recovery: bus successfully recovered
[10:18:47.879][I][i2c.arduino:089]: Results from bus scan:
[10:18:47.879][I][i2c.arduino:095]: Found device at address 0x38
[10:18:47.879][I][i2c.arduino:095]: Found device at address 0x62
[10:18:47.885][C][template.text_sensor:016]: Template Sensor ‘CO2 Farbe’
[10:18:47.907][C][scd4x:112]: SCD4X:
[10:18:47.907][C][scd4x:113]: Address: 0x62
[10:18:47.919][C][scd4x:130]: Automatic self calibration: ON
[10:18:47.919][C][scd4x:130]: Measurement mode: Periodic (5s)
[10:18:47.919][C][scd4x:130]: Temperature offset: 4.00 °C
[10:18:47.919][C][scd4x:145]: Ambient pressure compensation disabled
[10:18:47.919][C][scd4x:145]: Altitude compensation: 0m
[10:18:47.919][C][scd4x:453]: Update Interval: 60.0s
[10:18:47.920][C][scd4x:017]: CO2 ‘CO2 Wert’
[10:18:47.920][C][scd4x:017]: State Class: ‘measurement’
[10:18:47.920][C][scd4x:017]: Unit of Measurement: ‘ppm’
[10:18:47.920][C][scd4x:017]: Accuracy Decimals: 0
[10:18:47.933][C][scd4x:237]: Device Class: ‘carbon_dioxide’
[10:18:47.942][C][scd4x:228]: Icon: ‘mdi:waves’
[10:18:47.942][C][scd4x:017]: Temperature ‘Temperature’
[10:18:47.942][C][scd4x:017]: State Class: ‘measurement’
[10:18:47.942][C][scd4x:017]: Unit of Measurement: ‘°C’
[10:18:47.942][C][scd4x:017]: Accuracy Decimals: 1
[10:18:47.954][C][scd4x:237]: Device Class: ‘temperature’
[10:18:47.966][C][scd4x:228]: Icon: ‘mdi:temperature-celcius’
[10:18:47.966][C][scd4x:017]: Humidity ‘Luftfeuchtigkeit’
[10:18:47.966][C][scd4x:017]: State Class: ‘measurement’
[10:18:47.966][C][scd4x:017]: Unit of Measurement: ‘%’
[10:18:47.966][C][scd4x:017]: Accuracy Decimals: 0
[10:18:47.977][C][scd4x:237]: Device Class: ‘humidity’
[10:18:47.982][C][scd4x:228]: Icon: ‘mdi:water’
[10:18:47.994][C][aht10:154]: AHT10:
[10:18:47.994][C][aht10:155]: Address: 0x38
[10:18:47.994][C][aht10:017]: Temperature ‘AHT10-Temperatur’
[10:18:47.994][C][aht10:017]: State Class: ‘measurement’
[10:18:47.994][C][aht10:017]: Unit of Measurement: ‘°C’
[10:18:47.994][C][aht10:017]: Accuracy Decimals: 1
[10:18:48.007][C][aht10:237]: Device Class: ‘temperature’
[10:18:48.018][C][aht10:228]: Icon: ‘mdi:temperature-celcius’
[10:18:48.019][C][aht10:017]: Humidity ‘AHT10-Luftfeuchtigkeit’
[10:18:48.019][C][aht10:017]: State Class: ‘measurement’
[10:18:48.019][C][aht10:017]: Unit of Measurement: ‘%’
[10:18:48.019][C][aht10:017]: Accuracy Decimals: 0
[10:18:48.030][C][aht10:237]: Device Class: ‘humidity’
[10:18:48.036][C][aht10:228]: Icon: ‘mdi:water’
[10:18:48.039][C][captive_portal:134]: Captive Portal:
[10:18:48.062][C][wifi:1510]: WiFi:
[10:18:48.062][C][wifi:1510]: Local MAC: 44:17:93:10:69:02
[10:18:48.062][C][wifi:1510]: Connected: YES
[10:18:48.062][C][wifi:1221]: IP Address: 192.168.178.190
[10:18:48.062][C][wifi:1232]: SSID: ‘FRITZ!Box 7590 QW’[redacted]
[10:18:48.062][C][wifi:1232]: BSSID: 2C:91:AB:E7:75:2A[redacted]
[10:18:48.062][C][wifi:1232]: Hostname: ‘wohnzimmer-temperatur’
[10:18:48.062][C][wifi:1232]: Signal strength: -73 dB ▂▄▆█
[10:18:48.062][C][wifi:1232]: Channel: 11
[10:18:48.062][C][wifi:1232]: Subnet: 255.255.255.0
[10:18:48.062][C][wifi:1232]: Gateway: 192.168.178.1
[10:18:48.062][C][wifi:1232]: DNS1: 192.168.178.1
[10:18:48.062][C][wifi:1232]: DNS2: 0.0.0.0
[10:18:48.092][C][esphome.ota:071]: Over-The-Air updates:
[10:18:48.092][C][esphome.ota:071]: Address: wohnzimmer-temperatur.local:8266
[10:18:48.092][C][esphome.ota:071]: Version: 2
[10:18:48.092][C][esphome.ota:078]: Password configured
[10:18:48.104][C][safe_mode:026]: Safe Mode:
[10:18:48.104][C][safe_mode:026]: Successful after: 60s
[10:18:48.104][C][safe_mode:026]: Invoke after: 10 attempts
[10:18:48.104][C][safe_mode:026]: Duration: 300s
[10:18:48.124][C][web_server.ota:238]: Web Server OTA
[10:18:48.124][C][api:237]: Server:
[10:18:48.124][C][api:237]: Address: wohnzimmer-temperatur.local:6053
[10:18:48.124][C][api:237]: Listen backlog: 1
[10:18:48.124][C][api:237]: Max connections: 4
[10:18:48.124][C][api:244]: Noise encryption: YES
[10:18:48.140][C][mdns:194]: mDNS:
[10:18:48.140][C][mdns:194]: Hostname: wohnzimmer-temperatur
[10:18:48.140][V][mdns:199]: Services:
[10:18:48.140][V][mdns:201]: - _esphomelib, _tcp, 6053
[10:18:48.152][V][mdns:204]: TXT: friendly_name = Wohnzimmer Temperatur
[10:18:48.152][V][mdns:204]: TXT: version = 2026.3.1
[10:18:48.162][V][mdns:204]: TXT: mac = 441793106902
[10:18:48.162][V][mdns:204]: TXT: platform = ESP8266
[10:18:48.162][V][mdns:204]: TXT: board = d1_mini
[10:18:48.173][V][mdns:204]: TXT: network = wifi
[10:18:48.173][V][mdns:204]: TXT: api_encryption = Noise_NNpsk0_25519_ChaChaPoly_SHA256
[10:19:23.680][VV][api.service:019]: on_disconnect_request: {}
[10:19:23.680][D][api.connection:2440]: Home Assistant 2026.3.4 (192.168.178.194): disconnected
[10:19:23.689][VV][api.service:012]: send_message disconnect_response: DisconnectResponse {}
[10:19:23.708][V][api:172]: Remove connection Home Assistant 2026.3.4
[10:19:31.652][I][safe_mode:091]: Boot seems successful; resetting boot loop counter
[10:19:31.655][VV][component:301]: safe_mode loop disabled
[10:19:34.341][V][text_sensor:035]: ‘CO2 Farbe’: Received new state #BEBE78
[10:19:34.341][D][text_sensor:120]: ‘CO2 Farbe’ >> ‘#BEBE78
[10:19:35.428][V][i2c.arduino:116]: 0x62 TX E4:B8
[10:19:35.428][V][i2c.arduino:116]: 0x62 TX
[10:19:35.428][V][i2c.arduino:116]: 0x62 TX EC:05
[10:19:35.439][V][i2c.arduino:116]: 0x62 TX
[10:19:35.439][V][sensor:069]: ‘CO2 Wert’: Received new state 914.000000
[10:19:35.439][VV][sensor.filter:023]: Filter(0x3fff1344)::input(914.000000)
[10:19:35.439][VV][sensor.filter:030]: Filter(0x3fff1344)::output(910.000000) → SENSOR
[10:19:35.451][D][sensor:124]: ‘CO2 Wert’ >> 910 ppm
[10:19:35.451][V][sensor:069]: ‘Temperature’: Received new state 24.550323
[10:19:35.462][VV][sensor.filter:023]: Filter(0x3fff13a4)::input(24.550323)
[10:19:35.462][VV][sensor.filter:030]: Filter(0x3fff13a4)::output(24.150324) → SENSOR
[10:19:35.474][D][sensor:124]: ‘Temperature’ >> 24.2 °C
[10:19:35.474][V][sensor:069]: ‘Luftfeuchtigkeit’: Received new state 39.279175
[10:19:35.486][VV][sensor.filter:023]: Filter(0x3fff1404)::input(39.279175)
[10:19:35.486][VV][sensor.filter:030]: Filter(0x3fff1404)::output(19.279175) → SENSOR
[10:19:35.498][D][sensor:124]: ‘Luftfeuchtigkeit’ >> 19 %
[10:19:35.498][W][component:429]: scd4x.sensor cleared Warning flag
[10:19:35.510][W][component:520]: scd4x.sensor took a long time for an operation (86 ms), max is 30 ms
[10:19:37.374][V][i2c.arduino:116]: 0x38 TX AC:33:00
[10:19:37.374][V][i2c.arduino:116]: 0x38 TX
[10:19:37.374][V][sensor:069]: ‘AHT10-Temperatur’: Received new state 22.090149
[10:19:37.385][D][sensor:124]: ‘AHT10-Temperatur’ >> 22.1 °C
[10:19:37.386][V][sensor:069]: ‘AHT10-Luftfeuchtigkeit’: Received new state 38.762569
[10:19:37.386][D][sensor:124]: ‘AHT10-Luftfeuchtigkeit’ >> 39 %

Ouch!!!
Care to use the post edit button and fix the formatting, using the </> code formatting, PLEASE.

1 Like

Sorry. I’m new here.

No problems. We all are. Just used to formatted output for readability. Thanks for editing.

Three issues that stood out:

That signal level is quite low, and may be contributing to dropouts. Have you tried moving the device or checking if there are obstructions that are keeping the signal level low? Is there shielding that is in the way? Is your ESP8266 in a metal enclosure/Faraday Cage? Is the temperature sensor and CO2 sensor interfering with, or shielding the ESP8266 antenna? Closeby appliances, such as microwave ovens, etc, that may also generate interference as well as shielding. Is there close-by interference? Have you rebooted your FritzBox and your ESP to grab a better WiFi channel that may have less traffic or interference?

Worth setting this in the WiFi section to match your FritzBox capabilities to ESPHome. WPA2 is the maximum your ESP8266 supports, so specify that.

Arduino or Espressif idf framework? You can specify that in the compiler directives in your yaml code.
Please clear your ESPHome cache before your next compile. This will remove any code fragments lying around that may corrupt the compile process. The next time you compile, it will take considerably longer as it downloads fresh copies of necessary libraries, unpacks them and recompiles them along with your yaml code. You should only need to do this once, to clear the cache, and if you change frameworks. Once the fresh copies are in the cache, it uses them instead of downloading each time, unless new versions are specified. Be sure to save your yaml code before clearjng, in case that disappears too.

Is your power supply up to powering the ESP8266 and all the connected peripherals? If it is struggling, this may cause these symptoms. Check the cables as well as the connectors may be worn, or where the cable joins the connectors may be damaged.

The WiFi code may reboot the ESP if connection is lost. By the time you attempt connection to check what has happened, it may have reconnected as part of the reboot cycle. Maybe you can tweak the roboot_timeout parameters?

Have a check in the HomeAssistant system error logs. Anything related?

Have you set up a Static IP address for faster and more reliable connections? In your FritzBox DHCP configuration section as well as your yaml (they have to match). While you are there, set the HomeAssistant server to a Static IP address as well.

power_save_mode? Make sure it is off.

Keep us posted on progress.

Well that right there is likely your problem. I have never heard anything good about this brand of routers. I have heard lots of people having issues with them. You might get better results in a different location, but you might want your sensors in the current location.

If it was mine, I would attach a laptop to the device and start logging the output via the serial (USB) output to a terminal emulator (that is logging to a file). I would then leave it running till the problem showed up. It will likely show the Wi-Fi connection dropping and possibly reconnecting.

You can try rebooting your router. It probably won’t fix the problem for long, but it might help. Some people reboot the router every night.

1 Like

FRITZ!Box (manufacturer AVM) is the leading provider of routers for home users in Germany, with a market share of around 50%. The brand has dominated the market for years thanks to its high user-friendliness and technical performance.

In my experience, the manufacturer’s support is very good. They were very helpful when I switched to a new fiber optic provider and encountered problems, and even created a special version for my FRITZ!Box to resolve issues with my landline phone connection over fiber.

This is my second new FRITZ!Box in 14 years, currently with 30 devices connected via Wi-Fi (four on 5 GHz, the rest on 2.4 GHz), and I’ve never had to manually restart the box (not even the previous one). I don’t think the problem lies with the FRITZ!Box itself (though it’s possible). However, the Zigbee support on my new box isn’t great (it only supports a very limited number of devices).
I would suspect the other hardware, the reception location, or the power supply…

(However, for the Fritzbox 7590 model, WLAN problems are frequently reported on the internet after approximately 5 years of use.)

1 Like

If (and I mean if) it really is a quality issue and it was between the FRITZ!Box 7590 and the d1_mini I’d be looking at the esp board, not the router. The d1 board is the most ripped off board ever, chances of it being a genuine is close to 0 and many flakey Chinese ripoffs about. That router is fine, so is the brand. It is way better than what most ISP’s shove down people’s throats and it is 100x more expensive than your average d1 board. These are my wifi speeds to my ipad with that router, about 55 wifi devices connected atm.

But there are more issues with esp8266 with the lastest builds of ESPHome mentioned on the forum here, so it can be many things. The wifi stack was overhauled pretty extensively I believe.

I’d also be looking at the power supply.

@ Fantomaz: What is the quality of the wiring to the sensors? Initially, I had problems with loose connections. Now I always solder the sensors securely and use proper connectors for connecting external sensors (no more pin headers or Dupont cables).

2 Likes

Remember to inspect your solder joints as well. There’s nothing more PITA than cold solder joint, when you are trying to resolve issues.
Also, factory soldered pin headers and good quality dupont cables (not those AE ones made of steel and flimsy contacts) is pretty solid option when used indoors.

Glad you are having a good experience with it. Many people don’t. Perhaps because most people in Germany have them that isn’t surprising.

The logs indicate a fairly low signal level. This could be because the esp has a poor antenna design, or the router isn’t that great, or the environment makes it impossible, or a combination of them.

I have a couple of problematic devices (and the data to show it). I probably need to get actual device logging to see if anything shows up to indicate the real problem. I see the device switching APs and/or losing connection. There are many reasons that could be true. It hasn’t been enough of an issue for me to put more effort in to it. I did replace one of my APs because that one certainly seemed not quite right/good enough. The problem is intermittent and the esp is close enough to the router so signal strength is not the issue.

RF is more magic than science. Did you make the appropriate sacrifice to the RF gods?

2 Likes

Can I just burn at the stake some cheap esp supermini board?