Correcting values in database
Posted: Friday 15 December 2023 9:15
I use an incremental counter to log my electricity use.
Every 5 min the actual consumed KWh value in this period is sent to the counter via a MQTT message.
This was working fine for more than a year now.
Due to a power outage on 7 dec a wrong KWh value (more than 1000x than normal value) was sent to the counter.
This of course messed up all the graphs, hourly, daily, monthly and comparing usage graphs.
I deleted the erroneous day value (7 dec) using Shift delete on the graph in Domoticz.
The 'comparing usage' graph however still contained the extreme high value for December
In de database for Meter_Calendar I saw that the total 'Counter' values after 7 dec where still too high, so I manually corrected these to match the 'Value'
('Value' + previous day 'Counter' = new 'Counter').
After this correction all graphs are back to normal ... until the next day.
Then the new total 'Counter' is back to the old (too high) value.
All database corrections where done 'offline' i.e. using Backup - edit in SQLite - Restore
I am obviously doing something wrong.
How can I correct the Counter value properly and permanently ?
Every 5 min the actual consumed KWh value in this period is sent to the counter via a MQTT message.
This was working fine for more than a year now.
Due to a power outage on 7 dec a wrong KWh value (more than 1000x than normal value) was sent to the counter.
This of course messed up all the graphs, hourly, daily, monthly and comparing usage graphs.
I deleted the erroneous day value (7 dec) using Shift delete on the graph in Domoticz.
The 'comparing usage' graph however still contained the extreme high value for December
In de database for Meter_Calendar I saw that the total 'Counter' values after 7 dec where still too high, so I manually corrected these to match the 'Value'
('Value' + previous day 'Counter' = new 'Counter').
After this correction all graphs are back to normal ... until the next day.
Then the new total 'Counter' is back to the old (too high) value.
All database corrections where done 'offline' i.e. using Backup - edit in SQLite - Restore
I am obviously doing something wrong.
How can I correct the Counter value properly and permanently ?