Emoncms local - Kwh daily accum gauge

I’m feeding a local Emoncms db with a Brultech ECM1240. The ECM1240 spits out Kwh that it keeps it’s own accumulator, and also raw watts.

I want to build a feed that resets every day at midnight, and it will accumulate the Kwh for the day.

Any help would be appreciated.