Home Assistant Responding Too Slow

I recently got my raspberry pi 3 B+ model a month ago and I installed the home assistant platform on it a few weeks ago. I am using a 32 GB sd card. But recently my home assistant has been running really slow it takes 5-10 minutes for home assistant to restart and whenever I turn on a switch it turns on like 30 seconds after I press the button on my front-end. I read some of the topics and I deleted the home-assistant_v2.db file and it is less than 1mb therefore I don’t think there is any problem there. I even checked the logs and they didn’t have any warnings that should have caused this problem. My Raspberry Pi3 is also fully upgraded and I have the latest home assistant software which is 0.73.1 What can I do to solve my problem of extremely slow hassbian.

There are a few debugging tools available in linux that may help.

top

this command shows a table of processes and how much cpu and memory they are taking up. q to exit!

dmesg

Shows the kernel log, if there are SD card problems, they should be revealed there.

1 Like

Thank You @nickrout. Those commands helped me find information about the cpu and memory. I kept track of it for some time and the highest for cpu % was 2.3% and highest for memory % was 6.3%. I am new to all this therefore I am not sure if that is normal. Could you tell me if that is normal or not? Also, I did not find any notable problems when I ran the second command (dmesg). Do you have any other suggestions to solve the problem.

At the top of the top output, it also shows load average. What are those numbers showing. Actually you can get this quite simply using

uptime

Also, have you restarted home assistant after deleting the database file?

@nickrout. I restarted home assistant as well as rebooted my pi after deleting the database but it wasn’t that large to begin with just 30mb and now it is less than 1mb. Also, after I entered uptime on linux this is what it showed me

13:18:14 up  1:56,  1 user,  load average: 0.01, 0.01, 0.00

load average looks fine

@nickrout So do you have and suggestions on what I can do to troubleshoot?

iotop may show something.

Just guessing, do you have a good power supply?

Yes @gieljnssns . The problem did not occur when I was using raspbian with my pi. I think the problem might be with hassbian since the pi was working fine before I installed hassbian and the problem just started occuring a few weeks ago.

I have a 2.5A Power Supply Module that I bought along with my raspberrypi3. It is by Canakit.

@Dishant
Just to be sure, read this topic
https://www.raspberrypi.org/forums/viewtopic.php?t=183495

@Dishant
To exclude PSU problems, you Can try this
Raspberry Pi Power Sensor (updated: 2018-07-25) / Use Github for reports in the future

@gieljnssns. Thanks for the help on the PSU. I will try and install this tonight but I doubt that the slow restart is occurring due to PSU problem. Nevertheless, I will install this and observe to see any significant changes. I will let you know if this works. Thank You again!

Did you ever resolve this issue?

Yes I was able to resolve this issue. The problem was with the discovery component in my configuration.yaml. So, I removed the discovery component and now HA is working normally.

1 Like

Thanks mate, I sorted it in the end. Issue was with the way I was installing npm… was eating cpu and ram :wink: