Home Assistant Add-On: AMR2MQTT

I answer myself : wmbusmeters/wmbusmeters-ha-addon: To become the new public ha-addon repository for wmbusmeters. (github.com)

I created an extended script based on the original by Ben Johnson.
It adds the following capabilities:

  • Mix and match all the message types supported by ā€˜rtlamr’ from multiple meters
  • Specify MQTT_TOPIC_PREFIX
  • Specify or use default field for reading or any given meter and message type
  • Specify user-friendly name for the meter topic (in addition to the number)
  • Specify multiplier on a per meter basis (and to set a default)
  • Specify percentage and absolute deviations to identify and reject outliers
  • Specify whether to publish unchanged (i.e., duplicate messages)
  • Publish additional fields beyond just the core ā€˜consumption’ reading
  • Specify whether to ā€˜retain’ messages by meter (and to set a default)
  • Specify ā€˜rtlamr’ center frequency
  • Set debug level for more debug details and granularity

The core script is titled amr2mqtt.py
All the user settings are set in settings.py

See:

Again thanks to Ben Johnson for the inspiration and the starting code!

Hi Paul- if you’re still around (or if someone else knows!), could you please provide more detail on how you accomplished this? I believe I am in a similar situation. I have my electric meter reporting kWh, but can’t seem to integrate this into the Energy portion of HA.

I finally got this working a couple of days ago, but today I notice it’s no longer working. I suspect that it stopped working when I updated to HA Core 2025.1.0. Here’s what I see now when trying to start AMR2MQTT:

-----------------------------------------------------------
 Add-on: AMR2MQTT
 AMR2MQTT for Home Assistant
-----------------------------------------------------------
 Add-on version: 2.1.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 14.1  (aarch64 / green)
 Home Assistant Core: 2025.1.0
 Home Assistant Supervisor: 2024.12.3
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
Log level is set to NOTICE
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/02-set-timezone.sh
cont-init: info: /etc/cont-init.d/02-set-timezone.sh exited 0
cont-init: info: running /etc/cont-init.d/30-config.sh
[12:09:34] ERROR: Got unexpected response from the API: Service not enabled
cont-init: info: /etc/cont-init.d/30-config.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun amr2mqtt (no readiness notification)
services-up: info: copying legacy longrun rtl_tcp (no readiness notification)
s6-rc: info: service legacy-services successfully started
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Tuned to 100000000 Hz.
Allocating 15 zero-copy buffers
Signal caught, exiting!
Signal caught, exiting!
Traceback (most recent call last):
  File "/amr2mqtt/amr2mqtt.py", line 18, in <module>
    import settings
  File "/amr2mqtt/settings.py", line 32, in <module>
    MQTT_PORT = int(os.environ.get("MQTT_PORT"))
ValueError: invalid literal for int() with base 10: ''
[12:10:40] WARNING: Halt add-on with exit code 1
s6-rc: info: service legacy-services: stopping
[12:10:40] INFO: Service restart after closing
s6-svwait: fatal: supervisor died
s6-rc: info: service legacy-services successfully stopped
[12:10:40] INFO: Service restart after closing
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
Signal caught, exiting!
 Live

Hello, I am attempting to get this working but i am not seeing any debugging info in the mqtt explorer. Can someone point me in the right direction?

Hmm. Reboot of HA solved it.

Anyone know if there’s a way to make this work with ser2net so I can have the radio plugged into an other machine? My Home Assistant is a VM in a cluster and it moves from one physical host to another as-needed. I’d be happy to run the docker on the machine with the radio except that I don’t know how to run a Home Assistant addon as just a normal docker container.

Well, this is an awesome add-on!

Somehow after the install process though, the auto-discovery seems to have become borked. After a restart of Home Assistant the ā€œConsumptionā€ value disappears. I am able to fix this by manually publishing a mqtt message for now.

