I would like to calculate the current watts for an energy device that only reports kWh.
I have created a virtual device that stores the previous kWh value and also updates the "Last Change" value. When the energy device updates its kWH value I would like to compare the new value with the previous one. My script is triggered by this update.
I must also be able to calculate how long it's been between updates and I don't know what would be the best way to do this? When I know the hours (will be something like 0,083 as I have ~5 mins between updates) I will be able to calculate current Watts.
W = 1000 × kWh / hr
W = 1000 x ((current kWh - previous kWh) / (current last change - previous last change)
I have created a virtual device that stores the previous kWh value and also updates the "Last Change" value. When the energy device updates its kWH value I would like to compare the new value with the previous one. My script is triggered by this update.
I must also be able to calculate how long it's been between updates and I don't know what would be the best way to do this? When I know the hours (will be something like 0,083 as I have ~5 mins between updates) I will be able to calculate current Watts.
W = 1000 × kWh / hr
W = 1000 x ((current kWh - previous kWh) / (current last change - previous last change)