Reporting energy usage

Hello! I’m looking for a way to have some of my appliances at home report how much energy they use. I have smart plugs installed at the dishwasher, washing machine and the tumble dryer. I’ve managed to make template sensors that turn on and off with each cycle, based on the actual power usage reported by the smart plugs. When the appliance is ready, the template sensor turns from on to off and that triggers a notification to my smartphone.
What I would like to have, is that this notification includes a report of how much energy was used. So I need an automation or script that stores the total energy reported by the smart plug at the start of a cycle. At the end of the cycle, that stored reading needs to be subtracted from the new reading and the result in kWh should be included in the notification to my smartphone.
I’ve searched the forum for similar projects, but haven’t been successful. I’m looking for a place to get started and would really appreciate if someone could tell me how to best approach this.

check out

Thank you so much! I’ll try that and see what it can do.