You can have a look an EmonPI (send W data from the individual sensors to EmonPI, then get back accumulated kwh data as other sensors).
As an alternative, here is my WIP project Basically I’ve set sensors for daily, weekly, monthly and yearly which are adding the current values to previous balances which are actualized at 30 seconds. I’ve then setup an automation that renews the monthly figures. There is still a lot of work to be done (not difficult but I got lazy after setting the new month automation) such as to create automation for starting a new day, new week, new year, etc. create an easy to use mechanism to link current existing sensors to the mqtt ones; split the sensors between real time reporting sensors (measured through wall power switches) and nominal consumption sensors (such as the ones from the light bulbs for which it doesn’t make sense to have an actual counter), etc.
You could build an automation that triggers when the sensor value is set to 0 (zero). And store the previous value (which will be the day total) in a template sensor. If you record long enough history, you could use some statistical sensor to compute totals.