ESPHOME: Connection error occurred: EOF received

Hello, my ESP cant connect, i get:

INFO ESPHome 2023.8.0b2
INFO Reading configuration /config/esphome/display.yaml...
INFO Starting log output from 192.168.1.72 using esphome API
WARNING 192.168.1.72: Connection error occurred: EOF received
WARNING Can't connect to ESPHome API for 192.168.1.72: Connection closed (APIConnectionError)
INFO Trying to connect to 192.168.1.72 in the background
WARNING 192.168.1.72: Connection error occurred: EOF received
WARNING 192.168.1.72: Connection error occurred: EOF received

my YAML:

esphome:
  name: display
  friendly_name: display

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "***"

ota:
  password: "***"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Display Fallback Hotspot"
    password: "***"
    
  manual_ip:
    static_ip: 192.168.1.72
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 192.168.1.1
    dns2: 8.8.4.4

captive_portal:

font:
  - file: 'fonts/Roboto-Medium.ttf'
    id: roboto_med_17
    size: 17

  - file: 'fonts/Roboto-Regular.ttf'
    id: roboto_reg_12
    size: 12

  - file: 'fonts/Roboto-Regular.ttf'
    id: roboto_reg_15
    size: 15

  - file: 'fonts/Roboto-Regular.ttf'
    id: roboto_reg_20
    size: 20
    glyphs:
      ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
       'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
       'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e',
       'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
       't', 'u', 'v', 'w', 'x', 'y', 'z', 'å', 'ä', 'ö', 'à', 'è', 'ì', 'ò', 
       'ù']

  - file: 'fonts/Roboto-Bold.ttf'
    id: roboto_bold_27
    size: 27
    glyphs:
      ['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
       '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
       'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
       'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
       'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
       'u', 'v', 'w', 'x', 'y', 'z','å', 'ä', 'ö', '/','º','µ','³']

  - file: 'fonts/Roboto-Bold.ttf'
    id: roboto_bold_35
    size: 35
    glyphs:
      ['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
       '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
       'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
       'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
       'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
       'u', 'v', 'w', 'x', 'y', 'z','å', 'ä', 'ö', '/','º','µ','³']

  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: weather_font_80
    size: 80
    glyphs: [
      # Weather
      "\U000F0590", # mdi-weather-cloudy
      "\U000F0594", # mdi-weather-night
      "\U000F0591", # mdi-weather-fog
      "\U000F0592", # mdi-weather-hail
      "\U000F0593", # mdi-weather-lightning
      "\U000F067E", # mdi-weather-lightning-rainy
      "\U000F0595", # mdi-weather-partly-cloudy
      "\U000F0596", # mdi-weather-pouring
      "\U000F0597", # mdi-weather-rainy
      "\U000F0598", # mdi-weather-snowy
      "\U000F067F", # mdi-weather-snowy-rainy
      "\U000F0599", # mdi-weather-sunny
      "\U000F059B", # mdi-weather-sunset-down
      "\U000F059C", # mdi-weather-sunset-up
      "\U000F059D", # mdi-weather-windy
      "\U000F059E", # mdi-weather-windy-variant
      ]

  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: weather_font_40
    size: 40
    glyphs: [
      # Weather
      "\U000F0590", # mdi-weather-cloudy
      "\U000F0594", # mdi-weather-night
      "\U000F0591", # mdi-weather-fog
      "\U000F0592", # mdi-weather-hail
      "\U000F0593", # mdi-weather-lightning
      "\U000F067E", # mdi-weather-lightning-rainy
      "\U000F0595", # mdi-weather-partly-cloudy
      "\U000F0596", # mdi-weather-pouring
      "\U000F0597", # mdi-weather-rainy
      "\U000F0598", # mdi-weather-snowy
      "\U000F067F", # mdi-weather-snowy-rainy
      "\U000F0599", # mdi-weather-sunny
      "\U000F059B", # mdi-weather-sunset-down
      "\U000F059C", # mdi-weather-sunset-up
      "\U000F059D", # mdi-weather-windy
      "\U000F059E", # mdi-weather-windy-variant
      ]

  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: wifi_font_30
    size: 30
    glyphs: [
      # Wifi
      "\U000F092F", # mdi-wifi-strength-outline
      "\U000F091F", # mdi-wifi-strength-1
      "\U000F0922", # mdi-wifi-strength-2
      "\U000F0925", # mdi-wifi-strength-3
      "\U000F0928", # mdi-wifi-strength-4
      ]

  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: weather_font_30
    size: 30
    glyphs: [
      # Sun
      "\U000F059A", # mdi-weather-sunset
      # Moon
      "\U000F0F64", # mdi-moon-new
      "\U000F0F67", # mdi-moon-waxing-crescent
      "\U000F0F61", # mdi-moon-first-quarter
      "\U000F0F68", # mdi-moon-waxing-gibbous
      "\U000F0F62", # mdi-moon-full
      "\U000F0F66", # mdi-moon-waning-gibbous
      "\U000F0F63", # mdi-moon-last-quarter
      "\U000F0F65", # mdi-moon-waning-crescent
      # Rooms
      "\U000F09A0", # mdi-shower
      "\U000F09A1", # mdi-shower-head
      "\U000F04B9", # mdi-sofa
      "\U000F0C99", # mdi-microwave
      "\U000F0FD1", # mdi-bed-king-outline
      "\U000F106E", # mdi-bed-single-outline
      "\U000F0322", # mdi-laptop
      "\U000F07F4", # mdi-television-classic
      ]

      
  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: display_font_30
    size: 30
    glyphs: [
      "\U000F18D6", # mdi-sun-thermometer
      "\U000F1A5F", # mdi-pool-thermometer
      "\U000F0606", # mdi-pool
      "\U000F1A73", # mdi-pv     
      ]

  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: display_font_50
    size: 50
    glyphs: [
      "\U000F18D6", # mdi-sun-thermometer
      "\U000F1A5F", # mdi-pool-thermometer
      "\U000F0606", # mdi-pool
      ]

