I had similar with my RasPi 4 HA OS installation. I also have LocalTuya, Rhasspy voice assistant and node-RED add-ons.
TL;DR - I believe that with these add-ons, network messages were not always being processed before the next one arrived and resulting in errors snowballing till the system couldn’t respond at all.
–
Normally HA would run at around 3% CPU use - but would sometimes climb to 26% at which point it wouldn’t even react to the HA [restart] button. The HA core log was full, with some errors reported over ten thousand times.
Looking at the early part of the log, it looked like devices were dropping of my LAN, and as the errors got more frequent they seemed to result in other errors as well … until it hit critical mass. To fix I had to reboot (often by pulling the power) usually 3 times, which I guess was to clear the backlog of network errors.
Some of the errors referred to Ingress, and I remembered forum comments about SD cards failing because of all the HA database updates. Swapping to a SSD helped some, but didn’t fix the problem.
Since most of the devices were on wi-fi I guessed that I had gone over my Access Point’s limit and some devices were being dropped from the WLAN - so I purchased a Draytek WAP. This provided a lot more debugging info, but didn’t fix the problem, and since I couldn’t justify cost of DrayTek’s better unit I swapped to a ASUS router to use as AP only. While less frequent, the problem has remained.
I have finally upgraded to a second-hand OptiPlex 7050 PC with i5 CPU, and haven’t had the problem show for … okay, it’s only been 5 days now, so hardly conclusive. I am still getting occasional device not found errors despite them still being on the network.
I suspect the problem is that my add-ons are all using the network; and that as i added more devices and HA add-ons the RasPi’s network handling has become the bottleneck. I don’t know if the underlying problem is still the physical Wi-fi (increased latency due to interference and neighbours networks), that there are too many devices (and so messages) on the network (highly unlikely), or that the comms routines of HA, LocalTuya, node-RED and Rhasspy (MQTT messages) are not playing nicely together. Unfortunately I have become dependant on these add-ons.