Delta diagram

I have managed to get the reading from our gas meter into a sensor.

  - platform: mqtt
    name: gaszaehler
    unit_of_measurement: 'm³'
    icon: 'mdi:counter'
    state_topic: vb-home/gas/counter

If I click on that sensor, I get a diagram of the counter readings showing the stairs of the rising counter.
But I want to see the deltas (the hourly or daily consumption) between the values not the absolute values.

Is it possible to get such a graph with on board tools or do I need to use external programs?

You should be able to do all that within HA, some combination of these could do it:

1 Like

After some hours of thinking and trying something I must say that I have no idea, how to combine these three sensors to get any useful result.

  • The statistics sensor is useless without any detailed description: From where (which values) does it take its input? (What does 'number of samples mean? From which moment does the max_age count?) How do I access the change value? (I think that is what I need).
  • The history statistics sensor seems to be useless for this, since it can only return time spans, ratios or counts of boolean values.
  • The template sensor may be the correct tool to get the change attribute from the statistics sensor. But since I don’t know how to use the statistics sensor …

I thought calculating the consumption from a vector of counter values would be a simple an also very common task (in SQL it would be a simple query of maybe 10 lines, in python that could also be done in less than 10 lines of code) but with these badly described tools, … ??? These description are at most a memory aid for someone who had already used these tools many many times.

As I said: I have no idea how to begin.

Are there any examples how to do this or at least something similar?

From the history of the entity it is tracking.

From the time that the stats are generated.

any luck yet? Ihave the same issue, and I want a bar graph in a time-frame of 15 minutes.

gr. Remco

I tried out a little trick, under helpers, I created a utility meter, with a an automatic reset. This seems to do what i (and everyone in this thread) wants. Useable for inputs for a gauge on a dashboard too.

Current gasusage is almost nothing, mostly the pilot light of the heater and occasional warm water.