Near Real-Time Natural Gas Consumption Monitoring with RTL-SDR
Dylan Barlett
From this…
…to this
Architecture
SCM
ERT
RTL-SDR dongle
rtlamr2mqtt container
eclipse-mosquitto
container
HA container
USB
Docker
MQTT
MQTT
Gas meter
Rotating shaft
Configuration
rtlamr2mqtt.yaml
meters:
- id: 12345678
protocol: scm
name: meter_gas
unit_of_measurement: "ft³"
icon: mdi:gauge
device_class: gas
state_class: total_increasing
configuration.yaml
utility_meter:
hourly_gas:
source: sensor.meter_gas
cycle: hourly
daily_gas:
source: sensor.meter_gas
cycle: daily
monthly_gas:
source: sensor.meter_gas
cycle: monthly
docker logs rtlamr2mqtt
[2025-05-23 20:28:18] Resetting USB device: /dev/bus/usb/004/027
[2025-05-23 20:28:18] Reset sucessful.
[2025-05-23 20:28:18] Sending message to MQTT:
[2025-05-23 20:28:18] > topic => rtlamr/status
[2025-05-23 20:28:18] > payload => online
[2025-05-23 20:28:18] > retain => True
[2025-05-23 20:28:18] Trying to start RTL_TCP: /usr/bin/rtl_tcp -s 2048000
[2025-05-23 20:28:18] RTL_TCP started with PID 1041
[2025-05-23 20:28:23] RTL_TCP is ready to receive connections!
[2025-05-23 20:28:23] Trying to start RTLAMR: /usr/bin/rtlamr -msgtype=scm -format=json -filterid=12345678 -unique=true
[2025-05-23 20:28:23] RTLAMR started with PID 1046
[2025-05-23 20:29:27] Meter "12345678" - Consumption 972640. Sending value to MQTT.
[2025-05-23 20:29:27] Sending message to MQTT:
[2025-05-23 20:29:27] > topic => rtlamr/12345678/attributes
[2025-05-23 20:29:27] > payload => {"Message Type": "SCM", "ID": 12345678, "Type": 12, "TamperPhy": 2, "TamperEnc": 0, "Consumption": 972640, "ChecksumVal": 18736}
[2025-05-23 20:29:27] > retain => True
[2025-05-23 20:29:27] Sending message to MQTT:
[2025-05-23 20:29:27] > topic => rtlamr/12345678/state
[2025-05-23 20:29:27] > payload => 12345678
[2025-05-23 20:29:27] > retain => True
[2025-05-23 20:29:27] Sleep_for defined, time to sleep!
[2025-05-23 20:29:27] Terminating all subprocess...
[2025-05-23 20:29:27] Kill process called.
[2025-05-23 20:29:27] Killing RTL_TCP...
[2025-05-23 20:29:32] Killed.
[2025-05-23 20:29:32] Killing RTLAMR...
[2025-05-23 20:29:32] Killed in the first attempt.
[2025-05-23 20:29:32] Sleeping for 300 seconds, see you later...
Next step: water meter