Confused trying to calculate energy usage

Hi there,

I have a MVHR (heat recovery system) which helpfully sends the number of watts it is using every second to HA. I’d like to calculate it’s daily kWH and have tried a few things but with odd results.

First up I tried a utility meter, but then realised the frequency of updates was causing larger than normal values in the meter. ie, only running for a few minutes and already over 200… There doesn’t appear to be a frequency option in the utility config:

  mvhr_daily_energy:
    source: sensor.heat_recovery_system_power_usage
    cycle: daily
    name: MVHR Daily Energy Usage
    
  mvhr_preheater_daily_energy:
    source: sensor.heat_recovery_system_preheater_power_usage
    cycle: daily
    name: MVHR Preheater Daily Energy Usage

I also tried this (some of the keys are incorrect and I can’t remember what they needed changing to:

sensor:
  - platform: statistics
    name: power_per_minute
    entity_id: sensor.heat_recovery_system_power_usage
    sample_size: 60 # This is assuming you are getting 1 sample a second.  Adjust otherwise.    

  - platform: template
    sensors:
      realtime_power:
        friendly_name: Realtime Power
        value_template: "{{ state_attr('sensor.power_per_minute', 'total') / (1000 * 60) }}"
        unit_of_measure: kwH 

Here I was getting super small values and I’m not sure why. I think its the ‘sample size’ and ‘unit_of_measure’ values that need tweaking probs ‘unit_of_measurement’ and ‘sampling_size’. Dev tools was reporting a 0.0000n increase per day.

The MVHR is consistently using reporting around 24w and runs all the time which I would think is about 0.5kWh per day?

Power and energy are not the same thing, like distance (km) is not the same thing as speed (km/h).

Utility meter is merely resetting an ever increasing value in regular intervals.

You would first have to calculate the energy from your power with a Riemann integration sensor.

Then you can base a utility meter on that, or just use the energy dashboard, as this will show the energy aggregated for different time spans.

1 Like

Riemann sum integral Integration.

Or Powercalc will do this for you.

Perfect, got it working now!
Thanks for the help