**ESPHome update 2025.08.02: This little maneuvre will cost you … several days.**
(blog post)
TL;DR
Changing the ESPHome framework from Arduino to ESP-IDF is far from trivial. Don’t attempt it at home, if you’re a Home Assistant / ESPHome hobbyist with a poor C++ knowledge.
Read on…
After the last update of ESPHome, some of my compiled firmware images for my ESP32 boards suddenly became too big to fit in their memory. They said that Arduino libraries became too big and bloated. Yelp, I can’t update them anymore!
They (ESPHome developers) said we should switch from Arduion framework to ESP-IDF anyways, because it’s smaller, optimized and closer to the metal.
They said only a small change in esp configuration yaml is needed:
esp32: board: esp32dev framework: type: arduino # <-- change to esp-idf
And that’s almost1 it!
You wish.
I changed the framework as described above (for one non-critical ESPCam).
I got compile errors (for my lambda functions). But wait, they said everything will work the same, no, even better!
But it looks like there are some differences between Arduino and ESP-IDF framework. For example, there is no String() in esp-idf! Isn’t that a … basic?
Ok, I surrendered and changed my lambda function that returned uptime in human readable format from:
- platform: uptime name: ${devicename} Uptime in Days id: uptime_sensor_days update_interval: 60s on_raw_value: then: - text_sensor.template.publish: id: uptime_human state: !lambda |- int seconds = round(id(uptime_sensor_days).raw_state); int days = seconds / (24 * 3600); seconds = seconds % (24 * 3600); int hours = seconds / 3600; seconds = seconds % 3600; int minutes = seconds / 60; seconds = seconds % 60; return ( (days ? String(days) + "d " : "") + (hours ? String(hours) + "h " : "") + (minutes ? String(minutes) + "m " : "") + (String(seconds) + "s") ).c_str();
Changed the last bold bit (return…) that caused compile errors to:
...std::string result; if (days) result += std::to_string(days) + "d "; if (hours) result += std::to_string(hours) + "h "; if (minutes) result += std::to_string(minutes) + "m "; result += std::to_string(seconds) + "s"; return result;
And then it compiled ok.
It also linked ok and uploaded firmware to my ESPCam.
Ping to my ESPCam worked, but sensors (camera web server, uptime, led switch,…) were unavailable.
ESPHome log returned only the following info:
changed lambda. log returns: Uploading: [============================================================] 100% Done... INFO Upload took 6.12 seconds, waiting for result... INFO OTA successful INFO Successfully uploaded program. INFO Starting log output from 192.168.0.15 using esphome API INFO Successfully resolved esp32-cam01 @ 192.168.0.15 in 0.000s INFO Trying to connect to esp32-cam01 @ 192.168.0.15 in the background INFO Successfully resolved esp32-cam01 @ 192.168.0.15 in 0.000s INFO Successfully resolved esp32-cam01 @ 192.168.0.15 in 0.001s INFO Successfully resolved esp32-cam01 @ 192.168.0.15 in 0.000s INFO Successfully resolved esp32-cam01 @ 192.168.0.15 in 0.000s INFO Successfully resolved esp32-cam01 @ 192.168.0.15 in 0.000s
The connection to ESPCam looks ok.
But it wouldn’t connect to ESPHome API:
WARNING Can't connect to ESPHome API for esp32-cam01 @ 192.168.0.15: 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 111] Connect call failed ('192.168.0.15', 6053) (SocketAPIError)
I really wasn’t in the mood to research what went wrong and which part of my ESPCam configuration code is not compatible with ESP-IDF.
So I ditched esp-idf framework, reverted it back to arduino, recompiled, uploaded and my espcam works again.
Yes, I’ve searched for possible solutions2, but couldn’t find any that I could use.
My other ESP32 board (the one that has suddenly too big firmware after ESPHome update) will obviously stay in un-updated state for the rest of it’s life. I don’t wan’t to deal with breaking changes, modifying the code, re-learning C++ just to make it work again.
And this little maneuver caused me few days. Don’t go the same path.
Or, if the framework change works for you, please let me know.
Or, maybe I’ll try again when the issues3 are resolved.
- Official guide says: … Component Compatibility: Some components may need to be replaced with ESP-IDF compatible alternatives (<— WHICH ONES???)
Library Differences: Arduino-specific libraries won’t be available (<— WHICH ONES???) ↩︎ - Of course I checked the official guide: https://esphome.io/guides/esp32_arduino_to_idf/. When I read I should go to their Discord for help, I just gave up. ↩︎
- https://github.com/esphome/esphome/issues ↩︎
https://blog.rozman.info/esphome-update-2025-08-02-this-little-maneuvre-will-cost-you-several-days/
#arduino #espIdf #espcam #ESPHome #homeassistant #lambda