Calculate Wh to W with state difference and time

Hi guys,

I‘m reading my power meter with the Volkszähler integration, which delivers me the actual total energy consumption in kWh. How can I create a sensor to calculate the theoretical power consumption in kW?
I understand how to calculate it with a mathematical function, but don’t know how to realize this in Home Assistant.
The math part:

Power= (TotalEnergyNOW - TotalEnergyLASTSTATE) * 3600 / (time in secs between states)

Any help appreciated

To get from energy to power you have to differentiate with respect to time ( 𝛿E/𝛿t, essentially your formula with very small time steps). There’s a sensor for that:

Give it your energy sensor and it will give you instantaneous power at the times your energy sensor updates.

Exactly what I was looking for :+1:t2:

Sounds good, which source of the volkszaehler do you use for the derivative sensor?