Log Furnace Time on in hours

I have the Z-wave GC-TBZ48 Thermostat. Works great. I have the thermostat card on my main page. I enjoy looking at the history on the thermostat. I would like to keep track of how much time my furnace spent heating. The data is there I am just not sure how to use it.

This is kind of what I am looking for on the dashboard hopefully:

I have influxdb and graphana installed. But to be honest I hardly know how to use it.

Sorry if its the wrong topic. I am not sure where this would fit. Thanks!

I beleive we have the same thermostat.

You will need to get a sensor to gather the operating state

Then you can use the history stats sensor to collect the total time. I have mine seperated into cooling and heating, however, if you are just intrested in how long its ‘on’, you could add both states to the history stats sensor during setup.

To get it to display as you show above, I am not sure how to do. You can easily record to a file and record that data, however, I am not sure how to display it in the UI in that fashion.

I display a couple of days to display in the UI and 7 days in history. Using the history tab and displaying over time generally gives more insight as to how things are behaving.

1 Like

Awesome! I am going to have some fun tinkering tonight! Thank you.

I save records of my HVAC system run times to text files. Since I back up the RPi running HA to my NAS, I can grab these files and analyze them using any tool I want. On HA, I just display the state of the system and the total run time so far today, and the total for yesterday:
image

1 Like

I really like your way of thinking on this! I would love to have similar stats and do a lot of Python programming so I’m wondering, what did you use to create your text file? Pure Python? Do you trigger writing that file each time your furnace state switches to “off”?

With HA, you can write to a file using the file notification integration. I used to write to the file at 11:59 every night the value for the day from the history_stat sensor.

1 Like

No real coding; all native HA stuff. For example, here’s how I keep track of how long the air conditioner has been on for:

  1. The Honeywell thermostat platform is defined in configuration.yaml:
climate:
  - platform: honeywell
    username: [email protected]
    password: Password 
    scan_interval: 180

This platform does C2C with the Honeywell server to get the names and attributes of my thermostats. These become climate entities in HA. Of course any integration which results in a climate entity would work. My 1st floor thermostat’s name in HA becomes:
climate.1st_floor

  1. I use a template platform (again in configuration.yaml) to create a sensor called 1st_floor_action, which gets the attribute hvac_action from the first floor thermostat:
sensor:
  - platform: template
    sensors:
      1st_floor_action:
        friendly_name: "1st Floor Action"
        value_template: "{{ state_attr('climate.1st_floor', 'hvac_action') }}"

Later in the same section (sensors:) I define two history_stats entities:

  - platform: history_stats
    name: AC on today
    entity_id: sensor.1st_floor_action
    state: 'cooling'
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

  - platform: history_stats
    name: AC on yesterday
    entity_id: sensor.1st_floor_action
    state: 'cooling'
    type: time
    end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    duration:
      hours: 24

The first one totals how long the hvac_action was cooling, from midnight until now.
The second one totals up all of yesterday’s cooling.
You can display these numerically or as a chart in Lovelace.

  1. I added a notify: section in configuration.yaml defining a file platform with a file name of ac_summary.txt:
notify:
  - platform: file
    name: ac_summary
    filename: ac_summary.txt
    timestamp: False
  1. I set up an automation to run early in the morning and write the value to this text file.

The autmation looks more complicated than it is. I’ve set multiple triggers so if HA is off line at 1:04 AM when I want it to run, it’ll try again a couple more times. Then I have a condition which verifies that the last_triggered date isn’t today, so it’ll only run once.

The important part is the action: section, where the date and ac_on_yesterday value are written to the file using notify.ac_summary.

- id: id_ac_summary
  alias: ac Summary
  trigger:
  - at: 01:04:00
    platform: time
  - at: 02:04:00
    platform: time
  - at: '14:04:00'
    platform: time
  condition:
  - condition: template
    value_template: '{{ now().strftime(''%x'') != as_timestamp(states.automation.ac_summary.attributes.last_triggered)
      | timestamp_custom(''%D'') }}'
  action:
  - data_template:
      message: '{{ now().strftime(''%x'') }},{{ states.sensor.ac_on_yesterday.state
        }}'
    service: notify.ac_summary

