History Graph intermittent flatlining – since 2021.3.x

Hallo:

Since updating to 2021.3.x I see a strange behavior in all my history graphs:

After a certain time (1-2 days) the graphs starts flatlining at a given value, while the sensor continuous to show the most recent value (see screenshot):

ha_history_graph

At 4am the graph flatlines at 17 deg, while around 6am the actual temperature is at 19 deg. Before 4am the temperature is plotted accurately.

If I restart the system, the graph works normal again for about a day, including showing the correct values of what used to be the flat line portion of the graph. So it looks like it actually recorded all values, but is just not displaying them for some of the time.

I also deleted the history db, thinking that it might be corrupted. As a result the history did not work at all (No state history found) for about a day and the reverted back to the previous behavior of intermittent flatlining without additional intervention.

I have not changed my recorder or history setting recently and I am using the default db – nothing special. I don’t see any database or history related errors or warnings in the log file.

Is there anybody who can make sense out of this? Your help is much appreciated.

Stephan

How is you’re recorder setup in HA? Are you logging to an external recorder like MySQL or MariaDB? Are you logging to the default database file on an RPi and the SD card? Are you running any other resource intensive operations on the device containing the database at the time the history flatlines?

When this has happened to me (flatline after some time, restart and data comes back) it’s usually because my database becomes unavailable to read from. I run HA in docker on a Synology NAS, logging to a MariaDB container so my experience may be different than yours. This recently happened to me because I swapped out a drive in my storage pool and rebuilt. The rebuild took 14 hours and that entire time the Disk I/O wait went through the roof for everything else that was running on my NAS. I could still write to the database, but HA could not read. As soon as the rebuild completed, all of my history came back including the flatline data from when I started the storage pool rebuild.

Interesting thought, squirtbrbr:

Correct, I am logging to the default database on raspi to SD card.
I have the supervised installation on Raspbian buster on a Raspi3 with a High performance SD card. HA has ground more then one standard SD card to dust, but this one seems to hold up well.

The loads in the HA supervisor panel seem normal (0.5-3% CPU, 38% storage usage) and “top” shows cumulative loads between 5-20% (cpu & mem) with python3, node, dockerd and systemed-journal processes as the high hitters.

Is there a better way to setup recording and history, to avoid such issues?

Stephan