Installing yaml code to ESP32

Hi, when compiling/flashing esp32 nodes I experience very long compile time after upgrading HA to 2025.10.3. it recompiles files for more than 30minutes!
This did not happen before I upgraded, any one having any idea about this?

Perhaps related to this?

1 Like

I also feel like compiling takes significantly longer than before, and that even after minor changes, many files are unnecessarily recompiled, but I’ve never measured the times (but never 30 Minutes, on my Raspi4 the time maybe increased from 5 to 10 Minutes).
It feels like it’s been getting slower for quite some time, and now there’s another significant jump (although I also have more and more devices that need to be recompiled, which is certainly having a negative impact on my experience).

Agreed… with pretty much each (major) esphome update compiling is slower, especially for esp32. I also have the feeling that even for small changes many times epshome does full recompile now, which didn’t happen before (a while ago).

Yes, it was in the documentation. It will take longer to complile but ESPs will use less memory on the devices and other improvements.

1 Like

On my core2 duo 2012 vintage machine it’s always taken 12-15 minutes per device…

Update… just now moved to the latest from the prior on my 4 devices. Almost exactly 40 minutes, so I would say less than the 12-15 it used to take…

I know it doesn’t help but I don’t think I’ve seen a significant rise in compile times. I run my HAOS as a VM admittedly on a fairly new i5 host with two cores and 8mb memory assigned and the larger ESPHome projects with LVGL only take 4 minutes for a fresh compile, tested today.

Do we have to accept that as time passes we need to modernise our hardware? I can understand the desire to sweat assets but personally I think I’d give up if a compile took longer than 10 minutes. I think the longest ever for me was around 6 minutes for some of the NSPanel stuff.

I’m currently trying unsuccessfully to get Speech-To-Phrase to work, and I have to wait forever for every small parameter change. It’s really driving me crazy. I haven’t been able to reliably figure out what causes a complete recompilation. Sometimes I just change one parameter of the speaker or media player, and everything recompiles…

Move your esphome builder to a PC/laptop.

1 Like

I’ve already thought about that, but first I have to figure out how to do it. My Home Assistant runs on a RaspPi 4 with 8GB of memory. I set everything up according to a complete guide from the internet (without any Rasp Pi or Linux knowledge). The installation stuff on the PC would be the next big project I’d have to deal with (and probably create new problems)…

It’s really simple.

Once you do this you’ll wonder why you ever bothered trying to compile ESPHome devices within your production HA system.

3 Likes

Wow, that was really easy and compiles the YAML files super fast. Thank you very much.
Do you know how to configure the default source directory for ESPHome on the PC? I’d like to have all my YAML files in one project folder, not just on "D:"?

I have all my ESPHome YAML files in their own directory.

I just CD to it and issue my compile and run commands from there. It would never occur to me to put them in the root of any drive.

Today, I created a new version for my ESP8266 on the patio using the ESPHome version installed on my PC. Problem: After installing the PC version, an error message appears in the ESPHome log from the device (not during compiling):

ERROR Exception in callback _ProactorReadPipeTransport._loop_reading(<_OverlappedF…ed result=941>)
handle: <Handle _ProactorReadPipeTransport._loop_reading(<_OverlappedF…ed result=941>)>
Traceback (most recent call last):
File “C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\asyncio\events.py”, line 80, in _run
self._context.run(self._callback, *self._args)
File “C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py”, line 324, in _loop_reading
self._data_received(data, length)
File “C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py”, line 274, in _data_received
self._protocol.data_received(data)
File “aioesphomeapi/_frame_helper/noise.py”, line 112, in aioesphomeapi._frame_helper.noise.APINoiseFrameHelper.data_received
File “aioesphomeapi/_frame_helper/noise.py”, line 148, in aioesphomeapi._frame_helper.noise.APINoiseFrameHelper.data_received
File “aioesphomeapi/_frame_helper/noise.py”, line 335, in aioesphomeapi._frame_helper.noise.APINoiseFrameHelper._handle_frame
File “aioesphomeapi/connection.py”, line 1033, in aioesphomeapi.connection.APIConnection.process_packet
File “C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\esphome\components\api\client.py”, line 70, in on_log
print(parsed_msg.replace(“\033”, “\033”) if dashboard else parsed_msg)
File “C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\colorama\ansitowin32.py”, line 47, in write
self.__convertor.write(text)
File “C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\colorama\ansitowin32.py”, line 177, in write
self.write_and_convert(text)
File “C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\colorama\ansitowin32.py”, line 205, in write_and_convert
self.write_plain_text(text, cursor, len(text))
File “C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\colorama\ansitowin32.py”, line 210, in write_plain_text
self.wrapped.write(text[start:end])
File “C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1252.py”, line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: ‘charmap’ codec can’t encode characters in position 75-77: character maps to

If the same YAML file was compiled on the Rasp Pi, this error does not occur. The two .bin files are also slightly different in length (PC = 559,088 bytes versus Rasp Pi = 559,072 bytes).
How can I fix this?

Same version of ESPHome on both machines (the add-on, and the command line)?

The other thing I’ve seen is that the various components and libraries get out of sync. I’ve had to go as far as un-installing and re-installing Python, Pip, and ESPHome on my laptop. This usually shows up as errors or warnings in the compile, not on the device, but I can certainly see where that can happen. Review the compile output carefully to see if there are any warnings about package version numbers and such.