How to plot day/weekly/monthly usage for total_increasing sensors?

Hi,

I’d like to have a dashboard which plots some sensor values in a similar way to the default Energy dashboard – daily, monthly usage, etc. What’s the optimal way to achieve that?

I thought the statistics card would be the thing, but the bar chart just shows the absolute value for total_inscreasing sensors, rather than the difference between the final values in a time period.

Is the optimal solution here to employ the Utility Meter integration, and set it up for every sensor of interest, E.g. my time present in the office, amount of time running, time on Zoom, etc.

Seems like the creation of many copy sensors which have practically the same data, just for the purpose of plotting something on the dashboard. I don’t care about keeping this data, the unprocessed sensor is good enough for the historical record. It’s just about the frontend presentation. Is there some better way? Or am I overthinking this?

Does this work? Statistics Graph Card - Home Assistant

The problem is the the card only plots the value of the sensor. So for an e.g. energy use sensor, you have an always increasing bar.

Essentially an option in the card to plot the sensor differences betwen the end of the time-periods would be perfect, but I don’t think that’s there.

The only currently available option, as you had already mentioned, it to create a bunch of History Stats sensors.

It’s a good suggestion, you should post it as a Feature Request.

Turns out it’s already been suggested

Statistics feature request

I was looking for exactly this and managed to do it with the amazing apexcharts-card.

Example:

type: custom:apexcharts-card
graph_span: 7d
span:
  end: day
series:
  - entity: sensor.my_total_increasing_sensor
    type: column
    # Data from long-term stats: sensor sum for each day
    statistics:
      type: sum
      period: day
    # Abuse "group by" to diff each value with the previous one.
    group_by:
      duration: 1d            # group of just 1 value for that day
      start_with_last: true   # but also include the previous one
      func: diff              # and plot the diff between the two
4 Likes

Do you know if there’s a way to do this monthly but with an arbitrary start and end day? Say group by the 20th of this month to the 20th of next month.