Issue with ESP32 disconnecting from Home Assistant API after 20 secs

Hi All, I started getting the following error message on my ESP32 devices in the log on ESPHome.

WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.xx.125:6053 (192.168.xx.125)

I noticed that in the logbook my entities we going to unavailable the would restore to their correct state and then unavailable again 20sec after the reconnection.

I have tried taking my code back to a basic setting to try remove the problem but it still exists with a minimal yaml.

substitutions:
  room: "control"
  loc: "panel"
  upper_room: "Control"
  upper_loc: "Panel"
  terminal01: "front_porch_pir"
  terminal02: "bedroom1_pir"
  terminal03: "hallway2_pir"
  terminal04: "backroom_pir"
  terminal05: ""
  terminal06: ""
  terminal07: ""
  terminal08: ""
  terminal09: ""
  terminal10: "lounge1_pir"
  terminal11: "hallway1_pir"
  terminal12: "relay_1"
  terminal13: "relay_2"
  terminal14: "alarm_siren"
  terminal15: "alarm_strobe"
  
esphome:
  name: "${room}_${loc}"
  platform: ESP32
  board: nodemcu-32s

wifi:
  ssid: "abcdefghij"
  password: "0123456789"

#   # Enable fallback hotspot (captive portal) in case wifi connection fails
#   ap:
#     ssid: "Control Panel Fallback Hotspot"
#     password: "0123456789"

  manual_ip:
    static_ip: 192.168.xx.125
    gateway: 192.168.xx.1
    subnet: 255.255.255.0
  fast_connect: true

# #captive_portal:

# # Enable logging
logger:
  level: VERBOSE




# # Enable Home Assistant API
api:

ota:

any suggestions on how i can fix it?
It seemed to start last night for no apparent reason and when it drops out from home assistant it does not appear to drop off my wifi.

Thanks heaps for any assistance.

Ben

I was able to roll back to a snapshot with ESPHome 1.15.1 on it and now my ESP32 devices are working again. It appears there may be an issue with ESPHOME 1.15.2 and ESP32 devices.

This whole process would be alot easier if you could choose what version of ESPHome you wish to install. Is it possible? I tried esphome_version: 1.14.3 in the configuration, but it says it is unable to install a pinned version. (or something similar)

When you change the version in the config, it takes a while to install as it has to download all the libraries etc.

What does the ESPHome look like for the first restart after doing esphome_version? This is my log after a rollback to 1.14.3:

Successfully installed PyYAML-5.1.2 colorlog-4.0.2 esphome-1.14.3 esptool-2.7 idna-2.10 ifaddr-0.1.6 paho-mqtt-1.4.0 platformio-4.0.3 protobuf-3.10.0 pytz-2019.3 setuptools-50.3.0 six-1.15.0 tornado-5.1.1 tzlocal-2.0.0
[cont-init.d] 30-esphome.sh: exited 0.
[cont-init.d] 40-migrate.sh: executing... 
[cont-init.d] 40-migrate.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.

Supervisor will still say you are running 1.15.2, ignore that, you will use 1.14.3 to compile code.

After your post I had another look at it and was able to do a rollback to v1.15.1.

I had left out the ā€œvā€ at the beginning.

V1.15.1 seems to be stable still for me. The issue appears to definitely related to v1.15.2. as i still had the old VM, started it up and rolled back in it and the issue disappeared.