Hourly history stats

Look at the edit history of the post. e.g Was:

binary_sensor:
  - platform: template
    sensors:
      heater_status:
        friendly_name: "Furnace Status"
        value_template: >-
          {% if is_state_attr('climate.thermostat_mode', 'hvac_action', 'heating') %}
            {{"on"}}
          {% else %}
            {{"off"}}
          {%- endif %}

Changed to this after my post:

binary_sensor:
  - platform: template
    sensors:
      heater_status:
        friendly_name: "Heater"
        value_template: >-
          {{ is_state_attr('climate.thermostat_mode', 'hvac_action', 'heating') }}

Ah, didnā€™t look into editing history. Evil thing it is :wink:

Yep I posted as I was writing up my own code, and kindly pasted in my refined code as I progressed. Sorry if that caused confusionā€¦ I didnā€™t notice posts below as I was editing (didnā€™t scroll down). On a side note, notice the logic is inverted in your example for the fan.

Should look something like this:

@truglodite Hi ! Found this via a forum search. What is the toolset you are using for that graph - looks great - please?

Thatā€™s Grafana querying from an InfluxDB.
I have the same setup.
This is how my graph looks like.

Hi,
I am new to home assistant and itā€™s a bit of a learning curve. How would i adapt this code for 2 heating zones? climate.family_room and climate.radiators

binary_sensor:
  - platform: template
    sensors:
      heater_status:
        friendly_name: "Heater"
        value_template: >-
          {{ is_state_attr('climate.thermostat_mode', 'hvac_action', 'heating') }}

iā€™ve tried modifying in several ways but do not get a state change. It feels very simple i though it should be

"{{ is_state_attr('climate.family_room.thermostat_mode', 'hvac_action', 'heating') }}"

For anyone who stumbles across this i found the solution

binary_sensor:
  - platform: template
    sensors:
      operatingstate_family_room:
        friendly_name: 'family room demand'
        value_template: "{{ is_state_attr('climate.family_room', 'hvac_action', 'heating') }}"
      operatingstate_radiator:
        friendly_name: 'radiator demand'
        value_template: "{{ is_state_attr('climate.radiator_stat', 'hvac_action', 'heating') }}"

Hi, just starting to use HA. I have already integrated my Netatmo thermostat and valvesā€¦ can you help me to use your stats example please. I do not see in my entity list sensor.thermostat_stateā€¦ How can I get it? thanks for your understanding and support

Could you please share how did you get a summary of the heating on/off time in your graph legend (alias by field)?

gave me an ā€œUnknownā€ output when I set hour to something larger than 12
Iā€™d like to set it between 22:00 and 15:00 (so that it includes the entire night)
Any idea on how to do that?

You should be able to go up to 23 when replacing hour. If your start is past your endā€¦ it wonā€™t work, thatā€™s timetravel.

subtract a day from the start if you want from 22 the last night to 15 today. e.g. - timedelta(days=1)

1 Like