Hi Paul,
At least your normal energy consumption is normal now
I think that you are correct, it seems that the current - last value gets negative when domoticz is restarted and the PiFace driver starts with 0.
Actually I was expecting such behaviour when testing, but then always got sane results... So I was under the impression that Domoticz had a good mechanism to deal with it.
The RFXmeter hardware will most likely store its energy counter in memory, and keep counting.
I will need to fix this, and think that there are 3 solutions to the problem:
1) Have the PiFace driver store the metervalues into a file on disk (do not like this option to much as it could add additional wear to the SD card)
With this method the counter value will be the most acurate because it will store all increments even between the updates to domoticz.
2) Get the last value from the Database as you suggested, and use it.
3) Fix the calculation error of the RFXmeter.
For now this has my preference, as is an RFXmeter is reset (replacement etc), then the same issue will occur.
As well as an RFXmeter overflow from large to 0...
One thing that I experienced with an older system that I used, which also had an opto to detect the 0 rotations on the gasmeter:
Was that in certain cases the mirror in the 0 was at an inconvenient edge, causing the signal to oscillate and also cause sky high readings.
However what you are describing imo looks like a domoticz issue.
Will try to look at it this weekend.
Best Regards,
Robin
BTW: I prefer to keep the issue reporting in the PiFace topic, as things remain central, and I am notified about it.