Graphing cumulative heat run time

I have just installed ecobee thermostats in my house and I am trying to graph the total run time each day. I have tried a statistics sensor but the problem is when I create a sensor to track run time, it logs the latest value all day and then when I go to graph the run time it adds up ALL the values.

It’s easier to explain with an example. Suppose that the heat for a zone runs for an hour at 10 am, an hour at 1 pm and an hour at 3 pm. If I look at the graph it will show me over 6 hours of run time because it adds up all the sensor values for the whole day.

How do I get it to just count the total run time instead of adding up each time the history sensor gets logged?

I should explain that I am not talking about the built in history graph but rather I am using the apex chart card loaded through HACS. The built in history graph just shows the run time increasing all day which is also not what I want.

I use a history_stats sensor entity. It’s basically a copy/paste of the example code in the docs. Keeps track of how long some entity has been in the desired state.

- platform: history_stats
  name: Furnace On today
  entity_id: binary_sensor.furnace_on
  state: 'on'
  type: time
  start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  end: '{{ now() }}'

Looks like I could simplify the replace() code (see docs).

I use a gauge card in the HA dashboard to show runtime throughout the day.

image

Not familiar with Apex chart card so not sure if this sensor type meets the requirements for that.

That works fine to show the increasing time during the day. What I want to do is to have a bar chart where each bar shows the total run time for a day. I would like to show maybe a week’s worth of data.

Something like this

CloseRTH~2

The value at the end of the day, or the maximum value in a single day, represents the total runtime for the day.

The Apex chart card seems pretty flexible. Maybe you can configure it to show the last value of the day, or the maximum value during the day? My sensor is being pushed to InfluxDB and in Grafana I just have a query for the last value of the day.

The Youtube video linked to from the integration docs shows an example of what you are trying to achieve, using Apex Chart.

Thanks I didn’t notice that video, I just watched it and it seems like what I want, key is the ‘last’ keyword he uses. I’ll try it when I get home. Thank you again.

Technique from video worked great, thanks

1 Like

Care to share the technique or link? It’s not clear what video you are referencing.

https://www.home-assistant.io/integrations/history_stats/#video-tutorial

1 Like

Thank you! Appreciated.