Home assistant with 100% cpu load

Hello.

From time to time i see my home assistant which I run on raspberry pi 400 start too slow and show cpu with 100% loads. Can someone tell me how to handle this?

It is a home assistant supervisor-2021.03.6 which installed on raspberry pi 4. When I login by ssh and run docker stats i see homeassistant container user 100% cpu
Normal case


100% cpu case


some guys try use py-spy package which show more details of python loads. I did that. Can someone tell me how to fix it?

What is that _worker do and how come it can be 900% cpu load?
Duke

After the research I found out what one of my yeelight lamps doesn’t work correct and when I use control it over lan make those cpu loads. I do not know why. After I update firmware on that lamp it start work correctly.

About py-spy package. It show strange and not real numbers. Do not use it debug.

Be careful updating Yeelight firmware,

Yeelight’s latest firmware disables local control at the request of Xiaomi as it’s a “risk”, rendering Home Assistant unable to communicate with these devices. Please see this summary of the issue for more information. Please see this discussion on our community forums for a possible alternative solution of installing ESPHome onto your device to allow local control permanently.