I have multiple sensors sending data every second.
It takes long time for Home Assistant to display a plot of last 24h values, which is understandable - this is more than 86k data points. It is also pointless to plot all these data points on a small graph displayed by Home Assistant.
It would be nice if Home Assistant allowed to bin the data, which it is supposed to display. This should be done on server side.
The binning can be done with binned_statistic function from scipy.stats module. For example to fit the data into 400px wide plot (times - data point timestamps, values - data point values):
IMHO, it is strange to decide the sensor data read interval based on Home Assistant plot capabilities.
But if so… assuming HA can handle 1k points and that you can request week of data in the history section of the UI, that would mean interval of 10 minutes.
What is the recommended interval value, which Home Assistant can handle?
In most cases a minute should be enough. Updating an entity every second probably puts a lot of load on the internals of Home Assistant. Ideally the sensor only really updates when the value changes. There’s no point in storing a temperature that doesn’t change frequently every second (just as an example).
The default history plot is 400px wide. For sensor providing data every 60s, Home Assistant is drawing 3-4 data points in each pixel of a plot. With binning you can avoid that and send 3-4 times less data to draw similar graph (assuming 24h of history).
I was answering the question about how many samples make sense for Home Assistant compared to 1 per second. Yes, binning could improve performance for graphs. But keep in mind, that other users may have other resolutions on their displaying devices. Therefore other rates might be useful as well. Anyways, my point was, that update per second is way too frequent, especially if the sensor doesn’t do anything. Let’s take a door-contact as an example. If it’s attached to a door you only open once a week, then you don’t need to store its state every second. Only changes are relevant. Of course this depends on the implementation of the sensor and if it pushes the data or you have to poll it in intervalls.
This will vary per use case. In my case I have noticed quite horrible performance issues with Home Assistant when showing simple plots, therefore the feature request. Thanks for the suggestions anyway.