Get your smart electric, water and gas meter scm readings into home assistant with a RTL-SDR

My meters id number label has two numbers before the detected number in the scan.
I didn’t notice that at first.
Could be padding numbers on your label as well?

I actually figured out that one of those ids is my gas meter. So it looks like the gas meters in the neighborhood are broadcasting, but not the electric meters. At least I’ll get some data on our gas usage!

Thanks. With your directions, I got it setup.

Right now I only found my electric meter, so I used your template to get a scm message. The posted amrscm2mqtt did not work for me, but I used your scm code to edit the original file from the repo.

Hey, I have migrated my MQTT server to include username and password authorization.

Do any of you have this working? I keep getting socket errors even after I fill in the username and password into the settings.py

I don’t know which server you are using, but I have been using Mosquitto from the beginning with username and password authorisation without problems. I had followed this guide to setup Mosquitto

I made a docker container for this capability. https://github.com/jdeath/RTLAMR2MQQT

You will need to clone it and install it manually in your addons folder. (I don’t know how to make it a hassio repository).

It takes a while to build because its compiling a few things. There are extra libraries in the docker, which I will try to pull out eventually.

6 Likes

Awesome stuff!

1 Like

Hey @david1 did you ever get this working with PG&E? If so, please let me know what SDR you used and any other tips!
Thanks

Thanks for sharing. I have been monitoring for a few hours and my meter hasn’t been showing up. I came across your post after some googling. Have you had any luck with this?

No luck…I tried to convince my gas service provider to swap out the old meter for a newer one, but they didn’t want to do it.

1 Like

Thank you for the instructions. It took me a few hours but I was able to get through it. After scanning the terminal to find my gas and water meter I realized I won’t be able to make good use of the tool. My water meter (Neptune R900) has an encrypted Flexnet device to communicate with the utility and my gas meter (Itron 40GB Type 2) isn’t compatible (wake up mode?). No luck here!

I think I have a similar gas and water meter. No luck on the water meter. The gas meter does show up when the utility truck drives by 1-2 times a month. Kinda fun when it does, but not that useful.

1 Like

That’s good to hear! I was hoping it would trigger when they drove by. I’ll be finding out in a few days…

Nope, I plan to get one of these soonish https://www.smappee.com/us/gas-water-monitor.html

Thanks for posting this. This is what I needed to get mine working as well. Unfortunately with your script I am getting a ton of messages. Is there any way to modify it so that it only sends a new message once every five minutes or so? I’m guessing I need to put a sleep in there somewhere but I’m not skilled enough to know where. Any help is most appreciated.

Can the code be updated to read AMR first then read Weather stuffs? i.e.

Wondering if this will work --> move the rtltcp and rtlamr processes inside the infinite while loop and add the weather process? Basically, the idea is start the processes each iteration of the loop and shut them down at the end of the loop.

Sorry - having issues with my SDR antenna – Probably i have a bad one – so couldn’t try it yet.

I’m guessing this isn’t a supported model?

@biochemguy, have you looked at adding SCM+ message support?

@jcgoette
I had a quick look at the list and could not find the model number, I am guessing that it’s unfortunately probably not supported.

@fermat1357
I don’t have enough programming skills to do it. It would be a super cool project though, as it could expand the use of a single rtl-sdr. Probably fairly simple for someone with more knowledge.

@dcnoren
SCM+ message should be fairly easy to do. I don’t have a meter to test it with, but this projects uses rtlamr to look for the specific data that we want. Since SCM+ is supported by rtlamr, it should be no problem to support it.

You would have to modify the amrscm2mqtt file to match your type of meter. Here is probably the changes you would have to make to the program:
(Note that I have edited to simply show a section of the program and added a few comments)

# start the rtlamr program.
rtlamr = subprocess.Popen([settings.RTLAMR,
    '-msgtype=scm',
    '-format=csv'], stdout=subprocess.PIPE)
# In SCM and SCM+ msgtype should be the same.
while True:

    try:
        # rtlamr's readline returns byte list, remove whitespace and convert to string
        amrline = rtlamr.stdout.readline().strip().decode()
        # split string on commas
        flds = amrline.split(',')

        if len(flds) != 9:

            # proper SCM results have 9 fields. If SCM+ have more fields, you can adjust this number.
            continue

        # make sure the meter id is one we want - Change this if the meter ID is in another field.
        meter_id = int(flds[3])
        if len(settings.WATCHED_METERS) and meter_id not in settings.WATCHED_METERS:
            continue

        # get some required info: current meter reading, current interval id, most recent interval - SCM+ Change this if there is more fields in the data
        read_cur = int(flds[7])

basically this takes the data and separates the meter data in different fields. The fields are createdby spaces in the meter reading. You just have to select the correct field for the data you are looking for.

Here is an example of a message divided into fields by running rtlamr and converting it to csv:

rtlamr -format=csv

2020-11-01T23:28:31.614978734-04:00,0,0,16911175,7,0x0,0x3,4822556,0x7f33

Field 3 is the meter and field 7 is the reading (the data is separated by commas and fields count starts at 0).

Hope this helps…

1 Like

Anyone know if there is a way to do this with HassOS addon?

I’ve been using RTLAMR with a homebrew PHP/SQLite DB on a Raspberry Pi for a couple years and love it (Dominion VA Power the meter ID is on the bottom below/behind the dial plate) but I’d love to bring it over into my home automation system to reduce how many machines I have to maintain.

With a bit of math on the previous/current readings, you can also compute the “real-ish time” power consumption of your house (e.g. average over past 2 minutes) without the need for any expensive gear or modifications to your breaker panel.

I know I can just MQTT the data from the Pi into HomeAssistant (probably will) but it would be a lot cleaner to do it all in HomeAssistant on the one server.

I also need to figure out how to read our water meter (which I believe is wireless) later…