WTH Poor CPU after Template Entities reload

Noticed my processor_use_percentage increases each time I reload the Template Entities in YAML configuration reloading. This started a few weeks back. I now need to perform a full system reboot when editing value templates. Normal processor use is 2% but can increase up to 8% per reload. Is it just me?

Do you have your terminology corret here?

Do you really need to reboot the host machine rather than restarting Home Assistant?

Good point to clarify this. Unfortunately, yes I need to reboot every time. The percentage use doesn’t go back to 2%ish until I do a full reboot. Restart no longer helps after each yaml edit.

That is very odd behaviour. All integrations (including templates) are restarted when you restart Home Assistant. Only add-ons and other containers keep running unless you reboot.

I’ll leave this for the more experienced and developers to help you with.

If you don’t get any traction here I’d highly recommend opening an issue on GitHub with lots of logs.

Thanks @tom_l

Bit more information.
I’ve suspected for a while that this might be an issue with Studio Code Server, or at least in part. A while back I noticed a load of errors in Studio Code Server due to the change with automation naming conventions (Triggers to Actions etc.). Over the last 2 weeks I’ve been working through all automations/scenes/scripts… to update to the latest config. I opened everyone, made a small change, undid the change and saved so it would update with the correct labels in YAML. This has reduced the issue with processor use but it’s not completely fixed it. Previously it could jump by more than 10% after each Restart or Update Entities but now it’s between 4-8%.

Below is the data for the last 24 hours.
Yesterday I performed a full reboot after each YAML update and you can see the % drop back to less than 4% each time. This morning (since 06:20) I’ve made some very small changes in YAML and used either the Update Entities or Restart and the % is increasing each time. This won’t return to its previous state unless I do a full reboot.

You could prove this by restarting the add-on instead of rebooting next time.

Thanks @tom_l, it never occurred to me.

Just restarted Studio Server Code and it’s dropped the % back to normal.

1 Like

Not sure if it is related:
sometimes python3 causes a huge CPU load (according to “top”); stopping a HA container does not help → have to reboot a host.

Since @tom_l mentioned restarting the Studio Code Server add-on I’ve been able to avoid rebooting Home Assistant. I now use the standard reload of Template Entities after each YAML edit and then head straight over to the Studio Code Server add-on and restart it. I can see the Add-on CPU and RAM usage up a bit but it goes back to 0-1% after a restart and stays that way. Works like this every time.

Just made a small change to a value_template so I can share what happens.

Before opening Studio Code Server the Add-on has CPU usage of 0% and RAM usage of 0.8%.
I made some very small changes to 2 value_templates (changed times only) and the Add-on usage % went up as below.


A few minutes later it is as follows and I’ve not updated the YAML at this point.

I reloaded the template entities and there Add-on CPU & RAM remained unchanged.
I then went back to the value_template to make another small change. This increase the RAM % of the Add-on again.

I repeated a third time and again the CPU & RAM % increased.

Finally I restarted the Add-on and everything calmed down.