The resulting text file looks something like this:

Home Assistant notifications (Log started: 2020-06-06T05:04:00.043849+00:00)
--------------------------------------------------------------------------------
07/09/20,2.72
07/10/20,2.76
07/11/20,0.96

This format is pretty easy to import into or link from any spreadsheet, database or analysis software.

5 Likes

Working on this now. You think we have the same themostat (Nortek GC-TBZ48) ? I was wondering how you have it added to home assistant. Mine is not set proper. It turns on every hour just to warm up to 1 whole degree. Do you have a climate entry in your config.yaml?

This is what my furnace is currently doing.

You can get the display you want but it will take a small amount of work.

Here is an example of one that I have and tracks the state of my motion sensor events:

ex2

First install the “hass-variables” custom integration. You can find it in HACS or you can install it manually.

Then create a new variable entity with the attributes you want.

variable:
  last_motion:
    value: 'Not set'
    restore: true
    attributes:
      icon: mdi:map-marker
      name: 'Last Motion'

Then you need to create an automation to update the attributes of the variable entity.

Here is mine that does that:

  - alias: 'AS Update Last Motion'
    initial_state: 'on'
    trigger:
      - platform: state
        entity_id:
          - binary_sensor.comp_rm_motion_template
          - binary_sensor.mbr_motion
          - binary_sensor.spare_bedroom_motion
        to: 'on'
      - platform: state
        entity_id:
          - sensor.computer_room_camera_motion
          - sensor.livingroom_camera_motion
          - sensor.diningroom_camera_motion
          - sensor.garage_camera_motion
          - sensor.kitchen_camera_motion
          - sensor.deck_camera_motion
        to: 'Detected'
    action:
      - service: variable.set_variable
        data:
          variable: last_motion
        #data_template:
          attributes:
            history_1: "{{ states('variable.last_motion') }}"
            history_2: "{{ state_attr('variable.last_motion','history_1') }}"
            history_3: "{{ state_attr('variable.last_motion','history_2') }}"
            history_4: "{{ state_attr('variable.last_motion','history_3') }}"
            history_5: "{{ state_attr('variable.last_motion','history_4') }}"
            history_6: "{{ state_attr('variable.last_motion','history_5') }}"
            history_7: "{{ state_attr('variable.last_motion','history_6') }}"
            history_8: "{{ state_attr('variable.last_motion','history_7') }}"
            history_9: "{{ state_attr('variable.last_motion','history_8') }}"
            history_10: "{{ state_attr('variable.last_motion','history_9') }}"
      - service: variable.set_variable
        data:
          variable: last_motion  
          value: >
            {{ trigger.to_state.attributes.friendly_name }} : {{ as_timestamp(trigger.to_state.last_changed)| timestamp_custom('%x, %X') }}

then to display in the frontend:

  - type: entities
    title: Motion Sensor History
    show_header_toggle: false
    state_color: true
    entities:
      - type: custom:entity-attributes-card
        heading_name: Name
        heading_state: State
        entity: variable.last_motion
        filter:
          include:
            - variable.last_motion.history_1
            - variable.last_motion.history_2
            - variable.last_motion.history_3
            - variable.last_motion.history_4
            - variable.last_motion.history_5
            - variable.last_motion.history_6
            - variable.last_motion.history_7
            - variable.last_motion.history_8
            - variable.last_motion.history_9
            - variable.last_motion.history_10

I only have the last 10 events saved/viewed but you can have more if you want. I have another variable that saves two weeks of daily data (14 data points) I track. But you have to add all of them line by line. It’s not hard but it is a bit more work and more code.

1 Like

Added through zwave like any other device. Mine is powered by the c wire, on battery I couldn’t get it to communicate with HA reliably

What sparked my wanted to track my furnace is that it goes on every hour on the hour. I am trying to configure it so if its below 62 it will heat it up to 67. So my Furnace is not on all the time for short periods. This is what sparked my wanted to track time on. I made a new post trying to troubleshoot the issues I am having with my thermostat here: Furnace activating too much - GC-TBZ48