ESPhome freezes during compile

I use the systemmonitor integration:

- platform: systemmonitor
    - type: disk_use_percent
      arg: /
    - type: memory_use_percent
    - type: processor_use
    - type: memory_free
    - type: load_1m
    - type: load_5m
    - type: load_15m
    - type: last_boot
1 Like

I finally broke down and did the upgrade… it wasn’t too expensive either. I upgraded my router a few days ago, from:


So, the 4-port version was freed up. I decided to put an installation of Ubuntu on there and host a supervisor docker for HassIO. I’m amazed at how simple the transition was: the snapshot functionality is AMAZING. I did a full snapshot from the Pi, shut it down, renamed the new host to replace the old and launched the “Wipe & Restore” option with it on the new installation and voila! Everything worked (except for samba because the eth0 changed to enp2s0).

The results are fantastic! The green marks below the charts are where I made the transition:

This thing has 8GB of ram so the swap sits at zero, now. :stuck_out_tongue:

Looking at the cpu/memory/swap usage percentage chart, you can see that the Raspberry Pi 3b+ was memory limited previously, with the ram full, the CPU apparently was constantly waiting on swap IO so cpu percentage maxed out at about 50% utilization before. Now that I don’t have that problem, the CPU can spend much more time crunching important things and not stalling. Also, look at the CPU temperatures! I dropped 40° and gained performance. :smiley:

Best of all, I get to re-consolidate my ESPHome installations onto the HassIO device again! :tada:

I want to thank you for the memory and swap integrations, I could see that my RPi4 1Gb had only 100 MB of swap and it was all used, after changing to 2 Gb I got no more blocking for 4 days now!!!
So definitely 1 Gb is too small for HA Supervised.

Never had this issue until today as well. When you say “reboot” can you describe what exactly you mean? I’ve been restarting HA, I’ve restarted the core, restarted supervisor, and rebooted the core, restarted ESPhome, not to mentioned power cycled the Pi after it crashes - all with no luck.

I’ve also attempted @sermayoral’s suggestion with no luck either.

Edit: This might help some of you, so I figure I’ll share. I ended up stopping all the other addons that I had running and it seemed to resolve the issue. Obviously the Pi struggles a bit when things have to compete for memory. Not an ideal solution, but I finally got it working.

Yes, this was also my issue. After disabling everything else RPI3b+ managed to compile. But ram was still full. It was a sign to me that I need to upgrade hardware. I wanted to buy RPI4 but at that time ti was not awailable here yet, so I got an old mini pc for good price.

I figured out why my esphome is freezing when compiling. I am running HA on a rpi3 B+ using a usb stick (not an sd card). The usb stick was slowing dying and recently was on it’s last breathe. Changed out the usb stick and I am able to compile from start to finish without any issue.

This also fixed another issue I had where when I restart HA, it does not restart proper and would just hang at lost connection some of the time.

I had this issue on SSD. But anyway, my setup was too big for RPI3b+ at the end anyway :slight_smile:

Same here often it just compiles just fine, but now and then hoem assistant becomes totally unresponsive and i nee dot pull the power plug, which is a no no on a raspi 3 with sd card. I think has to do with the out of the store placement of esphome.

What about the RAM usage before the crash ?
On my previous installation on a Pi 3B+ I would see the RAM filling up to almost 100% just before everything froze.
Add the system monitor integration if you don’t already have.

Same issue

Same Issue, Seems to completely hand the HA server running on the Pi 3B+ during compile or configuration.

Same issue, RPi 3B, it starts compiling but completely hangs after some minutes. I have not pulled the power out of it since it hang 3 hours ago and it does not clear itself, it did accept “free” command from putty but it took 2+ hours to execute… There should be a rule that does not allow compilling to start if device RAM is not capable of it. Always afraid to pull the cord to risk corrupting the SDcard.
The same device is running HA, Mosquitto and Portainer docker containers, without any problems ever.

I will add to this: The RPi did finish compiling, after 7+ hours of being unresponsive. And then returned to normal, HA automations i had going did also work but with the same 2 hour delay that i had with running Putty commands. The RPi did not 100% freeze because my Putty never disconnected from it, being the reason i chose not to pull power cord out of it to end the compiling frozenness. It was more like 99.99% frozen during all those 7+ hours.

Still saying, if your device enters this kind of frozenness, just pull the cord to end it, and keep a full backup of your machine at all times. Just to be safe, dont use a RPi with only 1gig of ram to do the compiling.

Do you not have any other computer?

I do, and i did compile the code again on this computer, and installed it on the D1. Now im wondering how can i do the compiling(alone) separately on another machine and keep the devices listed under the ESPhome dashboard on a different machine, although HA integration keeps them organized anyways without the dashboard.

It would be just so lovely if i could run the ESPhome dashboard and compiler on the same machine that is online 24/7 and has HA on it. Its a management mess.

Oh AND ESPHome dashboard does not seem to work under windows! I guess i could use a virtual linux there. But its again adding to the hassle. Id rather just forward the compiling to be done on another machine and keep the dashboard installation on the RPi.

This is exactly the reason why I upgraded to something more powerful than a Raspberry Pi. I’m rocking 32GB of RAM now and I’ve never had an issue with compiling since! :grin:

I was keeping another instance of ESPHome running on a separate Linux machine for about a year but like you said it is a management mess. Trying to keep two directories in sync is a pain and using the built-in ESPHome ingress is so excellent. Do the upgrade, you won’t be sorry.

P.S. you don’t need 32GB of ram for this to work. I get it for free so I might as well stuff it full. I’m running from a Nuc 10. Bought it Dec 9th 2020… been running HA on there ever since. No hangs.

For me that would be the only reason i NEED to upgrade to anything more powerful (more energy hungry also). Everything else i currently run on my RPi 3b works perfectly fine.

To be fair, it was only a test up to the point when i had a LTS 64bit server Ubuntu, docker, under docker: HA, portainer, grafana, eclipse-mosquitto and ESPHome and the dashboard for it. All of those running with only 58%ish RAM usage being reported by the RPi 3b system. Before the RPi, they were running on an old 2 core Laptop that was sooooo hungry, thank god i dont need run that thing anymore. Only thing i cannot do on the RPi, is the compiling action on ESPHome currently.

I am also thinking of running a pi-hole, or even my unifi controller on the 24/7 computer of mine, both also available in docker. Why im hinking of getting atleast a 4gig RPi 4 to continue ahead with that. But the prices! :expressionless:

yup, was for me too but the benefits that you don’t realize are out there too. Like restarting HA and it happens in seconds. Anyway, I guess you could just forgo using ESPHome if it keeps hanging your system and you really want to stick to a Raspberry Pi. Good luck!

BTW, I still use my old Raspberry Pi’s I turned one of them into a reverse proxy and the other two are redundant piholes for DNS service to my intranet.

Yes, i know, things happened faster on the old laptop of mine, it did also have 8gigs of memory.

But i did a “mistake” of doing too many calculations on what is using energy and how much, and what that does to my wallet. So having that old laptop running 24/7 did cost me 3x the money compared to the RPi. Also that introduced me into the world of having sleep modes enabled in smart devices when possible, having automations controlled accurately and actually moving to led lighting everywhere in the apartment etc, etc. So now i save quite a few bucks compared to how it was back then. Its gonna pay itself back even if i needed to buy new devices.