Apologies for my slow response rate. Hopefully I’ll be more attentive to the email notifiers going forward
I would like to ask about this, the kWh is like that it consumes 3000W right now or that it consumed like 1500W during 1 hour when it was half of the time off (3000W appliance)?
Watt Hours (Wh) is a measurement of “momentary” power over time (aka energy consumed). A machine that draws 3000W (“momentary” power) over 1 hour has consumed 3000 Wh (=3kWh).
And as you point out, a 3000W machine that was turned on only 30 minutes in the last hour will have consumed 1500Wh during that time. Of course, some machines can also run on a fraction of the maximum power. Thus a 3000W machine running at 50% load (=1500W) for 1 hr will also have consumed 1500Wh. If it ran only 30 minutes at 50% it will have consumed 1500W x 0.5h = 750Wh.
The sensors provide me how much it draws “W” when it refreshes when I turn it off, then it shows 0W immediately.
The statistics that you posted earlier show that during the observed time period your machine drew power between 714W to 2366W at an average of ~2280W. Because the average is close to the max, and the standard deviation is low, I’d say that it probably ran at a more or less constant load most of the time with minor fluctuations. The 714W were probably measured at the beginning or end when the machine was ramping up and down.
Remember, Power (W) is only a momentary snapshot of the power draw. So if the machine continuously increased the power draw in the first few seconds of being turned on until it reached its full load, you might get some measurements of anything between 0 and 23xx W during that time.
You should be able to look at a graph over the sensor data in order to understand how the machine behaves.
Unfortunately, the refresh time is quite random, mostly it’s about 1 minute. Sometimes it refreshes once in a minute, like 6 refreshes every second and then 1 minute of pause.
It’s possible that the device adjusts its reporting interval based on how often (or how much) the power draw has changed. Which is good because it will provide higher accuracy but avoids generating heaps of data/messages when it’s not necessary (e.g. power machine sits idle).
The way you would calculate the energy consumption (Wh) is to look at every data point in your sequence, and calculate the Wh for the “time slot” between the current measurement, and the previous based on the timestamps:
Power (W) x (Timestamp - TimestampOfPreviousDataPoint) (h) = Wh
.
E.g. 2310 W x (3s / 3600) h = 1.925 Wh
.
(The time in the example is 3 seconds converted to hours.)
Then you add up the calculated Wh for all of your data points in the sequence, and you will have your (estimated) energy consumption over the entire time period.
I think that’s what the integration
component (Integration - Riemann sum integral - Home Assistant) does for you!