kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.96k stars 232 forks source link

too many updates since 2023.2? #935

Open rorso opened 1 year ago

rorso commented 1 year ago

I recently found that my HASS home screen is quite sluggish and takes a lot of system resources.

I found the "culprit" with the mini-graph-card that is displaying a graph of my current energy consumption with three entities. The sensor values are updated every 5 seconds and so the card draws about 200KB sensor data every 5 seconds by default because of "on every state change".

This may be because the new "streaming history" function implemented in the 2023.2 update, as I did not have this problem before that date.

While we CAN (and should) set the update_interval parameter in this case, it should not be necessary to poll new data more often than there are data points to plot.

So if I configure 12 points_per_hour, it seems to be sufficient to poll the history every 300 seconds after the first request to keep the graph clean, even if the data does change every 5 seconds - which is still displayed as the actual numerical value.

I propose an enhancement to not poll more often than points_per_hour as a default, in case update_interval is not set and not more often than the sensor value changes, in case it is quite the reverse.

MEKadan commented 1 year ago

To add to this, the default for aggrecate_func is avg. I tried aggrecate_func: last, and sluggishness got much worse, to unbearable level. I also encountered browser crashes. Had to remove aggrecate_func.

I have a powerful PC, and still this. However, there are differences between browsers. FF and Vivaldi pretty much the same (bad). DuckDuckGo mobile a bit better. Brave seems to be OK on PC, not on mobile. Did not test others