I am very confused on how to measure power usage. I have a shelly meter for a plug, it has 2 sensors _power with “raw consuption” and “_energy” which i guess will always grow.
Now i have created a “statistics” sensor like this:
sensor:
- platform: statistics
name: My Plus Stats
entity_id: sensor.shellyplug_0_power
state_characteristic: mean
max_age:
days: 30
This should show the average consumption over the last 30 days but it shows 50W which would mean 36KWH per month, however this contradicts _energy values which says 1.2KW in one week of usage.
Then i tried to add a utility_meter to see daily and monthly usage:
Find the shelly counter that always grows, so that calculation is already done on the hardware level. It can be either one you mentioned, but it varies from platform to platform how the consumption is counted.
Once you figure which counter you are dealing with, create a utility meter, use the above mentioned counter as input sensor, set monthly reset cycle, determine if you are using delta values or absolute values (most likely the absolute ones, since you said it’s always growing) and that should be it.
This is the explanation for mean in the documentation:
The average value computed for all measurements. Be aware that this does not take into account uneven time intervals between measurements.
So assume you have the data for 30 days, and the power has been 100W for one minute in those 30 days. The rest of that period the switch was off, and power usage was 0W.
In that case your mean result would still be 50W, as that is the result of (0 + 100) / 2