Processing AMR Gas Meter Readings for daily / weekly / monthly consumption

It looks like this topic was previously covered, but has now been archived. (1) (2) (3)

I have a very simple python script on a computer with an rtl-sdr dongle using rtlamr to filter out my gas meter’s amr broadcast and pass the value to enomcms.

The value is consumption in cubic feet for the life of the meter.

So for example, the calls I make to enomcms over the rest endpoints are like:

http://myserver/emoncms/input/post?node=1&json={gas:358880}&apikey=myKey
http://myserver/emoncms/input/post?node=1&json={gas:358894}&apikey=myKey

Right now all I have the input do is “log to feed”

The result is that I can at least now see the meter’s reading increase over time.

How can I do the following:

  • Capture the delta from the last reading and add that to the daily consumption (as cubic feet)

  • Multiply the daily consumption by BTU (as my gas bill does) to get the daily THERMS

  • Multiply that by my delivery and gas charges to get the daily cost

Thanks for any help!

And, for anyone interested in the most basic of scripts to get going using rtlamr:

#!/usr/bin/python
import json
import sys
import subprocess
import urllib2

proc = subprocess.Popen(['/home/sean/go/bin/rtlamr', '-filterid=XXXXXXX', 'format=json'],stdout=subprocess.PIPE)
while True:
    line = proc.stdout.readline()
    if not line:
            break
    data = json.loads(line)
    url = "http://myserver/emoncms/input/post?node=1&json={gas:%s}&apikey=mykey" % (data["Message"]["Consumption"])
    print url
    response = urllib2.urlopen(url)
    status = response.read()
    print status

I am also looking exactly for this function!
Is it possible to create a virtual feed, that takes the energy value (in kWh) of 12/03/2018 00:00 and subtract the feed value from 11/03/2018 00:00
Thanks for help!

I’m not sure that I’m doing this correctly, but, what i’ve done is set up my node1 input to log to feed and then add to an accumulator. (I used the wh accumulator, probably should have just used a regular accumulator). This will create a feed that keeps track of the delta between the gas readings.

This gives me a constantly increasing count of consumption in units, in my case cubic feet.

From there, I create 4 virtual feeds:

Therms is the unit that my billing is based off of and the equation for that looks to be:

(Consumption in Cubic Feet / 100) * 1.07

Then, I use this value to calculate the BGS (cost of gas) and DEL (delivery) charges as their own virtual feeds and add them together as a final Cost feed:



The result is 4 ever increasing virtual feeds which I then can use the Delta graphing function to show the daily consumption / charges:


I then add these to a dashboard and configure my graphs to show the daily intervals:

One thing I could really use help with is making the rtlamr process more bulletproof.

I found a great guide about using rtlarm as a systemd service and I can get rtl-sdr working as a service, however, I can NOT get my python script working as a service on either the enomcms image or a secondary raspberry pi 3 running raspbian stretch.

I get failures about policy kit, which I’ve installed, etc, but just can’t get it to run my script as a service.