This is my scenario:
From my EmonPi I receive 2 inputs that are the total Wh exported and imported but are only updated at 0, 15, 30 and 45 minutes. Obviously this input resets when the Pi or the 328p are rebooted.
Presently in Portugal (in recent cases) the energy imported and exported is averaged every 15 minutes that is why I implemented this feature in my EmonPi firmware.
In EmonCMS I receive the two feeds and want to record them to another ones that should be exactly the same until the first Pi/328p reset and then continue to increment normally the new values that now stated from zero.
Feed Import_Wh_Monitor : logs the value that comes from the Pi as is;
Feed Import_Wh : is to log all even after 328p resets;
At start both are 0 Wh and after a day they are at 10505 Wh
The Pi resets and the the feed Import_Wh_Monitor come back to 0;
Next time Import_Wh_Monitor updates to 110 Wh and at this time the Import_Wh should become 10615 (10505 + 110) Wh.
I’ve tried “Wh Accumulator”, but it seems to only add changes up to 80Wh - That’s strange because I’m pretty sure that I’ve seen values that were not recorded that were minor than others that were recorded.
Then I tried the “Total Pulse Count to Pulse Increment” that I think should have a similar behaviour despite we are not dealing with pulses, but if we consider that 1000 pulses would be a KWh a pulse is a Wh.
I also tried the “Rate of Change” but is misses changes and in one case didn’t even log anything (See Picture).
What is the best way to accomplish what I want to do?
PS: Later I also want to separate this increments with schedules that separate the import/export based on time of the day and I believe that will be another trouble, but that is a problem to deal with when this one is solved.
Picture (it is almost impossible to have a zero balance between import and export, so there must be a spike every 15 minutes - AAA is the Rate Of change of Import and BBB of the Export):