Calculate 'on' time by watt usage

Hi all,

Don’t know if I have put this in the right category, hope so.
I have a powerplug for a furnace burner that is on all the time to log the power consumption used. I would also like to know how long time the burner are ‘on’ for a day by looking at the watt usage. When the burner is off the watt usage is 0. Is it possible to sum up the time / hours logged when the watt have been above 0 ? If I have that number I can estimate how much oil was used :slight_smile:

Thanks.

Template binary sensor that records whether it’s on or off based on the threshold you want (might be slightly above zero, perhaps).

History stats sensor that reads that binary sensor. Note the time limit of that sensor, though — you may need to do a daily automation that takes the end-of-day number and adds it to an input_number helper or something, if you need longer-term records.

Thank you :slight_smile: will give it ago.

I do this in my system.

  1. Create a binary template sensor that is either on when the power is above a threshold (10 watts?)
  2. Create a template sensor that is 0 if the binary template sensor if off, otherwise it is the GPH that your burner uses.
  3. Set up a reiman integration template using left mode and connect it to the sensor in 2, this will keep a count of how much oil/gas is used
  4. Hook up some utility meters, I do a daily, weekly and monthly.

Here’s a reference implementation


homeassistant:
  customize:
    sensor.furnace_burner_gas_usage:
      unit_of_measurement: G

sensor:
  - platform: template
    sensors:
      furnace_burner_gallons_per_hour:
        unit_of_measurement: G
        value_template: >-
          {% if is_state('binary_sensor.hvac_heat_demand','on') -%}
          1.3
          {%- else -%}
          0.0
          {%- endif %}
      furnace_burner_total_gas_yesterday:
        value_template: >-
          {{ state_attr('sensor.furnace_burner_gas_today_running','last_period') }}
        unit_of_measurement: G
      furnace_burner_total_gas_week:
        value_template: >-
          {{ state_attr('sensor.furnace_burner_gas_weekly_running','last_period') }}
        unit_of_measurement: G
      furnace_burner_total_gas_month:
        value_template: >-
          {{ state_attr('sensor.furnace_burner_gas_monthly_running','last_period') }}
        unit_of_measurement: G

  - platform: integration
    source: sensor.furnace_burner_gallons_per_hour
    name: furnace_burner_gas_usage
    unit_time: h
    method: left
    round: 2

utility_meter:
  furnace_burner_gas_today_running:
    source: sensor.furnace_burner_gas_usage
    cycle: daily
  furnace_burner_gas_weekly_running:
    source: sensor.furnace_burner_gas_usage
    cycle: weekly
  furnace_burner_gas_monthly_running:
    source: sensor.furnace_burner_gas_usage
    cycle: monthly

recorder:
  include:
    entities:
      - sensor.furnace_burner_energy_today_running
      - sensor.furnace_burner_gas_today_running
      - sensor.furnace_burner_gas_weekly_running
      - sensor.furnace_burner_gas_monthly_running
      - sensor.furnace_burner_total_gas_yesterday
      - sensor.furnace_burner_total_gas_week
      - sensor.furnace_burner_total_gas_month
      - sensor.furnace_burner_gas_usage
      - sensor.furnace_burner_gallons_per_hour

1 Like

Thanks Man, just what I was looking for and with even code examples. Great stuff will try it out.
Cheers :slight_smile: