You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Great integration, thank you, I've been able to recreate some missing energy data (PV generation, battery charge, import/export, etc). Took a while but it did the job perfectly.
A frustration I had though was populating the sum/state version of the tsv file as I didn't know what the initial state of the sensor value was, so initial loads of the statistics causes negative values and then its trial and error to work out the right data to load.
To explain:
I have a utility meter with daily reset for energy exported [same process for all the other energy sensors]. It is of type total_increasing.
If I look in HA developer tools statistics, I can see a gap in the statistics data I want to populate using the integration, e.g.:
5am 0.5kWh
9am 10kWh
From my inverter cloud data I can see the correct values are:
5am 0.5kWh
6am 1kWh
7am 2kWh
8am 3kWh
9am 4kWh
Per the instructions I can either specify state only or values for state and sum. If I create a TSV like this and load it with the integration:
time unit state sum
5am kWh 0.5 0.5
6am kWh 1 1
7am kWh 2 2
8am kWh 3 3
9am kWh 4 4
or like this:
time unit state
5am kWh 0.5
6am kWh 1
7am kWh 2
8am kWh 3
9am kWh 4
And then look at the statistics after the load, the values look like this:
The problem is that internally in the statistics table the state column contains the increasing value since the sensor was first created and the sum is the delta between each one hour period. The state value isn't surfaced in the Home Assistant UI AFAIK, it just manifests itself as a massive negative number when I use the integration to load the statistics data.
There then follows a period of trial and error (or mistakes in my maths) to work out what the state values need to be, which when I work it out correctly looks something like this:
time unit state sum
5am kWh 2786.5 0.5
6am kWh 2787.5 1
7am kWh 2789.5 2
8am kWh 2792.5 3
9am kWh 2796.5 4
Describe the solution you'd like
I'd simply like the ability to enter ONLY the sum (delta) value and have the integration work out what the state value needs to be in order to achieve the correct sum (delta)
So would like to be able to submit a file like this:
time unit sum
5am kWh 0.5
6am kWh 1
7am kWh 2
8am kWh 3
9am kWh 4
And the LTS in developer tools then look like this:
5am 0.5kWh
6am 1kWh
7am 2kWh
8am 3kWh
9am 4kWh
But under the covers the state table is actually populated like this:
time unit state sum
5am kWh 2786.5 0.5
6am kWh 2787.5 1
7am kWh 2789.5 2
8am kWh 2792.5 3
9am kWh 2796.5 4
Describe alternatives you've considered
Muck around with SQL on the underlying database to work out what the starting state should be, but I'd like to avoid having to use SQL
Checklist
Is your feature request related to a problem? Please describe.
Great integration, thank you, I've been able to recreate some missing energy data (PV generation, battery charge, import/export, etc). Took a while but it did the job perfectly.
A frustration I had though was populating the sum/state version of the tsv file as I didn't know what the initial state of the sensor value was, so initial loads of the statistics causes negative values and then its trial and error to work out the right data to load.
To explain:
I have a utility meter with daily reset for energy exported [same process for all the other energy sensors]. It is of type total_increasing.
If I look in HA developer tools statistics, I can see a gap in the statistics data I want to populate using the integration, e.g.:
5am 0.5kWh
9am 10kWh
From my inverter cloud data I can see the correct values are:
5am 0.5kWh
6am 1kWh
7am 2kWh
8am 3kWh
9am 4kWh
Per the instructions I can either specify state only or values for state and sum. If I create a TSV like this and load it with the integration:
time unit state sum
5am kWh 0.5 0.5
6am kWh 1 1
7am kWh 2 2
8am kWh 3 3
9am kWh 4 4
or like this:
time unit state
5am kWh 0.5
6am kWh 1
7am kWh 2
8am kWh 3
9am kWh 4
And then look at the statistics after the load, the values look like this:
5am -2786.5kWh
6am 1kWh
7am 2kWh
8am 3kWh
9am 4kWh
10am 2790.5kWh
The problem is that internally in the statistics table the state column contains the increasing value since the sensor was first created and the sum is the delta between each one hour period. The state value isn't surfaced in the Home Assistant UI AFAIK, it just manifests itself as a massive negative number when I use the integration to load the statistics data.
There then follows a period of trial and error (or mistakes in my maths) to work out what the state values need to be, which when I work it out correctly looks something like this:
time unit state sum
5am kWh 2786.5 0.5
6am kWh 2787.5 1
7am kWh 2789.5 2
8am kWh 2792.5 3
9am kWh 2796.5 4
Describe the solution you'd like
I'd simply like the ability to enter ONLY the sum (delta) value and have the integration work out what the state value needs to be in order to achieve the correct sum (delta)
So would like to be able to submit a file like this:
time unit sum
5am kWh 0.5
6am kWh 1
7am kWh 2
8am kWh 3
9am kWh 4
And the LTS in developer tools then look like this:
5am 0.5kWh
6am 1kWh
7am 2kWh
8am 3kWh
9am 4kWh
But under the covers the state table is actually populated like this:
time unit state sum
5am kWh 2786.5 0.5
6am kWh 2787.5 1
7am kWh 2789.5 2
8am kWh 2792.5 3
9am kWh 2796.5 4
Describe alternatives you've considered
Muck around with SQL on the underlying database to work out what the starting state should be, but I'd like to avoid having to use SQL
Additional context
I have looked at the community discussion https://community.home-assistant.io/t/custom-integration-to-import-long-term-statistics-from-a-file-like-csv-or-tsv/689793/20and it seems others have similar problems with large negative swings in their stats
The text was updated successfully, but these errors were encountered: