EmonPi2 - Energy readings getting reset?

On my new EmonPi2, I was under the impression that the E1 to E6 input values contain the total energy (Watt-Hours) read from the 6 CT inputs, and that the firmware contained logic to preserve these in non-volatile storage?

If that is the case, then how come my feeds based on these inputs suddenly dropped? Here is the total kWh reading for my immersion heater for example:

The input processing from the E3 input is a simple multiple by 0.001 and log to feed:

I did reboot the Pi a few times, including pulling the power. Could that explain it?

I’ve just seen a comment from @Robert.Wall In another thread:

The front end sketch should be saving the ‘E’ values to EEPROM when any one of them changes significantly, but I believe the library that does this has been changed since I wrote it and it no longer works as intended - if at all.

Is that the case? Then, umm, I hate to say this, but shouldn’t this get fixed asap?

1 Like

Hello @Martin_Robinson apologies, I had not appreciated that this was an issue. I have now tracked it down to an error in the emon_DB_6CT sketch itself and have pushed a fix to the firmware repository.

Next I will issue new pre-compiled firmwares and will update this thread again once I’ve done that.

@Robert.Wall I was using the wrong CT channel index for EmonLibDB_setWattHour in the main sketch using 0-5 rather than the correct 1-6. That caused the saved values to shift at every power cycle. E6 becomes the pulse value, E5 becomes the last E6 and so on. An embarrassing mistake! My modifications to your emonEProm library appear to be ok.

1 Like

You made the changes, they’re your responsibility. If you wish me to look at those changes, then you must ask.

Thanks Robert, I don’t think there is a need at this point as the issue was external to the library.

Many thanks @TrystanLea for picking this up and fixing it so promptly.

1 Like

Doesn’t emon_CM_6CT_temperature have the same issue?

The channel allocation is correct for emon_CM_6CT_temperature, emonLibCM channel allocation is 0-5 whilst the newer emonLibDB is 1-6.