time:
  - platform: homeassistant
    id: homeassistant_time
    timezone: Europe/Rome
    on_time:
      # Every 1 minutes
      - seconds: 0
        then:
          - component.update: epaperdisplay

sensor:
  - platform: homeassistant
    entity_id: sensor.moon
    id: moon_stato
    internal: true
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    id: wifisignal
    update_interval: 60s
  - platform: homeassistant
    id: temp_aussen
    entity_id: sensor.foxess_ambient_temperature
  - platform: homeassistant
    id: pv_anlage
    entity_id: sensor.foxess_solar_power
  - platform: homeassistant
    id: pool_orp
    entity_id: sensor.wf_192_168_1_156_orp
  - platform: homeassistant
    id: pool_ph
    entity_id: sensor.wf_192_168_1_156_ph


text_sensor:
  - platform: homeassistant
    id: moon_icon
    entity_id: sensor.moon
   


spi:
  clk_pin: 14
  mosi_pin: 13  #DIN

display:
  - platform: waveshare_epaper
    id: epaperdisplay
    cs_pin: 15
    dc_pin: 12
    update_interval: 120s
    busy_pin: 16
    reset_pin: 4
    model: 4.20in
    lambda: |-
      /* V Linie */ 
      it.line(120, 0, 120, 300);

      /* H Linie */ 
      it.line(120, 75, 400, 75);
      it.line(0, 150, 400, 150);
      it.line(120, 225, 400, 225);



      /* Uhr */ 
      it.strftime(60, 40 , id(roboto_bold_35), TextAlign::BASELINE_CENTER , "%H:%M", id(homeassistant_time).now());

      /* Aussentemperatur */
      it.printf(155,55, id(display_font_50), TextAlign::BASELINE_CENTER, "\U000F18D6");
      it.printf(240,45, id(roboto_bold_27), TextAlign::BASELINE_CENTER, "%.1f°C", id(temp_aussen).state);

      /* Wassertemperatur */
      it.printf(155,130, id(display_font_50), TextAlign::BASELINE_CENTER, "\U000F1A5F");
      it.printf(240,125, id(roboto_bold_27), TextAlign::BASELINE_CENTER, "%.1f°C", id(temp_aussen).state);

      /* PH */
      it.printf(155,205, id(display_font_50), TextAlign::BASELINE_CENTER, "\U000F0606");
      it.printf(155,220, id(roboto_reg_15), TextAlign::BASELINE_CENTER, "PH");
      it.printf(240,200, id(roboto_bold_27), TextAlign::BASELINE_CENTER, "%.1f", id(pool_ph).state);

      /* ORP */
      it.printf(155,280, id(display_font_50), TextAlign::BASELINE_CENTER, "\U000F0606");
      it.printf(155,295, id(roboto_reg_15), TextAlign::BASELINE_CENTER, "ORP");
      it.printf(240,275, id(roboto_bold_27), TextAlign::BASELINE_CENTER, "%.1fmV", id(pool_orp).state);

      /* PV */
      it.printf(20,120, id(display_font_30), TextAlign::BASELINE_CENTER, "\U000F1A73");
      it.printf(75,120, id(roboto_bold_27), TextAlign::BASELINE_CENTER, "%.1fkw", id(pv_anlage).state);


      /* WIFI SIGNAL */ 
      if(id(wifisignal).has_state()) {
        int wifi_x = 60;
        int wifi_y = 80;
        if (id(wifisignal).state >= -50) {
          // Excellent
          it.print(wifi_x, wifi_y, id(wifi_font_30), TextAlign::BASELINE_CENTER, "\U000F0928");
          ESP_LOGI("WiFi", "Exellent");
        } else if (id(wifisignal).state  >= -60) {
          // Good
          it.print(wifi_x, wifi_y, id(wifi_font_30), TextAlign::BASELINE_CENTER, "\U000F0925");
          ESP_LOGI("WiFi", "Good");
        } else if (id(wifisignal).state  >= -75) {
          // Fair
          it.print(wifi_x, wifi_y, id(wifi_font_30), TextAlign::BASELINE_CENTER, "\U000F0922");
          ESP_LOGI("WiFi", "Fair");
        } else if (id(wifisignal).state  >= -100) {
          // Weak
          it.print(wifi_x, wifi_y, id(wifi_font_30), TextAlign::BASELINE_CENTER, "\U000F091F");
          ESP_LOGI("WiFi", "Weak");
        } else {
          // Unlikely working signal
          it.print(wifi_x, wifi_y, id(wifi_font_30), TextAlign::BASELINE_CENTER, "\U000F092F");
          ESP_LOGI("WiFi", "Unlikely");
        }
        }

Network issues interrupted the transfer.

Could also be that the ESP is crashing (low memory? memory access violation). It’s happened so me when I put stupid code in my sketches haha.

I have the same error

Logger: aioesphomeapi.connection
Source: runner.py:186
First occurred: 09:52:25 (29 occurrences)
Last logged: 13:09:48

plafond-slaapkamer @ 192.168.180.136: Connection error occurred: plafond-slaapkamer @ 192.168.180.136: EOF received
bulb-kamer-voor @ 192.168.180.173: Connection error occurred: bulb-kamer-voor @ 192.168.180.173: EOF received
bulb-kamer-achter @ 192.168.180.137: Connection error occurred: bulb-kamer-achter @ 192.168.180.137: EOF received
s0tool-watermeter @ 192.168.180.220: Connection error occurred: s0tool-watermeter @ 192.168.180.220: EOF received

but from what I check it’s related to the esphome connection with HA.
3 of these devices are LibreTiny(beta) devices, and there is a really long delay when I change the light status in HA. while using the webinterface the acction always is instant. If it was a network issue I would assume the webinterface also to have issues but it doesn’t.

The last device is a watermeter which I updated most recently.

It could still be network, but would that explain why the webinterface shows no issues?

Out of RAM crashes in the ESP often causes these issues. Webinterface consumes a ton of memory in the ESP.

Attach a serial console and watch the logs. Correlate the disconnect you see in HA with what is displayed on the serial console at the time. If you don’t get anything useful increase the logger: level to VERY_VERBOSE and try again

1 Like