This Home Assistant add-on reads an M-Bus meter via a USB serial adapter using libmbus and publishes the meter value to MQTT.
It is designed for Home Assistant OS and Home Assistant Supervised installations and runs as a local add-on.
- Reads M-Bus meters via
mbus-serial-request-data-multi-reply - Configurable serial device, baud rate, and polling interval
- Publishes meter value to MQTT
- Lightweight single-process container (
init: false) - Compiles
libmbusfrom official source - Works with MQTT auto-discovery (optional)
- Home Assistant OS or Supervised
- MQTT broker (e.g. Mosquitto add-on)
- USB M-Bus serial adapter
- Serial device available under
/dev/serial/by-id/
On your Home Assistant host, copy this repository to:
/mnt/data/supervisor/addons/local/mbus_meter
The directory structure must look like this:
mbus_meter/
├── config.yaml
├── Dockerfile
├── run.sh
└── README.md
Run:
ha supervisor reloadOr reboot Home Assistant.
Go to:
Settings → Add-ons → Add-on Store
Scroll down to:
Local add-ons
Install M-Bus Meter Reader.
Example configuration:
device: "/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0"
baudrate: 2400
interval: 60
mqtt_topic: "homeassistant/sensor/mbus_meter/state"| Option | Description |
|---|---|
device |
Serial device path |
baudrate |
M-Bus baud rate (usually 2400) |
interval |
Read interval in seconds |
mqtt_topic |
MQTT topic used to publish the meter value |
You have two options.
If MQTT discovery is enabled in your add-on, the sensor will appear automatically.
Go to:
Settings → Devices & Services → MQTT
You should see a new device:
M-Bus Meter
No YAML configuration required.
Add the following to configuration.yaml:
mqtt:
sensor:
- name: "M-Bus Meter"
state_topic: "homeassistant/sensor/mbus_meter/state"
unit_of_measurement: "m³"
state_class: total_increasing
device_class: waterRestart Home Assistant afterwards.
The add-on performs the following steps:
-
Executes:
mbus-serial-request-data-multi-reply -
Extracts the first
<Value>element from the XML response. -
Publishes the extracted value to the configured MQTT topic.
-
Waits for the configured interval.
-
Repeats.
The add-on:
- Uses
ghcr.io/home-assistant/base:aarch64 - Installs required build dependencies
- Compiles
libmbusfrom source - Runs as a single foreground process
- Does not use s6-overlay (
init: false)
Check logs:
Settings → Add-ons → M-Bus Meter Reader → Logs
Check that your device exists:
ls /dev/serial/by-idEnsure:
- The USB adapter is connected
- The device path matches your configuration
- The add-on has device access configured
Verify the MQTT broker is running.
In Home Assistant:
Settings → Devices & Services → MQTT → Listen to topic
Subscribe to:
homeassistant/sensor/mbus_meter/#
If nothing appears, check add-on logs.
Ensure your config.yaml includes:
devices:
- /dev/serial/by-id:/dev/serial/by-id- The add-on requires direct access to serial hardware.
- Meter values are published to MQTT without additional encryption inside the HA network.
- Secure your MQTT broker properly if exposed externally.