I configured energy measurement and costs calculation in simple way: just to measure spent kWh and multiply them with current electric price (two tariffs). Till today everything worked fine but today one sensor who is always 0 kWh suddenly showed costs -661,02 HRK as on pictures below - marked yellow (one picture from yesterday and this erroneous calculation from today):
Do you have any idea where and how to start investigating or tracing what went wrong?
Thanks.
I’m pretty sure the price is calculated correctly but the energy statistics might be the cause.
Would be interesting to see the history of your grid energy consumption for the timeframe as well as the sensor of your energy-price.
Thanks for replying. For that day, 19.10.2022. there was 0kWh consumption for this particular sensor what is also visible from screen capture above. Therefore, I am surprised, that calculated price for that day is -661 kn.
Fun fact: when I tried to get history for this OstatakDT energy sensor, HA is only giving me history until 19.10.2022. when this change occurred. There are no history before this date which is very strange.
Any comments?
Here it is. History for that day 19.10.2022. for this sensor showing power and energy. Please note that on Power graph there is break (in red circle) as maybe WiFi loss from sensor causing this strange calculation?
How to correct this? Somewhere directly in database?
As mentioned before: the _cost sensor would have been helpful too.
It’s hard to find out, what happened.
Maybe you changed the price in between or use a sensor for the price, and the sensor was unavailable. Many possibilities.
Yes, you can edit the database if you feel comfortable with SQL.
The default database is SQLite and the file is located at /config/home-assistant_v2.db
The statistics are in the tables “statistics” and “staristics_short_term”.
I have problem presenting history for Cost sensor for that date: 19.10.2022. I cannot get data before 19.10.2022. 12:36h. and graph after that shows only 0 HRK.
But I found moment when it was changed in DB (therefore -661kn in Energy tab when value changed from cumulative 661kn to 0kn):
I think database modification is necessary. Can you, please, guide me how to edit concrete value? I can find ID of sensors which need to be modified and I have SQLite Web installed.
I might find DB update query and try. But I am interested what triggered that database was reseted to zero. Hmmmm… Can I somehow investigate this? To find what was trigger?