Debugging CPU usage

I’ve been running Home Assistant via for a few months now and am loving it. I’ve got tons of sensors, MQTT switches, and other things configured and everything works fine. Except for the CPU usage.

I’ve noticed that after some hours (haven’t yet figured out if there is a clear pattern), the CPU usage of the main homeassistant python process (/usr/local/bin/python3 -m homeassistant --config /config) goes to 100% inside the container.
Before it goes into this berzerk and mad CPU mode, the process idles at 0% - 1% with just momentarily going to ~20%.
Load average keeps at around 1.
I haven’t configured any timers or automation that would explain why at times it can run for hours without issues.

Everything else works normally, there is nothing unusual in the logs and everything works just fine. It is just that the CPU usage goes to 100% and keeps there until the container is restarted. This wouldn’t really even be an issue, but the extra heat generated by this is a bit hard to handle with my setup.

Python isn’t my strongest language, so I have no idea where to start debugging this. Any ideas?

did you find any solution? I have the same issue and have no idea how to fix it…

Thank you!