Calculate gas furnace running costs without data from your meter

These sensors will calculate the gas cost of running your furnace. At a minimum, you will need a smart thermostat, or some other way of tracking the furnace on time.

# t = furnace on time
# 88000 = BTUh rating of furnace
# p = current gas price in currency/therm, either from a scrape sensor or a fixed value.
# 0.00001 is the conversion factor for therm to BTU
sensor:
  - platform: template
    sensors:
      furnace_gas_cost:
        friendly_name: "Furnace Gas Cost"
        value_template: >-
          {% set t = states('sensor.furnace_on_time') | float %}
          {% set p = states('sensor.current_gas_cost') | float %}
          {{(0.00001 * 88000 * t * p) | round(2)}}
        device_class: monetary
        unit_of_measurement: USD
binary_sensor:
  - platform: template
    sensors:
      furnace_heating_state:
        friendly_name: "Furnace Heating State"
        value_template: >-
          {{ is_state_attr('climate.thermostat', 'hvac_action', 'heating') }}

This is specific to my Honeywell thermostat. Yours will likely be different.

sensor
  - platform: history_stats
    name: Furnace On Time
    entity_id: binary_sensor.furnace_heating_state
    state: "on"
    type: time
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    duration:
      hours: 24

This sensor actually calculates the on time based off of the state of the binary sensor.

You can use a scraper to get the current rate or just enter it as a value. For example:

sensor:
  - platform: scrape
    resource: https://www.citizensutilityboard.org/gas/
    name: Current Gas Cost
    select: "p"
    index: 2
    value_template: '.{{ value.split(" ")[2] | replace (".", "") | replace ("¢","")}}'
    unit_of_measurement: "USD/therm"

This functions independently of the energy monitoring integration in home assistant. If you go that route, be sure to add device_class: gas, state_class: total_increasing, and last_reset: '1970-01-01T00:00:00+00:00' The way it handles units is weird, and I’m waiting for an update before I implement that fully.

2 Likes

Nice work, If you want a bit more accuracy you can clock your gas meter with only the furnace running on high stage (if multi-staged).

This can be different from the input rating on the unit.

You could probably also use powercalc for that and some tricks to have it considered as gas consumption, or see with the author to add an option to the component.

That would be ideal, however I don’t have a way of getting any data directly from my meter at the moment.

I was able to get it recognized as gas consumption, however it seems like the energy monitoring integration converts usage in m^3 to ft^3, but it uses the value before the conversion to do the cost calculation. Its weird, and I’d rather have a short term cost value than trying to monkey with the integration for long term tracking (for now).

You only need to manually clock it once.

Here is an example.

You sir are correct, I’ll try that when its not below zero :smiley:

powercalc doesnt need the meter. You can indicate how much it consumes while it’s on - it uses the on state of the entity.

How does that work? There is no interface to the energy (gas in this case) outside of measuring it’s consumption via the gas meter. You can get close by using the input rating of the equipment, but that is rarely accurate, unless the technician did a fantastic job when commissioning the equipment. That accuracy diminishes over time. (unless completed again)

Thankfully, with single stage equipment is quite easy to do, and you only need to do it once.

Hi,
I’m sorry to revive this topic, but I need ideas to calculate gas consumption. I’ve got a smart thermostat that reads % of furnace power on over time; knowing that if the 35kW furnace would be on at max power for 1h, it will consume 130703 BTUs circa. Can somebody help me to create a template to calculate real-time calculation to solve this equation?
Thanks

I suggest to look into https://github.com/bramstroker/homeassistant-powercalc .

Maybe https://github.com/bramstroker/homeassistant-powercalc#linear-mode is good enought, if not, I guess that the author can help or extend the integration - after all it says “PowerCalc is a custom component for Home Assistant to estimate the power consumption (as virtual meters) of lights, fans and other devices