New ESP Home Devices show "HANDSHAKESTATE_READ_FAILED errno=11" Error

Hi. recently i ran into an ESP Home issue for wich rather me not others in german forums found any solution for it. I am not the only one with this issue, so hopefully this gets recognised.

  • No matter what ESP Board i/we install via ESP Home (OTA or manual), we always get the “HANDSHAKESTATE_READ_FAILED errno=11”.
  • Two People, including me had this issue after replacing the Networkrouter.
  • Devices show up for configuration in HA Integrations, but sensors deliver “unknown” values
  • All our older ESP-Home Projects work still fine, even after updating them. Only new Projects are affected.
  • What i tried so far: Fixed IPs via ESP config/Router. Different Boards, HA Reboot, VM Reboot, different methods of installing ESP-Device (legacy, ota, web,…), stopped/reactivated ESP Home

At this current state, ESP Home is unusable for me. Someone solved it with a fresh HA install. no solution for me, since i will loose month of config work :confused:

INFO ESPHome 2023.6.3
INFO Reading configuration /config/esphome/tankfullstand-esp2.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing tankfullstand-esp2 (board: esp01_1m; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 1.2.3
|-- ESPAsyncWebServer-esphome @ 2.1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/api/api_connection.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/api/api_frame_helper.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/api/api_pb2.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/api/api_pb2_service.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/api/api_server.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/api/list_entities.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/api/proto.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/api/subscribe_state.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/api/user_services.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/captive_portal/captive_portal.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/esp8266/core.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/esp8266/gpio.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/esp8266/preferences.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/gpio/switch/gpio_switch.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/logger/logger.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/md5/md5.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/mdns/mdns_component.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/mdns/mdns_esp32.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/mdns/mdns_esp8266.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/mdns/mdns_host.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/mdns/mdns_rp2040.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/network/util.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/ota/ota_backend_arduino_esp32.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/ota/ota_backend_arduino_esp8266.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/ota/ota_backend_arduino_rp2040.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/ota/ota_backend_esp_idf.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/ota/ota_component.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/socket/bsd_sockets_impl.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/socket/lwip_raw_tcp_impl.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/socket/socket.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/switch/automation.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/switch/switch.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/web_server_base/web_server_base.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/wifi/wifi_component.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/wifi/wifi_component_esp32_arduino.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/wifi/wifi_component_esp8266.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/wifi/wifi_component_esp_idf.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/components/wifi/wifi_component_pico_w.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/core/application.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/core/component.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/core/component_iterator.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/core/controller.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/core/entity_base.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/core/helpers.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/core/log.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/core/scheduler.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/core/string_ref.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/esphome/core/util.cpp.o
Compiling /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/src/main.cpp.o
Linking /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/firmware.elf
RAM:   [====      ]  41.7% (used 34188 bytes from 81920 bytes)
Flash: [=====     ]  47.7% (used 488869 bytes from 1023984 bytes)
Building /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/firmware.bin
esp8266_copy_factory_bin(["/data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/firmware.bin"], ["/data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/firmware.elf"])
======================== [SUCCESS] Took 119.04 seconds ========================
INFO Successfully compiled program.
INFO Resolving IP address of tankfullstand-esp2.local
INFO  -> 192.168.178.49
INFO Uploading /data/tankfullstand-esp2/.pioenvs/tankfullstand-esp2/firmware.bin (493024 bytes)
INFO Compressed to 346058 bytes
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from tankfullstand-esp2.local using esphome API
WARNING Can't connect to ESPHome API for tankfullstand-esp2.local: Error resolving IP address: [Errno -5] No address associated with hostname
INFO Trying to connect to tankfullstand-esp2.local in the background
INFO Successfully connected to tankfullstand-esp2.local
[18:05:14][I][app:102]: ESPHome version 2023.6.3 compiled on Jul  2 2023, 18:04:33
[18:05:14][C][wifi:543]: WiFi:
[18:05:14][C][wifi:379]:   Local MAC: 5C:CF:7F:D3:6F:5F
[18:05:14][C][wifi:380]:   SSID: [redacted]
[18:05:14][C][wifi:381]:   IP Address: 192.168.178.49
[18:05:14][C][wifi:382]:   BSSID: [redacted]
[18:05:14][C][wifi:384]:   Hostname: 'tankfullstand-esp2'
[18:05:14][C][wifi:386]:   Signal strength: -61 dB ▂▄▆█
[18:05:14][C][wifi:390]:   Channel: 7
[18:05:14][C][wifi:391]:   Subnet: 255.255.255.0
[18:05:14][C][wifi:392]:   Gateway: 192.168.178.1
[18:05:14][C][wifi:393]:   DNS1: 192.168.178.1
[18:05:14][C][wifi:394]:   DNS2: 0.0.0.0
[18:05:14][C][logger:301]: Logger:
[18:05:14][C][logger:302]:   Level: DEBUG
[18:05:14][C][logger:303]:   Log Baud Rate: 115200
[18:05:14][C][logger:305]:   Hardware UART: UART0
[18:05:14][C][switch.gpio:068]: GPIO Switch 'RelayGPIO16'
[18:05:14][C][switch.gpio:090]:   Restore Mode: always OFF
[18:05:14][C][switch.gpio:031]:   Pin: GPIO16
[18:05:14][C][captive_portal:088]: Captive Portal:
[18:05:14][C][mdns:108]: mDNS:
[18:05:14][C][mdns:109]:   Hostname: tankfullstand-esp2
[18:05:14][C][ota:093]: Over-The-Air Updates:
[18:05:14][C][ota:094]:   Address: tankfullstand-esp2.local:8266
[18:05:14][C][ota:097]:   Using Password.
[18:05:14][C][api:138]: API Server:
[18:05:14][C][api:139]:   Address: tankfullstand-esp2.local:6053
[18:05:14][C][api:141]:   Using noise encryption: YES
[18:05:50][D][api:102]: Accepted 192.168.178.200
[18:05:50][W][api.connection:083]: 192.168.178.200: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[18:06:50][D][api:102]: Accepted 192.168.178.200
[18:06:50][W][api.connection:083]: 192.168.178.200: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[18:07:50][D][api:102]: Accepted 192.168.178.200
[18:07:50][W][api.connection:083]: 192.168.178.200: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[18:08:50][D][api:102]: Accepted 192.168.178.200
[18:08:50][W][api.connection:083]: 192.168.178.200: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[18:09:50][D][api:102]: Accepted 192.168.178.200
[18:09:50][W][api.connection:083]: 192.168.178.200: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11

I managed to get rid of the error.
I did not intsall the ESP directly with my own ESP Home program via legacy format, but first installed it via this web interface with this “standard ESP program”. Then it appears in the integrations via Autodiscover. Also in ESP Home, where you can “adopt” it. The encryption key exchange seems to work through autodiscover (again?). After adopting, I installed my own program via OTA.

I also manually deleted the YAML file of the “old, broken” configuration via WinSCP before the new integration.

Whether it was because of one or the other I don’t know yet, but it’s working.
Thanks again for the help