Using an inexpensive rtl-sdr dongle, it's possible to listen for signals from ERT compatible smart meters using rtlamr. This script runs as a daemon, launches rtl_tcp and rtlamr, and parses the output from rtlamr. If this matches your meter, it will push the data into MQTT for consumption by Home Assistant, OpenHAB, or custom scripts.
You can run this with Docker using the published image at ghcr.io/conroman16/amrscm2mqtt:latest.
Quick start with docker run (requires USB access and host networking):
docker run \
--name amrscm2mqtt \
--pull=always \
--restart unless-stopped \
--network host \
--privileged \
--security-opt seccomp=unconfined \
--device /dev/bus/usb:/dev/bus/usb \
-e WATCHED_METERS="12345678" \
-e MQTT_HOST="127.0.0.1" \
-e MQTT_PORT="1883" \
-e MQTT_USER="" \
-e MQTT_PASS="" \
ghcr.io/conroman16/amrscm2mqtt:latest
- Create an env file
amrscm2mqtt.envnext todocker-compose.yml:
WATCHED_METERS=12345678,87654321
MQTT_HOST=127.0.0.1
MQTT_PORT=1883
MQTT_USER=""
MQTT_PASS=""
- Bring it up:
docker compose up -d
Notes:
- Host networking and USB device pass-through are required so
rtl_tcpcan access the RTL-SDR and expose it locally. - The image supports multiple architectures (amd64, arm64, arm/v7).
Tested on Debian 13 (trixie)
Install RTL-SDR package
sudo apt-get install rtl-sdrSet permissions on rtl-sdr device
/etc/udev/rules.d/rtl-sdr.rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE:="0666"Prevent tv tuner drivers from using rtl-sdr device
/etc/modprobe.d/rtl-sdr.conf
blacklist dvb_usb_rtl28xxusudo apt-get install gitInstall pip for python 3
sudo apt-get install python3-pipInstall paho-mqtt package for python3
sudo pip3 install paho-mqttInstall Go programming language & set gopath
sudo apt-get install golanghttps://github.com/golang/go/wiki/SettingGOPATH
If only running go to get rtlamr, just set environment temporarily with the following command
export GOPATH=$HOME/goInstall rtlamr https://github.com/bemasher/rtlamr
As of modern Go versions, go get is no longer used to install binaries. Use go install with an explicit version:
go install github.com/bemasher/rtlamr@latestEnsure $GOPATH/bin (typically $HOME/go/bin) is on your PATH, or copy the binary into a directory on your PATH.
To make things convenient, I'm copying rtlamr to /usr/local/bin
sudo cp ~/go/bin/rtlamr /usr/local/bin/rtlamrClone repo into opt
cd /opt
git clone [email protected]:Conroman16/amrscm2mqtt.gitCopy template to settings.py
cd /opt/amrscm2mqtt
sudo cp settings_template.py settings.pyEdit file and replace with appropriate values for your configuration
sudo nano /opt/amrscm2mqtt/settings.pyCopy armidm2mqtt service configuration into systemd config
sudo cp /opt/amrscm2mqtt/amrscm2mqtt.service /etc/systemd/system/amrscm2mqtt.serviceRefresh systemd configuration
sudo systemctl daemon-reloadSet amrscm2mqtt to run on startup
sudo systemctl enable amrscm2mqtt.serviceStart amrscm2mqtt service
sudo service amrscm2mqtt startTo use these values in Home Assistant, configure the MQTT broker extension to connect to your server of choice, then place the following in configuration.yaml:
mqtt:
sensor:
- state_topic: "readings/12345678/meter_reading"
name: "Total Gas Consumption (ft³)"
device_class: gas
unit_of_measurement: 'ft³'
unique_id: total_gas_consumption_cf
state_class: total_increasing
Assuming you're using mosquitto as the server, and your meter's id is 12345678, you can watch for events using the command:
mosquitto_sub -t "readings/12345678/meter_reading"Or if you've password protected mosquitto
mosquitto_sub -t "readings/12345678/meter_reading" -u <user_name> -P <password>