Skip to main content

M-Bus (Metering)

M-Bus (Meter-Bus) is a communication protocol standardized under EN 13757 and dedicated to utility metering. Heat meters, gas meters, electricity meters, and water meters are its primary markets.

The gateway's M-Bus driver supports M-Bus over TCP (wireless or wired meters converted to TCP through an M-Bus master gateway).


Registration Form Entries

FieldWhat to enterExample
IP addressM-Bus gateway IP192.168.0.150
PortM-Bus TCP port10001 (standard for Relay / Sentec / ETM class vendors)
Baud rate (baudrate)gateway ↔ meter2400 (standard) / 9600
Response timeout (request-timeout)meter response wait (ms)5000
One meter vs. many

A single M-Bus line can carry up to 250 meters. The gateway includes a per-meter address (primary or secondary) in the tag-side notation so that multiple meters can be registered under a single "connection".


PLC Address Notation for Tags

Each M-Bus meter exposes various "records" (instantaneous value, totalized value, unit, and so on). The notation is split into the two parts <meter>:<record>.

Meter Selection

NotationMeaning
addr:5Primary address 5
select:12345678:KAM:01:04Secondary selection — <id>:<mfg>:<ver>:<med>
select:12345678Secondary id only (mfg/ver/med are wildcards FF)

mfg is the 3-character manufacturer code (e.g. KAM = Kamstrup), ver is the firmware version, and med is the medium (1=Oil, 4=Heat, 7=Water, etc.).

Records (data block index)

A meter's response contains multiple data blocks (DIB/VIB), indexed sequentially as 0, 1, 2, ... The gateway exposes them using an index + subfield notation.

NotationMeaning
1:0Field 0 of data block 1 (usually the "current value")
1:unitUnit of data block 1 (string)
1:tariffTariff of data block 1
1:storageStorage number of data block 1

Full notation example: addr:5:1:0 — the value of data block 1 on primary meter 5.

Or: select:12345678:KAM:01:04:3:0 — the value of data block 3 on a Kamstrup heat meter.


Matching Data Types

M-Bus valueData typeType modifier
Totalized / measured value (real)FloatREAL
Integer counterIntegerDW (32-bit) or (blank)
Unit / manufacturer codeStringSTR[8]
Tariff / storage numberInteger(blank)

M-Bus meters mix various encodings — BCD, 32-bit integer, 64-bit integer, IEEE real, and others. The driver decodes them automatically from the DIB / VIB headers and exposes them as "physical values", so in most cases you can simply receive them as Float : REAL.


Common Problems and Solutions

Symptom / messagePossible causeSolution
"Address not responding"primary unused / conflictingUse the gateway's "M-Bus scan" to identify which primary addresses actually respond
"Invalid secondary"typo in one of the 4 secondary fields (id/mfg/ver/med)Recheck the 8-digit serial on the meter label and the 3-character mfg code printed there
Value far too large / small (by 1000×)scaling errorM-Bus normally scales automatically. If the value still looks wrong, correct it with a formula
Frequent "Timeout"baud rate mismatchAlign the gateway ↔ meter baud rates (usually 2400)
Data block number unclearthe order differs per meterInspect the raw response with the gateway's "M-Bus telegram view" and map the index
Primary or Secondary?

With 5–10 meters or fewer on a line, primary addressing is simpler. For 100+ meters, or systems where primary addresses change dynamically, secondary (serial-based) addressing is more reliable.


Frequently Used Examples

Standard registration for a single heat meter:

Tag nameAddressData typeType modifier
Totalized heat (kWh)addr:5:1:0FloatREAL
Totalized flow (m³)addr:5:2:0FloatREAL
Instantaneous power (kW)addr:5:3:0FloatREAL
Supply temperature (°C)addr:5:4:0FloatREAL
Return temperature (°C)addr:5:5:0FloatREAL
Meter serial numberaddr:5:0:idStringSTR[8]

More Detailed Examples / Automated Registration

See the M-Bus examples in Advanced — REST API.