M-Bus (Meter-Bus) is a European standard (EN 13757) for the remote reading of utility meters such as water, gas, heat, and electricity meters. Based on a master-slave architecture, the M-Bus master supplies power to the serial bus and periodically polls the connected slave devices (meters) to collect their consumption data.
The Weble universal gateway M-Bus driver acts as the M-Bus master and supports three connection types:
The driver supports a wide range of meter types from over 100 manufacturers including Kamstrup, Siemens, Landis & Gyr, Diehl, Itron, Danfoss, Sensus, Sontex, and Techem. It handles multi-frame meters and Siemens RVD2xx heating controllers, read block by block, with optional writing of setpoints.
This is the most common M-Bus configuration. The gateway connects to the M-Bus via a serial interface (typically a USB to M-Bus converter).
Serial.2400 baud, the M-Bus standard rate).60000 for one reading per minute, or use a cron expression like 0 * * * * for every hour).Once the gateway is started, use M-Bus Methods → Scan primary addresses or Scan secondary addresses to discover the connected meters (see section 4).
When using an M-Bus to TCP/IP converter (e.g. a Relay PadPuls or similar device):
TCP.10001).Requirements
Steps
Wireless and select the Serial Port of the receiver.%mbus:<meter ID>.auto; choose the decoder of the meter model only if automatic detection fails.A meter whose key is wrong shows the status !decrypted payload crc failed check.
| Label | JSON Key | Description |
|---|---|---|
| Name | name | A descriptive name for this M-Bus gateway instance. |
| Cluster ID | cluster | Cluster identifier (integer). 0 runs the driver in its own process; drivers that share the same non-zero ID run in one common process. |
| Description | description | Optional description for this gateway. |
| Type | type | Connection type: Serial (wired via serial port), TCP (via M-Bus to TCP converter), or Wireless (wM-Bus receiver). |
| Only values | onlyValues | If enabled (default), simplifies the address structure to only expose the counter values. When disabled, addresses include additional metadata (units, meter types). |
| Emit change | emitOnlyChanges | Controls when new values are emitted: only changes (emit only when the value changes), each cycles (emit on every poll cycle), or a duration in milliseconds at which the last known value is periodically re-emitted. Default: only changes. With a cron Polling, the value is emitted at every scheduled reading even when it has not changed: a log set to always then records one point per reading (with on update, unchanged values are still not logged). |
These parameters are visible when the Type is Serial.
| Label | JSON Key | Description |
|---|---|---|
| Serial Port | serialPort | The serial interface connected to the M-Bus. Auto-complete lists detected USB/serial interfaces. Use unique ID for stability. |
| Serial Baudrate | serialBaudRate | Bus speed: 300, 600, 1200, 2400 (default, M-Bus standard), 4800, 9600, 19200, or 38400. |
| Polling (ms/cron) | polling | Read frequency. Accepts a duration in milliseconds (e.g. 60000 for 1 minute) or a cron expression (e.g. 0 * * * * for every hour). Multiple schedules can be combined with ; (e.g. 0 * * * * ; 30 12 * * 6-7). A cron has five fields (minute first) or six (seconds first): */15 * * * * reads every 15 minutes, 0 * * * * every hour. The form proposes 1000; if the field is left empty the driver reads every 60000 ms. |
These parameters are visible when the Type is TCP.
| Label | JSON Key | Description |
|---|---|---|
| Host | host | IP address or domain name of the M-Bus to TCP converter. Default: 192.168.1.1. |
| Port | port | TCP port on which the converter listens. Default: 10001. |
| Polling (ms/cron) | polling | Same as serial polling (see above). |
These parameters are visible for Serial and TCP types. They are hidden when Legacy driver is enabled.
| Label | JSON Key | Description |
|---|---|---|
| Request timeout (ms) | requestTimeout | Maximum time in milliseconds to wait for a meter response before triggering a timeout error. Default: 5000. |
| Idle timeout (ms) | idleTimeout | Pause in milliseconds between each request sent on the bus. Increase this value if the bus or meters are slow. Default: 1000. |
| Retries on timeout | retry | Number of times the driver retries a request when a meter does not respond. Default: 0 (no retry). |
| Apply unit factor | applyUnitFactor | If enabled (default), automatically applies unit conversion factors (m³, kWh, etc.) to the raw meter values. Energies are also converted to kWh. |
| Legacy driver | legacyDriver | Uses the previous driver (libmbus) instead of the current one. Unchecked for new gateways. Gateways created before this option existed keep running in legacy mode until you uncheck it. Has no effect on Windows gateways, which always use the current driver. |
Legacy mode limitations: Request timeout, Idle timeout, Retries on timeout and Apply unit factor are ignored and the per-meter Polling field is hidden; the frame Monitor, RVD2xx writing, and the mask, profile and cancel functions of the secondary scan are not available. Uncheck Legacy driver unless a meter only works with it.
These parameters are visible for Serial and TCP types.
| Label | JSON Key | Description |
|---|---|---|
| TCP Server | tcpServer | Enable a built-in TCP server that exposes the M-Bus serial line. When a TCP client connects, the driver stops its own polling and acts as a transparent TCP to Serial bridge for the connected client. Useful for allowing third-party M-Bus master software to access the bus. |
| TCP Server port | tcpServerPort | TCP port on which the server listens. Default: 8222. |
Serial M-Bus:
{
"type": "serial",
"serialPort": "/dev/serial/by-id/usb-FTDI_FT232R-if00",
"serialBaudRate": 2400,
"polling": 60000,
"requestTimeout": 5000,
"idleTimeout": 1000,
"retry": 1,
"applyUnitFactor": true,
"onlyValues": true,
"emitOnlyChanges": true,
"legacyDriver": false,
"tcpServer": false,
"tcpServerPort": 8222
}
TCP M-Bus:
{
"type": "tcp",
"host": "192.168.1.100",
"port": 10001,
"polling": "*/15 * * * *",
"requestTimeout": 10000,
"idleTimeout": 1000,
"retry": 2,
"applyUnitFactor": true,
"onlyValues": true,
"emitOnlyChanges": true,
"legacyDriver": false
}
Wireless M-Bus:
{
"type": "wireless",
"serialPort": "/dev/serial/by-id/usb-IMST_iM871A-if00"
}
M-Bus addresses use the prefix %mbus: followed by the meter identifier and, for the values, the record number.
The meter identifier is either:
%mbus:1 — meter at primary address 1 (decimal, 0–250).%mbus:12345678254D0107 — meter addressed by its secondary address: 16 hexadecimal characters = ID 12345678 (8 digits) + manufacturer 254D (4 hex, low byte first) + version 01 (2 hex) + medium 07 (2 hex). An 8-digit ID alone is not a valid address.In the address form, Device ID opens five sub-fields — Type (primary / secondary), ID, Manufacturer, Version and Medium — and builds the name for you. A scan creates these addresses automatically, which is the recommended way.
| Address | Content |
|---|---|
%mbus:1 |
The meter itself (here primary address 1). Its value is a JSON object with the meter information. It is the only readable address: reading it triggers a fresh request to the meter. |
%mbus:1/0 |
Record #0 of the meter. With Only values enabled (default) this address holds the value directly, with scale and offset applied. |
%mbus:1/0/value and %mbus:1/0/timestamp |
Exist only when Only values is disabled: %mbus:1/0 then holds the full record (unit, function, storage number, tariff…) and these two children hold its value and its timestamp. |
Record addresses are created automatically at the first reading, with a description taken from the meter (quantity, function, storage number). Record numbers are positions in the meter's answer; a record that is no longer returned gets the status !missing.
| Label | JSON Key | Description |
|---|---|---|
| Device ID | name | The M-Bus slave address: a primary address (0–250) or a 16-character secondary address (ID + manufacturer + version + medium), built with the Type / ID / Manufacturer / Version / Medium sub-fields. |
| Description | description | Optional description. |
| Scale | scale | Multiplication factor applied to the raw value. Default: 1. Final value = raw × scale + offset. |
| Offset | offset | Value added after scaling. Default: 0. |
| Polling (ms/cron) | polling | Per-address polling override. If set, this meter is read at a different frequency than the gateway default. The field is hidden when Legacy driver is checked. |
| Max frames | maxFrames | Optional. Limits the number of M-Bus response frames read from this meter. Some devices (e.g. Siemens RVD controllers) return data across multiple frames. Empty = up to 16 frames; set a lower value to reduce request time. Only visible on main addresses. |
| Max records | maxRecords | Optional. Limits the number of data records imported from the meter response. Useful to keep only the first records which are usually the most relevant (main counter values). Leave empty to import all records. Only visible on main addresses. |
| Skip loops | skipLoops | (Legacy, deprecated) Skip N polling loops between reads. Prefer using per-address Polling with cron or millisecond intervals instead. Only visible on main addresses. |
| Log | log | Logging mode: never, on update, always, or a duration in milliseconds. |
| Label | JSON Key | Description |
|---|---|---|
| Device ID | name | The wireless meter address (serial number). |
| Description | description | Optional description. |
| Key | key | Encryption key for decoding the meter's wireless telegrams. Required if the meter uses AES encryption. |
| Driver | driver | The wM-Bus decoder driver matching the meter model. Select Auto for automatic detection, or choose a specific driver (e.g. multical21, hydrus, compact5, omnipower). |
For numeric values, the final value is calculated as:
value = raw_value × scale + offset
This is useful for applying custom unit conversions. For example, to convert liters to m³, set scale = 0.001.
The driver supports a wide range of wM-Bus meter types:
| Category | Drivers |
|---|---|
| Water meters | apator162, hydrus, hydrodigit, multical21, flowiq2200, flowiq3100, izar, izar3, q400, ultrimis, itron, minomess, and more |
| Heat meters | compact5, multical302/403/602/603/803, sharky774, ultraheat, sensostar, vario451, elf, microclima, hydroclima |
| Electricity meters | ebzwmbe, ehzp, esyswm, em24, omnipower, amiplus, gransystems |
| Heat cost allocators | eurisii, fhkvdataiii, fhkvdataiv, qcaloric, sontex868, bfw240radio |
| Temperature/Humidity | cma12w, lansenth, rfmamb, munia, piigth |
| Gas meters | unismart |
| Smoke detectors | ei6500, lansensm, tsd2, qsmoke |
| Pulse counters | lansenpu |
| Door/Window sensors | lansendw |
Each M-Bus meter reports its medium — the type of utility being measured:
| Code | Medium |
|---|---|
| 00 | Other |
| 01 | Oil |
| 02 | Electricity |
| 03 | Gas |
| 04 | Heat |
| 05 | Steam |
| 06 | Hot Water |
| 07 | Water |
| 08 | H.C.A. (Heat Cost Allocation) |
The scan and diagnostic tools are in the M-Bus Methods menu of the gateway's address list:
| Gateway type | Menu entries |
|---|---|
| Serial / TCP | Scan primary addresses, Scan secondary addresses, Monitor |
| Wireless | Scan addresses |
Open M-Bus Methods → Scan primary addresses, enter From (default 1) and To (default and maximum 250), then click Scan. The gateway requests data from each address in turn; every meter that answers is added with its records, and a progress bar shows the address being tested. An address without a meter costs at least one request timeout (more with Retries on timeout), so narrow the range when you know it.
Each M-Bus slave has a primary address between 0 and 250 assigned during installation. The primary scan only works when every meter has a unique primary address — if two meters share the same primary address, they will collide.
The secondary scan uses the M-Bus secondary addressing mechanism to discover meters regardless of their primary addresses. Each meter has a unique secondary address — a 16-character hexadecimal string that encodes:
| Characters | Content | Encoding |
|---|---|---|
| 1–8 | Meter serial number (ID) | BCD (digits 0–9 only) |
| 9–12 | Manufacturer code, low byte first | Hex (0–F) |
| 13–14 | Version (generation) | Hex (0–F) |
| 15–16 | Medium (see section 3.6) | Hex (0–F) |
Open M-Bus Methods → Scan secondary addresses. The dialog has two fields:
F is the wildcard; leave everything at F to scan the whole bus.Medium (default) (timeout 2000 ms, idle 500 ms), Fast (adaptive) (1000 / 300 ms, slows down by itself when it detects late answers), Slow (safe) (3000 / 1000 ms) or Custom, which shows Timeout, Idle timeout and Retries.During the scan the window shows the mask being probed, counters (probes, devices, collisions, empty, elapsed) and the list of meters found. Each meter found is added as %mbus:<secondary address>; its records appear at the next reading. If the scan ends with a warning about suspect branches, or about collisions without any identified device, another master is probably using the same converter: stop it and scan again.
The secondary scan uses a mask with F as wildcard characters. The driver probes the bus with the mask, and if a meter responds, it reads the full secondary address. If multiple meters respond simultaneously (collision), the driver automatically narrows down by iterating through each wildcard digit position.
Common masks:
| Mask | Effect |
|---|---|
FFFFFFFFFFFFFFFF |
Scans all devices (full wildcard — may be slow on large buses). |
12345678FFFFFFFF |
Scans only devices with ID 12345678. |
FFFFFFFF254DFFFF |
Scans only Siemens AG devices (manufacturer SIE, code 4D25, typed low byte first: 254D). |
FFFFFFFF7A32FFFF |
Scans only Siemens Building Technologies devices such as RVD2xx controllers (manufacturer LSZ, code 327A → 7A32). |
FFFFFFFFFFFFFF07 |
Scans only water meters (medium 07). |
The Manufacturer group of the mask takes the two bytes of the manufacturer code in bus order (low byte first). The manufacturer list of the address form shows the code high byte first (for example
KAM … 2C2D): swap the two bytes when you type a mask (2D2C).
The secondary scan works recursively, similar to a tree search:
This process efficiently discovers all meters on the bus even when hundreds of devices are connected, though it can take several minutes on large installations.
A secondary scan is stopped with Cancel scan in the scan window (confirm the question). Closing the window does not stop the scan: it keeps running in the background on the gateway. While a scan runs, polling is paused and a second scan is refused (bus already busy).
M-Bus Methods → Scan addresses listens for telegrams, first in T1 mode then in C1 mode (about 20 seconds each; the timer restarts each time a new meter is heard), and adds every meter heard as an address.
Right-click a row of the meter in the address list and choose Change primary address. Enter the New address (0–250) and click Set Primary.
The gateway sends the command, then checks that the meter answers on its new address. If the meter is addressed by its primary address, its addresses are renamed (%mbus:12/… becomes %mbus:25/…; loggers and history are kept) and a message tells you how many routes still use the old name and must be updated. The change is refused when another address of the gateway already uses the new number. Some meters acknowledge the command but ignore it (protected meters): the gateway then reports not applied.
Warning: Changing the primary address modifies the meter's configuration permanently.
The bus speed is set for the whole gateway with the Serial Baudrate parameter. The gateway does not change the baudrate programmed in a meter: use the manufacturer's tool for that.
Some meters split their data over several response frames. The gateway keeps requesting the next frame while the meter announces that more records follow, up to Max frames (16 when the field is empty). Set Max frames to a lower value to shorten the reading when only the first records are useful.
RVD25x/RVD26x controllers are detected automatically — no parameter is needed. Their data is organised in blocks that the gateway selects and reads one after the other.
%mbus:<address>), choose Update address and tick the blocks you need under RVD2xx blocks (GlobalConfig, DeviceConfig, HeatCircuits, DHW, ConnectionSettings, LoadManagement, SwitchingHC1, SwitchingHC2, SwitchingDHW, Service). Each extra block lengthens the reading./0, /1, …) follow this order: adding or removing a block shifts the numbers of every record read after it — check your routes and loggers afterwards.Flow temp actual HC1 [PlantIO].null in the JSON of %mbus:<address>) means the controller has no sensor or function for that record.Writing is disabled by default. Tick Write enabled in the address form of the controller, then write to the record address (%mbus:<address>/<N>, or %mbus:<address>/<N>/value when Only values is disabled). The gateway writes the value, reads the block back and reports not applied: controller reads back … if the controller refused it. Only integer values can be written; block selection, bus address and identification records are never written. Writing requires Legacy driver to be unchecked.
For a complete example see M-Bus - Siemens RVD25x/RVD26x Heating Controllers.
When TCP Server is enabled, the M-Bus driver opens a TCP listening socket (default port 8222). This allows external M-Bus master software (e.g. a commissioning tool or third-party BMS) to connect and communicate directly with the meters on the serial bus.
Security: enable TCP Server only for the duration of the intervention and disable it afterwards. Reach it through the VPN, never expose the port to the Internet, and restrict access to it by firewall or network segmentation.
When a TCP client connects:
This is useful for:
A powerful use case for the TCP Server feature is to connect remotely from a Windows PC — via VPN — with a professional M-Bus diagnostics tool such as NG-MScan2. This allows a technician to scan, configure, and troubleshoot M-Bus meters from anywhere in the world, as if they were physically connected to the bus.
The setup requires:
8222).Since M-Bus diagnostics software (like NG-MScan2) expects to communicate via a local COM port, the Serial Emulator TCP tool creates a virtual serial port bridge:
COM90 ↔ COM91). These two ports are internally wired together — anything written to one is read from the other.COM91 and establishes a TCP connection to the gateway's M-Bus TCP Server (e.g. 192.168.1.99:8222). All data is transparently forwarded between the serial port and the TCP socket.COM90 and communicates as if it were connected to a physical M-Bus serial interface.Run install.bat as Administrator. It will:
COM90 ↔ COM91).Open serialEmulatorTCP_GUI.exe. The GUI allows you to configure the connection parameters (host, port, COM port, baudrate, etc.) and start the bridge with a single click. The default settings from gui_config.txt are pre-filled (host 192.168.1.99, port 8222, COM 90, baudrate 2400). Adjust the host to match the gateway's IP address (via VPN) and click connect.
Alternatively, the bridge can be started from the command line:
serialEmulatorTCP.exe --host=<gateway-ip> --port=8222 --weble-mbus
Key parameters (configurable via GUI or command line):
| Parameter | Description |
|---|---|
--host=<ip> |
IP address of the Weble gateway (via VPN). |
--port=8222 |
TCP Server port configured on the M-Bus driver. |
--weble-mbus |
Enables the Weble M-Bus handshake protocol. When active, the tool waits for the gateway's M-Bus driver to be ready before bridging. If the bus is busy (e.g. scanning), an error is displayed. |
--COM90 |
Virtual COM port number (default: 90). |
--baud=2400 |
Serial baudrate (must match the M-Bus bus speed). |
--parity=even |
Serial parity (M-Bus standard: even). |
Once the bridge is connected and ready, open NG-MScan2 (or any other M-Bus tool) and select COM90 as the serial port. The tool can now scan, read, and configure all meters on the remote M-Bus installation as if locally connected.
Note: While the TCP client is connected, the gateway's own M-Bus polling is paused to avoid bus conflicts. Polling resumes automatically when the client disconnects.
For the on-site method (finding the meters, checking the readings, setting the polling, diagnosing the bus), see the M-Bus commissioning and troubleshooting guide.
M-Bus Methods → Monitor (Serial and TCP gateways, Legacy driver unchecked) opens a live list of every frame sent (TX) and received (RX): time, delay since the last transmission, frame type and function, address (253 = selected meter, 254 / 255 = broadcast), CI field, secondary address, error (bad checksum, incomplete frame, unexpected data) and raw bytes. It also works during a scan and stops by itself after 30 minutes.
A Delay longer than the request timeout, followed by an unexpected data line, points to a converter or a meter that answers too late: raise Request timeout.
| Status | Meaning | What to do |
|---|---|---|
!timeout (or another error text) |
The meter did not answer the last reading. | Check wiring, address and baudrate; raise Request timeout or Retries on timeout. |
!no response (bus busy) |
A reading started more than 60 seconds ago and has not finished. | The bus or the converter is blocked or very slow (another master on the converter, many frames with long timeouts): check with the Monitor. |
!missing |
The record is no longer part of the meter's answer. | Max frames / Max records was lowered or the meter was reconfigured; delete the address if it is obsolete. |
!record mismatch (read discarded) |
The meter answered with a different record layout (typical of a multi-frame meter read out of sequence). The whole reading was ignored to protect the logs. | Nothing: the next reading realigns. A new layout is accepted after 3 identical readings. |
!mismatch (retrying), !persistent mismatch (intruder …) |
Another meter answered instead of the one addressed. | Two meters share a primary address, or a device or the wiring is faulty: use secondary addressing. |
!timeouts maxed |
After repeated timing problems the gateway raised its own timeouts up to the 10 s maximum. | The bus is severely degraded: check the converter, the cable length and the number of meters. |
missing license means the gateway has no licence for the M-Bus driver: contact support@weble.ch.