Publishing looks like an action like this (<meter #> is replaced with the actual number):

action: mqtt.publish
metadata: {}
data:
  qos: "0"
  retain: true
  payload: |-
    {
      "enabled_by_default": true,
      "state_class": "total",
      "device_class": "gas",
      "unit_of_measurement": "CCF",
      "unique_id": "amr2mqtt_<meter #>_Consumption",
      "value_template": "{{ value_json.Consumption }}",
      "availability": [
        {
          "topic": "amr2mqtt/bridge/state"
        }
      ],
      "device": {
        "identifiers": [
          "amr2mqtt_<meter #>"
        ],
        "sw_version": "2.1.2",
        "via_device": "AMR2MQTT",
        "manufacturer": "<manufacturer>",
        "model": "<model>",
        "name": "<meter #>"
      },
      "state_topic": "amr2mqtt/<meter #>",
      "platform": "mqtt",
      "name": "<meter #> Consumption"
    }
  topic: homeassistant/sensor/<meter #>/Consumption/config

Hello AD-Wright -
Were you able to get the consumption to show in Home Assistant. I’m running into the same issue.

Thanks,
Dale.

Yes, it seems to be working now. What I had to do was manually publish the MQTT discovery message. Basically, you can stick the data from my previous comment into the MQTT integration and publish the message that way, or (the simpler way) just create a blank automation, and set the action as ā€œmqtt publishā€ (Add Action → in search box, type ā€œMQTTā€ → Select MQTT: Publish). Then you can open up the action in yaml mode and paste in the above code. You’ll have to manually fill in the information in <these spots> to match your setup.

I did have it seemingly forget itself once, so I just keep the automation around so I can re-run it as necessary.

AD-Wright -
Thanks, I’ll give this a try this weekend.

I had a problem getting the Consumption sensor working - MQTT discovery found the other sensors but Consumption was not to be found.

I initially created a manual MQTT sensor but had trouble there as well, and discovered the reason.

My problem is that my unit of measurement was not valid.
if sensor is type Gas, valid measurements are
L, m³, ft³, CCF, MCF

If using GJ or another energy measurement, the sensor must be type ā€œenergyā€
Valid Energy units are
J, kJ, MJ, GJ, mWh, Wh, kWh, MWh, GWh, TWh, cal, kcal, Mcal, Gcal

Since I wanted to know billing units (GJ) and meter reading (ft³) I had AMR2MQTT have a multiplier of 1 with gas sensor in ft³ then created a helper template to make an Energy template sensor for the GJ reading based on my utility’s conversion factor.

I’m having trouble getting any data to appear, but I’m not sure why; from the logs, everything appears to be working. AMR2MQTT is finding the device (a NooElec NESDR Nano 2+), connecting to the MQTT broker, and the broker is auto-creating the HA device if I add a meter.

But no events ever come in for the created devices, and if I run AMR2MQTT without any sensors, no events at all (aside from the bridge state ā€œonline/offlineā€) are ever recorded.

My antenna’s about 15 feet from the meters, at least one of my meters (the iTron SK9AMI-4) is definitely supported, and I would expect some traffic regardless, but it’s just radio silence.

Is there anything in these logs that looks problematic?

 Add-on version: 2.1.2
 You are running the latest version of this add-on.
 System: Home Assistant OS 16.3  (amd64 / generic-x86-64)
 Home Assistant Core: 2026.1.2
 Home Assistant Supervisor: 2026.01.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
Log level is set to DEBUG
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/02-set-timezone.sh
[11:26:30] INFO: Configuring timezone
cont-init: info: /etc/cont-init.d/02-set-timezone.sh exited 0
cont-init: info: running /etc/cont-init.d/30-config.sh
[11:26:30] DEBUG: Validate config and look for suggestions
[11:26:31] DEBUG: Requested API resource: http://supervisor/services/mqtt
[11:26:31] DEBUG: Request method: GET
[11:26:31] DEBUG: Request data: {}
[11:26:31] DEBUG: API HTTP Response code: 200
[11:26:31] DEBUG: API Response: {"result":"ok","data":{"host":"core-mosquitto","port":1883,"ssl":false,"protocol":"3.1.1","username":"addons","password":"Oxahko0Iobi5Cae5eph3eeb8ahn9ee2iedo6aekoobuqueehaWeiphiz0kiar6qu","addon":"core_mosquitto"}}
[11:26:31] INFO: Ensure MQTT broker is reachable at core-mosquitto:1883 (60s timeout)
cont-init: info: /etc/cont-init.d/30-config.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun amr2mqtt (no readiness notification)
services-up: info: copying legacy longrun rtl_tcp (no readiness notification)
s6-rc: info: service legacy-services successfully started
[11:26:31] DEBUG: Setting MQTT details...
[11:26:31] INFO: Starting rtl_tcp daemon...
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Tuned to 100000000 Hz.
[11:26:32] INFO: Log level set to DEBUG
[11:26:32] INFO: Waiting for rtl_tcp...
Allocating 15 zero-copy buffers
[11:26:32] INFO: Handing over control to AMR2MQTT...
Signal caught, exiting!
Signal caught, exiting!
INFO:root:Starting rtlamr
INFO:root:Connecting to MQTT broker at core-mosquitto:1883
Allocating 15 zero-copy buffers
11:26:33.257965 decode.go:45: CenterFreq: 912600155
11:26:33.258236 decode.go:46: SampleRate: 2359296
11:26:33.258256 decode.go:47: DataRate: 32768
11:26:33.258265 decode.go:48: ChipLength: 72
11:26:33.258274 decode.go:49: PreambleSymbols: 32
11:26:33.258282 decode.go:50: PreambleLength: 4608
11:26:33.258290 decode.go:51: PacketSymbols: 736
11:26:33.258297 decode.go:52: PacketLength: 105984
11:26:33.258309 decode.go:59: Protocols: r900,scm,scm+,idm
11:26:33.258320 decode.go:60: Preambles: 00000000000000001110010101100100,111110010101001100000,0001011010100011,01010101010101010001011010100011
11:26:33.258351 main.go:111: GainCount: 29

Same here. Did you ever make any progress?

No; I stuck the radio dongle on a laptop and tested it with SDR++ and it seems to be working fine, so I don’t think it’s a hardware issue. Might just be that my meters aren’t broadcasting.

did you try setting meters to [] in the config? This would check for any meters around.

I did; I let it run for a couple days with no meters configured, but none were picked up.

oh I’m sorry, I recall I got several meters shortly after starting the add on. I don’t see anything wrong in your logs, mine ends similarly:

11:01:27.740438 decode.go:45: CenterFreq: 912600155
11:01:27.740802 decode.go:46: SampleRate: 2359296
11:01:27.740814 decode.go:47: DataRate: 32768
11:01:27.740818 decode.go:48: ChipLength: 72
11:01:27.740823 decode.go:49: PreambleSymbols: 21
11:01:27.740829 decode.go:50: PreambleLength: 3024
11:01:27.740834 decode.go:51: PacketSymbols: 96
11:01:27.740839 decode.go:52: PacketLength: 13824
11:01:27.740846 decode.go:59: Protocols: scm
11:01:27.740852 decode.go:60: Preambles: 111110010101001100000
11:01:27.740857 main.go:125: GainCount: 29

Hi all,

I am trying to figure out whether AMR2MQTT supports selecting a specific RTL-SDR device when more than one dongle is connected to Home Assistant OS.

My setup:

  • Home Assistant OS 18.1 on Home Assistant Green

  • Home Assistant Core 2026.7.1

  • AMR2MQTT add-on version 2.1.2

  • RTL-SDR devices:

    • Nooelec NESDR SMArt v5, serial 54118843
    • Realtek RTL2838UHIDIR, serial 00000001

Use case:

  • I use AMR2MQTT with the Realtek dongle to read my gas meter using SCM.
  • I use the Nooelec dongle with RTL-HAOS / rtl_433 for other IoT devices and multi-frequency hopping.

The issue is that when both SDRs are connected, AMR2MQTT appears to always select device 0. In my current setup, device 0 is the Nooelec dongle, which is already being used by RTL-HAOS, so AMR2MQTT fails to start.

Relevant log:

Found 2 device(s):
  0:  Nooelec, NESDR SMArt v5, SN: 54118843
  1:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
usb_claim_interface error -6
Failed to open rtlsdr device #0.

If I disconnect the Nooelec and leave only the Realtek connected, AMR2MQTT starts correctly and rtlamr begins decoding:

Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuned to 100000000 Hz.

INFO:root:Starting rtlamr
INFO:root:Connecting to MQTT broker at core-mosquitto:1883
decode.go:45: CenterFreq: 912600155
decode.go:59: Protocols: scm

Current AMR2MQTT config:

meters:
  - id: REDACTED
    protocol: scm
    name: REDACTED
    type: gas
    multiplier: 0.01
    unit_of_measurement: CCF

mqtt:
  host: core-mosquitto
  port: 1883
  username: mqtt
  password: REDACTED

home_assistant_discovery_enabled: true
log_level: info

Questions:

  1. Is there any supported way in AMR2MQTT to pass a device index or serial number to rtl_tcp, such as rtl_tcp -d 1 or a serial-based selector?

  2. If not, has anyone successfully patched or forked this add-on to expose a config option like this?

rtl_tcp_device: 1

or:

rtl_tcp_device: "00000001"
  1. Is the better long-term approach to retire AMR2MQTT and use RTL-HAOS / rtl_433 for the gas meter too, assuming rtl_433 can reliably decode my meter as ERT-SCM?

I am trying to avoid a fragile workaround where USB enumeration order determines whether AMR2MQTT works after a reboot. I am also wondering what the most durable path is for a multi-SDR Home Assistant setup.

Thanks in advance.