Blacklist DVB Drivers
- Create new configuration file
sudo nano /etc/modprobe.d/blacklist-rtl.conf
2. Paste in the following code
blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2830
3. Save the file by pressing CTRL-X and then Y to save. Restart your box after this to ensure the drivers have been blacklisted
Install MeterMon with Docker
- Run the following command to pull the image.
If you are using a Raspberry Pi:
docker pull seanauff/metermon:arm
If you are using a workstation / x86_64 based system
docker pull seanauff/metermon:amd64
or
or
docker pull seanauff/metermon:latest
2. Then run the docker run command with the required MQTT information (make sure you replace everything in straight brackets [] ).
docker run -d -e MQTT_BROKER_HOST=[host] -e MQTT_USERNAME=[user] -e MQTT_PASSWORD=[host] -e RTL_TCP_SERVER=[server] seanauff/metermon:[tag]
3. This is the full MeterMon docker script
docker run -d -e MQTT_BROKER_HOST=[host] -e MQTT_USERNAME=[user] -e MQTT_PASSWORD=[host] -e RTL_TCP_SERVER=[server] -e RTLAMR_FILTERID=[meter1,meter2] -e METERMON_SEND_BY_ID=true -e RTLAMR_UNIQUE=false seanauff/metermon:[tag]
Setup Home Assistant
Gas Sensor from MQTT (sensors.yaml)
- platform: mqtt
state_topic: "metermon/66154761"
name: "Gas Meter Reading"
qos: 0
value_template: "{{ value_json.Consumption }}"
unit_of_measurement: ft^3
device_class: "gas"
Water Meter Sensor from MQTT (sensors.yaml)
- platform: mqtt
state_topic: "metermon/31297404"
name: "Water Meter Reading"
qos: 0
value_template: "{{ value_json.Consumption }}"
unit_of_measurement: gal
Gas Sensor Conversion into Metric (templates.yaml) FIXED – SORRY
- sensor:
name: Gas Energy Metric
state: >-
{{ states('sensor.gas_meter_reading')|float*0.0283168 }}
icon: mdi:fire
unit_of_measurement: "m³"
state_class: "total_increasing"
device_class: "gas"
Hack a “Virtual” Gas Meter into HA’s Energy Dashboard
{
"type": "gas",
"stat_energy_from": "sensor.gas_energy_metric",
"stat_cost": null,
"entity_energy_from": null,
"entity_energy_price": null,
"number_energy_price": 0.39597
}
My Full Energy Dashboard Config (/config/.storage/energy)
{
"version": 1,
"key": "energy",
"data": {
"energy_sources": [
{
"type": "grid",
"flow_from": [
{
"stat_energy_from": "sensor.whole_house",
"stat_cost": null,
"entity_energy_from": "sensor.whole_house",
"entity_energy_price": null,
"number_energy_price": null
}
],
"flow_to": [],
"cost_adjustment_day": 0.0
},
{
"type": "gas",
"stat_energy_from": "sensor.gas_energy_metric",
"stat_cost": null,
"entity_energy_from": null,
"entity_energy_price": null,
"number_energy_price": 0.39597
}
],
"device_consumption": [
{
"stat_consumption": "sensor.power_1"
},
{
"stat_consumption": "sensor.power_2"
}
]
}
}
Good writeup. Was there a reason you chose Metermon over other options? Seems like their are a lot of tool that are pretty similar.
I’ve ran into trouble getting this to completely work. I’ve had to manually start rtl_tcp for some reason (rc.local script isn’t starting it). And when the metermon docker container starts, the connection is made to the MQTT broker, and a few lines of meter data are sent. But then it freezes, stops. Log files show “receiver context cancelled” and “read:connection reset by peer”
I think this may have something to do with some troubles people have been having with MQTT versions 6.x that seems to be generating this error :
ERROR (MainThread) [supervisor.services.modules.mqtt] There is already a MQTT service in use from core_mosquitto
Did you overcome any similar issues when you performed the setup?
I tried most of them, I think metermon addressed a lot of the issues I ran into with my meters. But nothing super different that a few other docker set ups.
Maybe try doing a cron job to start the service? A few other people noted they had problems with the rc.local. Maybe your Linux distribution uses something different?
Figured it out- rtl_tcp wasn’t running in root.
Once that was fixed, running quite nicely. Only thing is that its only seeing the gas meter- not water or electricity. I’ve had in on long enough that I think I would have grabbed the water meter if it was intermittent like you stated with yours.
Is there a way of adjusting the frequency that is searched- the documentation doesn’t seem to indicate what the default frequency is? Or does it nominally check a certain frequency range?