Skip to content

Commit

Permalink
Add support for R900 and R900BCD
Browse files Browse the repository at this point in the history
  • Loading branch information
bmjones2 committed Dec 7, 2024
1 parent 728ddce commit 6fdd2ec
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions amr2mqtt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ print("rtltcp started, waiting 4 seconds")

# start the rtlamr program.
rtlamr = subprocess.Popen([settings.RTLAMR,
'-msgtype=idm,scm,scm+',
'-msgtype=idm,scm,scm+,r900,r900bcd',
'-format=json'], stdout=subprocess.PIPE)
print("rtlamr started, waiting 4 seconds")
time.sleep(4)
Expand Down Expand Up @@ -96,6 +96,14 @@ while True:
parsedmessage = parsedjson["Message"]
parsed_id = parsedmessage["ERTSerialNumber"]
type = "idm"
if parsedjson["Type"] == 'R900':
parsedmessage = parsedjson["Message"]
parsed_id = parsedmessage["ID"]
type = "r900"
if parsedjson["Type"] == 'R900BCD':
parsedmessage = parsedjson["Message"]
parsed_id = parsedmessage["ID"]
type = "r900bcd"

# make sure the meter id is one we want
meter_id = int(parsed_id)
Expand All @@ -106,4 +114,4 @@ while True:
send_mqtt('readings/' + str(meter_id) + '/'+type, amrline)

except:
time.sleep(2)
time.sleep(2)

0 comments on commit 6fdd2ec

Please sign in to comment.