Gas meter - daily consumption


(Ralf B.) #1

hello

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="<[http://192.168.1.15:60000:JSONPATH($.Wert)]"}

02

i ve only this here:

how can i add the daily consumption in Openhab2 ?

thx/regard


(rbausdorf) #2

Homematic has a solution that works with the so called “Balgengaszähler”: https://www.elv.de/homematic-zaehlersensor-gas-es-gas.html

If you want to craft it by yourself: http://monitor4home.com/beispiele/gaszahler-mit-reedkontakt-ausstatten

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


(Thomas Binder) #3

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).


(Ralf B.) #4

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:


(rbausdorf) #5

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.


(Ralf B.) #6

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="<[http://192.168.1.15:60000:JSONPATH($.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 
			} 
			Frame 
			{
				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.


(rbausdorf) #7

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.

(Thomas Bail) #8

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: https://homematic-forum.de/forum/viewtopic.php?f=27&t=23104


(Dennis Von Der Bey) #9

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'