I’m running HA on a Raspberry Pi 3, not the HASSbian all in one installer, just a regular Raspbian install with HA installed on top. Everything’s working well, except it takes a really long time (60+ seconds) to generate graphs. For example, I have an Aeontec Multisensor 6, trying to display the temperature graph takes a very long time. Is this a misconfiguration or am I just at the mercy of the Rapsberry Pi 3 and my choice of µSD Card?
I had the same problem - took forever to load the history.
Some people recommend to use mysql instead of sqlite - didn’t do a thing for me.
But I noticed that it’s much quicker now with version 0.38 installed.
Just installed 0.38.1, let it sit for a few minutes to come up and stabilize, and it’s still pretty slow. Probably about 60-90 seconds to bring up a single graph. What’s weird is I was watching the CPU activity via htop and I didn’t see any spikes or increases in RAM usage, which makes me think the problem might just be the µSD Card’s read speed and/or the sqlite database backend, though I’m not sure how to monitor or test either of those.
MySQL makes a world of difference in my case
as suggested by others I did that, now I have a very fast sd card, but situation did not improve (at least I do not notice it).
Didn’t try the change in the database
Bob, what is you HASS run on?
Mine is on a Pi3.
Set up a MySQL instance on the Raspberry Pi 3 and updated the HA configuration to use that instead. A quick test after 10 minutes shows significantly faster graph generation, a second or two at most, so it seems that the performance penalty is likely sqlite. Going to need to wait a few days to be certain though to let it build up some history to work with (I was too lazy to port history from sqlite to mysql).
Same here, RP3
Just wait until your database more records… After a few weeks of logging on rpi3 with a really fast SD card is now taking again multiple minutes.
Sadly even after a day of logging it seems to have slowed down, even with MySQL as a backend. I’m guessing this is an SD card problem, though I don’t have time to set up a parallel computer with faster storage to really test this out. Oh well, all I really want is a couple of days of logging.
is it possible to just keep that?
Should be possible, I think there’s a “purge after X days” option, though I need to look. I don’t know how changing that affects already stored data though, so that may need to be manually cleared.
recorder:
# Keep only 5 days worth of data in the MYSQL database in the Test environment
purge_days: 5
# Link to the MYSQL database
db_url: !secret db_url
That’s how I set up mine - not 100% sure, if it will purge older records when you first configure it and re-start, but I assume it will.
in your .home-assistant directory, type ls -Alh
and take a look at the size of the home-assistant.db file.
according to these guys,
https://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-microsd-card
you are lucky to get read speeds above 20MB/s, and should probably expect much less.
Im guessing that your db file is between 1-4 GB
at 1 GB and a read speed of 20MB/s, it should take 50seconds to read the whole file.
I am guessing that since it’s a database, it shouldn’t be necessary to read the whole file, but I am also guessing, that since it’s a database, it’s probably not reading with 20 MB/s
Well, I have installed MySQL, and after 2 weeks, my database is about 60MB, not sure why the big difference though, but I had a big performance increase.
yeah, mine is 1GByte.
Can I just delete it? And then I will put recorder with 7 days
well I canceled the file, now is fast
As I said, I use MySQL,
but a friend of mine, added purge_days, and his home-assistant.db file is still quite large, so I am not sure if it respects the purge days tbh.!
It might be that he just have lots of entities, and that explains it though.!