Why are my State History Graphs often wrong?

Why does the history graph show ‘off’ even though clearly the lamp is on (for more than half an hour already).

I’ve noticed this as an issue for many of my devices on the frontend. Went and checked my logs but haven’t seen anything significant.

Are you using the default SQLite database ?

Are there any database errors in your log?

yes, I do. on a sidenote do you think it would make sense to explore alternatives?

I haven’t seen any DB errors so far but I’ll keep an eye out for that. Would it be enough to grep for ‘SQL’?

I’ve deleted my homeassistant_v2.db last night for a fresh start and hoping it will go better this time.

once again this happened and I still can’t seem to find a clue.

When I was using a pi and this kept happening I changed over to MariaDB (add-on). Solved all my problems.

trying this right now. so far it looks promising

1 Like

As it runs in it’s own docker container it is not affected by home assistant server restarts the way the default database is. Much less chance for corruption. Also it uses more memory for added speed.

1 Like

I am cool with that since I moved over from Raspberry Pi to a dedicated server like so many others.

damn it, even after the switch to a freshly installed MariaDB the history is still acting up for some of my entities

Trackers aren’t a good example. My phone occasionally shows as away when it is home. Check the actual state of your tracker in the dev tools states menu.

the actual state was home though for 26 minutes (see upper right corner of the card). only a restart of Home Assistant fixed the history graph.

Yeah I see that now I’m on my PC (missed it on the mobile).

Any errors in your log?

Any errors in the MariaDB log (on the addon page)?

again (unfortunately?) no errors in either of the logs. as far as I understand it now it could just be a graphical glitch because the state itself is correct. however it does revive page refreshes and only a restart fixes it.

Which web browser are you using?

I’ve tried with Safari (desktop + iOS App) and Firefox

This really turned out to be one of the most frustrating issues ever, since it gets messed up after less than a day and I heavily rely on the history.

same issue here. I noticed it a while back but not sure what version introduced it. I’m running Hassio 0.97.2.
2019-08-28%2020_12_54-Home%20Assistant

I can’t even get the History page to load, just sits forever.

For now, I deleted this file “home-assistant_v2.db” and rebooted. It seems to have fixed the state history page, it’s loading now. We’ll see if this lasts.

for me this is always a temporary fix. it stays ok for up to 24h before it’s all messed up again