Translate climate entity into energy sensor

Hi; I have a climate entity (hot tub) that I can’t monitor for energy consumption, however I have figured out how much energy it uses when the climate attribute changes from “off” to “heat”

I am wondering how I can count how long the attribute is set to “heat” and turn that into an energy sensor so I can track it as an “individual device” in energy monitoring

Hi, you need to make helpers. (time or counters)
and with the stats and historic you can track the durance.

so track the heat and make a template to make the price.

Create a Template Sensor using either the new format:

template:
  - sensor:
      - name: HVAC Activity
        state: "{{ state_attr('climate.hottub', 'hvac_action') }}"

or the old format:

sensors:
  - platform: template
    sensors:
      hvac_activity:
        friendly_name: 'HVAC Activity'
        value_template: "{{ state_attr('climate.hottub', 'hvac_action') }}"

Reference the Template Sensor in the History Stats Sensor:

- platform: history_stats
  name: Heating Today
  entity_id: sensor.hvac_activity
  state: 'heating'
  type: time
  start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  end: '{{ now() }}'

then the Utility Meter - Home Assistant

utility_meter:
  heating_time_daily:
    source: sensor.heating_today
    name: Heating Time Daily
    cycle: daily
  heating_time_weekly:
    source: sensor.heating_today
    name: Heating Time Weekly
    cycle: weekly
  heating_time_monthly:
    source: sensor.heating_today
    name: Heating Time Monthly
    cycle: monthly
  heating_time_yearly:
    source: sensor.heating_today
    name: Heating Time Yearly
    cycle: yearly

or with history stats. (example)

sensor:
  - platform: history_stats
    name: Bedroom Heating Today
    entity_id: sensor.bedroom_hvac_activity
    state: 'heating'
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

  - platform: history_stats
    name: LivingRoom Heating Today
    entity_id: sensor.livingroom_hvac_activity
    state: 'heating'
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

  - platform: history_stats
    name: Basement Heating Today
    entity_id: sensor.basement_hvac_activity
    state: 'heating'
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

Somebody has done the work for you:

1 Like

Amazing thank you

Excellent thanks for your help

1 Like