Sometimes sensor or counter data registered by Domoticz in the database may be wrong due to bad measure or counters inited from a wrong value.
What to do?
Check the device chart with all values, and use shift+click on the bad values to cancel them from the database.
In case of counters, if you have to change the current energy value (or else), you have to:
1. Stop domoticz (service domoticz stop or other command)
2. Make a backup of domoticz.db database: (cp domoticz.db backups/domoticz_20231216.db or something else)
3. Connect to the database using the command sqlite3 domoticz.db
4. Modify the counter values in Meter_Calendar (or other table) using the following queries:
.tables
select * from Meter where DeviceRowID=1722 order by Date;
update Meter set Value=Value-56000 where DeviceRowID=1722 and Date>='2023-11-28 21:10:00';
update Meter_Calendar set Value=Value-56000 where DeviceRowID=1722 and Date>='2023-11-28 21:10:00';
5. also, you have to modify the last value for that device with the sql query
update DeviceStatus set sValue='6;518227.4281' where ID=1722;
Of course you have to use the right idx value corresponding to your device, and right values and date.
The examples above are only examples.
The step 5 is used to set the current value of the meter: your problem was that you updated the Meter and Meter_Calendar tables, but not the DeviceStatus tables, so when domoticz restarted, it continued to use the bad value.
I hope this can be helpful for you!