[SOLVED] ESP32S2 ESPHome not in HA available anymore

I have an ESP32S2 mini (wemos.cc) with ESPhome 2024.6.4 firmware on it, with this part of config :

esp32:
  board: lolin_s2_mini
  framework:
    type: esp-idf

USB as well as OTA are working. When using OTA, I get:

INFO Resolving IP address of espfridge.local
INFO → 192.168.0.15
INFO Uploading .esphome/build/espfridge/.pioenvs/espfridge/firmware.bin (799488 bytes)
Uploading: [============================================================] 100% Done…
INFO Upload took 6.38 seconds, waiting for result…
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from espfridge.local using esphome API
WARNING Can’t connect to ESPHome API for espfridge.local: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address=‘192.168.0.15’, port=6053))]: [Errno 113] Connect call failed (‘192.168.0.15’, 6053) (SocketAPIError)

Here, it gets stuck.

ESP is also not visible in Home assistant anymore. Entities (that worked before) are shown as “unavailable”.

From my Linux client, I can successfully PING 192.168.0.15.

What is wrong? As I can OTA updates, the Wifi connection of the ESP and the API credentials should be okay, right?

Also

esphome clean xxxxx.yaml

did not help and leads to the same result.

Did you change the IP address of the esp?

No. As you can see: 192.168.0.15 was and is the IP. ping works as well as OTA IP discovery.

Please show the full yaml

Does ping work when the device is disconnected from power?

If all fails then try to connect a series al adapter to the rx, TX and gnd pins and see the output directly from the device.

Solved:

I had some checks with I2C before. But after it didn’t work out as expected, I disconnected the I2C from the two pins, but let the config there.
After deleting (commenting out) the following lines, I was able to reach it via API again,

i2c:
  sda: GPIO16
  scl: GPIO18
  scan: true
  frequency: 10kHz
  id: i2cbus

It seems that the esphome code is not very robust in the case that I2C is configured, but no I2C bus is connected.

Thanks for your support anyhow!

interestingly, with


 i2c:
   sda: GPIO16
   scl: GPIO18
   scan: true
   frequency: 50kHz
   id: i2cbus

it works, even without connecting the I2C bus.
I read something about ESP IDF and different I2C frequencies generating some trouble: SHT3xD failed communication when I2C frequency >50-100kHz using esp-idf but works well over this frequency with arduino framework · Issue #5303 · esphome/issues · GitHub Maybe this is related…