I am using the InfluxDB add-on and the Grafana add-on from the add-on store with Home Assistant OS. I have configured the InfluxDB connection in the configuration.yaml file, and am able to see the “value” of one of my Shelly switches in the Grafana dashboard, as in the following screenshot (I have turned the switch on and off a couple of times for testing):
Now if I switch to the “Table” visualization instead of “Time Series” in Grafana, I can see the list of values. It seems like there is a value every 1 second being shown, even though many of the data are the same when the state hasn’t changed:
Are all these values actually being stored in the InfluxDB database, or is this some visualisation thing in Grafana? (what I mean is, are all these values that are the same as each other actually taking up disk storage space?)
My expectation was that there would only be a data point inserted into the InfluxDB database if the state was changed (which would then result in non-equally spaced time points). Is there an option to do it this way instead?
If we do use equally spaced time points, is there somewhere to configure how often a data point is inserted? (could we record every 5 seconds instead, for example)?
Hi TommySharpNZ, I have learned a couple of things since the post, and can now answer it at least partly:
No - all the values in the list (all the zeroes in my screenshot above) are not stored physically in the database, and do not take up storage space. The reason all the zeroes are there is because of a combination of the GROUP BY time($__interval) and fill(previous) commands I was using:
These are InfluxDB commands (not Grafana), and they basically are doing some extra processing with the raw data. So because there was a zero somewhere in the list, it basically fills all other values in each time interval with another zero. But this is only in the result obtained from the query - the values are not actually stored on disc. If you change it to fill(none), then all the other zeroes disappear.
It is for sure true that the InfluxDB integration only pushes a new value into the database if there is a change from the previous value. This is written in the doc here as “The influxdb integration makes it possible to transfer all state changes to an external InfluxDB database”.
It is not pushing data in at a regular interval.