Calculate runtime of underfloor heating

Hello,
I would like to calculate the daily runtime of my underfloor heating.
The state of the heating changes from the attribute

hvac_action: idle

to

hvac_action: heating

How can I count the time the heating is on and how can I visualize this?

Thanks for your help

1 Like
1 Like

:thinking:

platform template


  - platform: template
    sensors:
      heating_on_off:
        value_template: "{{ state_attr('climate.underfloor_heating','hvac_action')}}"

value template “idle” or “heating”

platform history stats

  - platform: history_stats
    name: Heating Time
    entity_id: heating_on_off
    state: "heating"
    type: time
    start: "{{ now().replace(hour=0, minute=0) }}"
    end: "{{ now() }}"

1 Like

Thank you for the detailed answer!
I have implemented it this way, unfortunately it does not work yet.

  - platform: template
    sensors:
      heating_on_off:
        value_template: "{{ state_attr('climate.smart_thermostat','hvac_action')}}"
  - platform: history_stats
    name: Heating Time
    entity_id: template.heating_on_off
    state: "heating"
    type: time
    start: "{{ now().replace(hour=0, minute=0) }}"
    end: "{{ now() }}"

I just changed the following:

entity_id: heating_on_off

against

entity_id: template.heating_on_off

because I got an error during validation. (Invalid config for [sensor.history_stats]: Entity ID heating_on_off is an invalid entity ID for dictionary value @ data[‘entity_id’]. Got ‘heating_on_off’. (See ?, line ?). )
Was that correct?

The sensor heating_on_off works great.
Only the sensor heating_time still returns an “unknown”.
Where is my error?

Got it

correct is

entity_id: sensor.heating_on_off

This is how it works. Thank you…

Can I also do a monthly evaluation for this sensor? So that I see a bar chart or similar of the last 30 days?

Last 30 days is in the docs.

Yes, but that is not what I want.
In the docs it says how I calculate a value of the last 30 days. But I want to compare the daily values for 30 days.

Ah OK. Got you. Hmmmmm