For my meter (Itron 60W-R), I get total cumulative consumption scaled by 10, therefore 10831 = 1083.1m3. I do not understand why two of your readings with the same meter have such different readings. Do you neighbours readings look the same?
Hi @mladem, I have gotten as far as being able to read use rtlamr to read all off the meter transmissions through the ssh terminal, but I am stuck how to get those mqtt packets to Hassio. I installed rtl-sdr and rtlamr on a dedicated Raspberry Pi and am am able to read the raw data quite well.
Do you have the rtl-sdr dongle on a dedicated raspberry pi and not the Hassio pi? Or is your Hassio and rtlamr on the same machine? I am stuck trying to get the rtlamr2mqtt.py to run correctly on the headless RPi and send mqtt data to Hassio.
my rtl-sdr is on an dedicated dongle. Please find below my code:
#!/usr/bin/env python3
import sys
import json
import subprocess
import time
import paho.mqtt.client as mqtt
client = mqtt.Client("power-meter-pi-zero")
client.username_pw_set(username="<USERNAME FOR MQTT>",password="PASSWORD FOR MQTT")
client.connect("<IP OF YOUR MQTT/HOME ASSISTANT>", 1883, 60)
client.loop_start()
# Delay. Useful for now while I try and figure out systemd targets. I've had
# issues where if both powermon and rtlamr start immediately at boot, no data is
# reported. The delay solves the problem but I don't like it.
time.sleep(2*60)
# make sure to replace /home/pi/go/bin/rtlamr with your path for rtlamr and
proc = subprocess.Popen(['/home/pi/go/bin/rtlamr', '-filterid=<ID OF YOUR UTILITY METER>', '-format=json'],stdout=subprocess.PIPE)
prev_reading = None
try:
while True:
line = proc.stdout.readline()
if not line:
break
try:
data=json.loads(line.decode("utf-8"))
except ValueError:
print("Error")
else:
reading = data['Message']['Consumption']
client.publish("home/electricmeter",reading,0,True)
if prev_reading is not None:
client.publish("home/electricmeterdiff",float(reading-prev_reading),0,True)
prev_reading = reading
except KeyboardInterrupt:
print("interrupted!")
client.loop_stop()
client.disconnect()
Make sure to replace with your own info where it is indicated, e.g.
i finally got go installed and configured, i downloaded the github repository and went into the directory rtlamr, but when i tun rtlamr, nothing happens??
This is the code i feel it’s erroring out on, if i just run the david@raspberrypi:~$ /home/projects/bin/rtlamr -filterid=1481976504 -msgtype=r900 -format=json
it works fine
I have a feeling 10 minutes may not be enough time for it to “pick up” on the signal, so do i need to extend it? i got the script from someone else on this forum and they had it working fine…, this is for a water meter
Before running the script initially try to run rtlamr to see what signals you are able to sniff out.
/home/projects/bin/rtlamr -msgtype=r900
you can try different values for msgtype: all, scm, scm+, idm, netidm, r900 and r900bcd depending on your type of meter and computational power. Once you identify YOUR meter enter the meter number in ‘-filterid=XXXXXXXXXXXXX’.
Thanks for the response, I did! I was able to run this without the quotes of course just fine, however I didn’t wait long enough to see the results since I assume it’s only outputted 4 times a day or so, ‘/home/projects/bin/rtlamr’ , ‘-filterid=1481976504’ , ‘-format=json’ , ‘msgtype=r900’ no errors were ran, if I didn’t have the filterid I would get responses immediiately
This is the code i feel it’s erroring out on, if i just run the david@raspberrypi:~$ /home/projects/bin/rtlamr -filterid=1481976504 -msgtype=r900 -format=json
it works fine