Perfect this makes sense and perfectly answer my question. Many thanks.
I have installed your component and I will now do some testing.
Currently I have an old Home assistant installation (using MariaDB) that I want to move to a new machine and of course I want to keep the statistics. The main problem is with Zigbee devices that probably will have a new IDs on the new system
instead of displaying °C it display ðC
I thought this problem could have been a misinterpretation from Excel, but if I look at the output data directly in hexadecimal format there is an extra c2 char in front of the expected b0 43
Is there an easy way to specify that we want all the statistic entities without having to create a list of all entities which is a pain?
Is there an easy way to specify that we want all data withouut specifying start and end date (for example by not specifying them)?
I have used Yaml to run the test but if I switch back to UI mode it seems like the date picker does not show for end_time ? So no way to specify it from UI?
I released a new version of the integration, v3.0.1.
Whatâs Changed
Added
Delta Import Support
Import counter statistics (state_class increasing or total_increasing) using delta values (the change of the value in one hour) instead of absolute sum/state values:
Converts delta values to absolute sum/state values using existing database values as reference points
Useful because you
Do not need to calculate sum and state
Do not need to align sum and state values of the import with the sum and state values in the database, which can be a pain.
Supports these scenarios:
Import before oldest database value
Use case: E.g. the sensor was not available in Home Assistant before, but there are other sources available
Import after newest database value
Use case: E.g. the sensor was offline and recorded wrong values
Import in the middle of existing range (overwrites with new deltas)
Use case: E.g. manually add consumption data for hours not yet in the database.
It is recommended to use the delta feature to import counters
Validation
Timestamp validation to prevent future values
Changed
Import Behavior
Import is now synchronous: The import action waits until all data is committed to the database before returning
Provides feedback on import completion
Eliminates race conditions when chaining imports
Export
Already with v2.0.0 its possible to export long term statistics. With v3.0.1:
Export now includes calculated delta column for counter statistics
Delta column shows the change between consecutive hours
Exported files can be directly used for delta imports (after removing sum/state columns)
Migration Notes
This is a backward-compatible change. Existing imports using sum/state columns continue to work as before. The new delta import functionality is automatically activated when a delta column is detected in the import file.
No action required for existing users. New delta import feature is opt-in by using the delta column.
Hi there. I tried to install the latest version (v3.0.1) of your integration using HACS and Iâm getting the error âThis integration does not support configuration via the UI. If you followed this link from the Home Assistant website, make sure you run the latest version of Home Assistant.â
Installation method-Home Assistant OS
Core-2026.1.0
Supervisor-2026.01.0
Operating System-16.3
Frontend-20260107.0
Not sure whether this is a bug, or whether thereâs something wrong / different about my setup. I will try and install manually but wondered what you thought.
Thats true, in this case the integration should create the entity automatically.
But as you are doing an import with delta values, this is not possible when there is no entry in the database at all (at least not yet), so you have to first import at least one value with sum and state. Further imports can be done with deltas.
The reason for this is that sum and state are stored in the database, not delta, and I try to align whats in the database with the imported delta. Otherwise I would have to âinventâ state and sum.
Please create an issue in the repo, at least the error message has to be improved, and I will think about to âinventâ state and sum if nothing is in the database.
Thanks, it makes perfect sense indeed. I fixed my issue by creating a sensor first.
As you said, a basic error message saying it canât be initialized based on delta would help (or an option to init at 0 may be ?)
Thanks for your work on this integration, it helped me a lot for what I wanted to do (+ on how HA is working internally !)
Optional entities parameter: Export all statistics when entities is omitted or empty
Previously required; now defaults to exporting all available statistics
entities parameter now accepts glob patterns using * (e.g. sensor.*_temperature). Useful when exporting a subset of statistic IDs without enumerating them all.
Optional start_time parameter: Export from earliest available statistics when omitted
Allows exporting complete historical data without knowing the exact start date
Optional end_time parameter: Export up to most recent statistics when omitted
Allows exporting all data up to present without specifying end date
Thanks Klaus for releasing 4.0
Note: There is also an output option to automatically split the output into separate sensors and counters files for easy import in target system
There are two changes I would like to propose for this integration, but before submitting them as issues or pull requests, I think it would be good to discuss them.
The first change concerns the fact that it is required to specify the separator character for both reading and writing statistics, as well as the fact that the default separator is a tab.
It is customary for TSV files to use tabs as separators by default and for CSV files to use commas as separators by default. So, I propose the following approach for both writing and reading statistics:
if the optional separator is specified, then that separator is used
if the separator is not specified, then commas are used as the separator for CSV files and tabs are used as the separator for TSV files
The second change does not affect the code, but simply the documentation. In the current documentation, statistics are divided into two types called sensor and counter. Unfortunately, Home Assistant does not define terminology for these two types, so we can effectively use whatever we want. I think that the choice of counter is appropriate and accurately reflects their use, but the use of the term sensor does not seem appropriate to me because it is misleading. There are two reasons for this: on the one hand, counters are mostly in the sensor domain, and sensor can belong to different domains. As a reminder, the two types of statistics are defined by the value of the state_class attribute.
I therefore propose using the following terms:
measurement: if the state_class is equal to measurement or measurement_angle
counter: if the state_class is equal to total or total_increasing
OK if this is fine with you I will include the terminology modifications in my PR
For the separator I need to evaluate and see if I can stick it in the same PR