Sensor for 'how long was heating on today'?

Create a Template Sensor using either the new format:

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

or the old format:

sensors:
  - platform: template
    sensors:
      hvac_activity:
        friendly_name: 'HVAC Activity'
        value_template: "{{ state_attr('climate.living_room', '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() }}'
15 Likes