Gas meter - daily consumption


has anyone a good solution to view the daily consumption of a gas meter?

i read the value of my gasmeter via JSON

Number Gaszaehler                           "Zählerstand [%.1f m³]"                 <gasuhr>     { http="<[$.Wert)]"}


i ve only this here:

how can i add the daily consumption in Openhab2 ?


Homematic has a solution that works with the so called “Balgengaszähler”:

If you want to craft it by yourself:

A good idea to (loosely) couple sensors to openHAB is to transfer values using MQTT.

i get, you read your absolute consumption every minute?
from the graph I get you already use persistence?

Then it’s easy: add a rule and calculate the delta by setting the timespan for a day in a new item (which you could persist as well).

the problem is not the sensor, i ve this.
the problem is to create a item and a rule, so
that i can see the daily consumption.

perhaps like this:

Create an Number item. Link it to http binding in conjunction with jsonPath transform. Then use rrd4j persistence (simple) or InfluxDB/Grafana (more complex, better look) to create your chart.

thx, i ve this. but only for total counter. i need a counter value for every day.

my item:

Number Gaszaehler                           "Zählerstand [%.1f m³]"                 <gasuhr>     { http="<[$.Wert)]"}
Number Gaszaehler_Chart_Period              "Chart Period"

my rr4dj item:

Gaszaehler : strategy = everyMinute, restoreOnStartup

my sitemap:

Frame label="Zählerstände" {
		Text item=Gaszaehler{
 			Frame {
				Text item=Gaszaehler 
				Switch item=Gaszaehler_Chart_Period label="Gaszählerstand" icon="chart" mappings=[0="Stunde", 1="Tag", 2="Woche", 3="Monat", 4="Jahr"]
				Chart item=Gaszaehler period=H refresh=600000 visibility=[Gaszaehler_Chart_Period==0, Gaszaehler_Chart_Period=="NULL"]
				Chart item=Gaszaehler period=D refresh=3600000 visibility=[Gaszaehler_Chart_Period==1]
				Chart item=Gaszaehler period=M refresh=3600000 visibility=[Gaszaehler_Chart_Period==2]
				Chart item=Gaszaehler period=Y refresh=3600000 visibility=[Gaszaehler_Chart_Period==3]

i need more, i need values for every day.

Ahh - now it’s clear.

  1. Define an two additional number items. Dont link it to any channel. One serves as memory for the last sensor value, one as the daily counter.
  2. Setup a rule with a cron trigger. In that rule you have to:
    Determine the date change and set the daily counter to item to zero.
  3. Setup a rule triggered by a change of the item linked to your sensor. In that rule you have to:
    Add the difference between the last sensor value (memory item) and the current sensor value to your daily counter, then store the current sensor value in the memory item.

In obe of the Homematic forums there is a script to transform the regualr reading into different value. It should be not to complicated to move that to openHAB.

Here list the link:

I read out my total power usage and save it to InfluxDB and then get the daily usage by executing a query to the InfluxDB. This way I only persist one number and can get all information based on that.

I query the DB with a bash script using a midnight epoch time variable.

midnight=$(date -d "$today 0" +%s%3N)
SELECT max("value") - min("value") FROM "MeterDevice_Household_CounterTotal" WHERE time > '"$midnight"'ms'