Page 1 of 1

Power meter reset leads to incorrect historical records

Posted: Monday 20 January 2020 23:10
by zaphod
Hi,
Each time the MySensor power meter resets the power usage value (such as after a power cut, reboot or domoticz update), this causes a couple of glitches :
- the detailed hourly power usage histogram of the log goes flat after the reset time (even though the values in the Meter table are not null after the reset time, they are just shifted down):
Selection_220.jpg
Selection_220.jpg (30.08 KiB) Viewed 394 times
- the daily power usage over the last week histogram shows a spurious value on the day the reset took place (the histogram bar take the value of the last power usage measure before the reset):
Selection_221.jpg
Selection_221.jpg (29.03 KiB) Viewed 394 times
which corresponds to the reset seen here in the database meter table:

Code: Select all

sqlite> select * from Meter  where DeviceRowID=76 order by date desc limit 20 offset 285;
76|236|4778|2020-01-19 23:20:00
76|194|4244|2020-01-19 23:15:00
76|151|4297|2020-01-19 23:10:00
76|120|4445|2020-01-19 23:05:00
76|81|4601|2020-01-19 23:00:01
76|41|4664|2020-01-19 22:55:00
76|0|4414|2020-01-19 22:50:00
76|33029|22089|2020-01-19 22:45:00
76|33029|22089|2020-01-19 22:40:00
76|33029|22089|2020-01-19 22:25:01
76|32961|3997|2020-01-19 22:20:00
76|32925|4164|2020-01-19 22:15:00
76|32891|4087|2020-01-19 22:10:02
76|32857|3668|2020-01-19 22:05:00
76|32826|3669|2020-01-19 22:00:00
76|32794|4088|2020-01-19 21:55:00
76|32759|5203|2020-01-19 21:50:00
76|32718|4593|2020-01-19 21:45:01
76|32681|4435|2020-01-19 21:40:00
76|32644|4415|2020-01-19 21:35:00
It's very strange how the daily sum can end being set at the value at 22:45:00? I'm willing to look at the code, if someone can point me in the right direction (which class/methods might be involved in this calculation) as I've not got any experience in the domoticz code structure.

Any help or advice welcome !
Cheers,

Re: Power meter reset leads to incorrect historical records

Posted: Saturday 25 January 2020 2:33
by lemassykoi
I believe I'm having the same kind of problem.
I'm living in France, where National Electricity Company is replacing all Electricity Meter for everybody.
When it's done, the tech which does this has to inject old indexes into new meter.
I'm assuming this because of the value which has been added (85 MegaWatts).
I restored a backup thinking that if I can skip the first seconds of new meter, it would be ok, but no.

image attached

Is there a way to correct ? Or should I delete device, and create a new one, to handle the new meter ? If so, can I keep historical datas of old meter ?

thanks all