as i messed up a little with short term in sql already i had to finish it like that. but the second sensor from statistic tab went perfectly.
Anyway, all fine now, looking good again
Thanks for all assistance!
EDIT,
I’ll just put a link here because it’s nicely described and will help before messing up with ale SQL mining
And of course energy dashboard is now off with a peak of 300kwh solar power.
I used this guide here and corrected the pv_energy values in:
States
statistics
statistics_short_term
Everything was ok, but then probably integration platform calcluated again the difference and wrong numbers wehre in states, statistics_short_term and statistics again.
Then I thought that I should update the sensor.sun2000_10ktl_m1_sun2000_12_bt2150240752 wrong value as well, because integration platform uses it. Only place in db i saw these values, was states table. I corrected the data there, but in the UI it still shows the peak with wrong data and pv_energy is calclulated wrong again by integration platform.
So my question is, what to look more to solve this issue?
EDIT: Interesting is that i can’t see this wrong data in the dev toold statistic tab:
As you see in Developer tools you can correct the statistics, aka long term statistics.
If you corrected the statistics for your energy sensor then it should show the right values in your Energy tab.
You shouldn’t care about short term statistics as it will be discarded after a few days unless you are storing all values in an InfluxDB to display it with Grafana, then you should correct your value there.
Obviously your pv_energy short term statistics has been fudged not at 4AM, but after 8AM, so you have made some magic wrong there.
SELECT *
FROM "states"
WHERE
entity_id ='sensor.sun2000_10ktl_m1_sun2000_12_bt2150240752'
and last_updated between '2022-10-11 00:00:00' and '2022-10-12 23:59:00'
There is no wrong data there, as I cleaned it this morning.
I’ll start the HA now, and post what happens in db
As you can see from the picture, I changed the integration and from now on, i can probably correct the issues, as this integration offers energy sensor as well.
My guess is that i cannot correct, beaduse the old sensor was the integration sensor, which cannot be corrected:
Bad thing is that i can’t delete the old sensor from Energy Dashboard, because i will lose all the previous data. So i just have to keep in mind that there is this 300kwh difference. One thing i can probably do is change the pv_energy senor to some static number and correct the bad data in db.
If it shows a spike there on the Energy Tab, that means it has a huge change there recorded in the long term statistics. It should be visible through the developer tools as well.
Thanks to this topic I managed to edit/recalc all my sum values by updating the sqlite stat tables. Now my reports finally make sense.
However, as soon as the hourly integration runs on my Electicity Meter Reader digitizer value, it adds the huge offset again once more in the ‘sum’ (not in the state, that one is correct, see below).
Even if I turn HA off at that time. Is this value stored somewhere? If so, where to change it?
## DIGITIZER METER READERS ###
- device_class: "energy"
state_class: "total_increasing"
name: Electricity Meter Reader
state_topic: "digitizer/elecmeter/main/value"
unit_of_measurement: "kWh"
@ORi I had the problem… You can just edit the sensor value in the development tools → statistics
You search for the sensor you want to update and then click on the far right “sum adjustment” (not sure it is the exact wording as it is translated from the my french version “ajuster la somme”)… Then you look at the date and time where your sensor is going “banana” and adjust the value to the correct number… Done !
Normally all the statistics where this sensor is involved are automatically updated…
In fact the sensor value is completely correct, also the ‘adjust sum’ value is correct at that time. My best guess is that the integration that calculates the energy consumption over the entire hour somehow stores the incorrect sum somewhere.
EDIT1: i’ll experiment with the correcting the statistics_short_term table and provide feedback if it works.
EDIT2: it works, updating the ‘statistics_short_term’ table in the same way (SET sum = sum - $offset) resulted in the values being correct and the integrations calculate the power consumption correctly in the energy dashboard. No need to stop HA if it’s done this way.
Hopefully this helps anyone in the future as well.