Calculate total power usage

Here was discussed a similar question: https://community.home-assistant.io/t/2021-8-new-energy-feature-in-ha-conversion-from-w-to-kwh/328830
Maybe solution helps you, too.