Skip to content

M-Bus protocol

M-Bus (Meter-Bus, EN 13757) is a serial protocol designed for reading utility meters: heat meters, water, gas and electricity meters. Many meters, even from different manufacturers, can share the same two-wire bus, which also powers the meters' interface.

The gateway acts as M-Bus master and periodically reads the meters (slaves) connected to the bus. Each data source of type Generic M-Bus reads one meter: add one data source for each meter.

Requirements

M-Bus requires gateway firmware 3.18.0 or later. With older firmware the Generic M-Bus data source and the M-Bus serial protocol are not available.

Physical connection

The M-Bus uses different voltage levels than RS485/RS232: an M-Bus level converter (also called M-Bus master or repeater) must be installed between the gateway serial port and the meters. The converter powers the bus and must be sized for the number of meters connected (check its datasheet).

The converter can be connected to:

  • an RS485 port of the gateway (see the Modbus RTU page for the terminals), after setting the port protocol to M-Bus;
  • an RS232 port, on gateways that have one.

Serial port setup

An RS485 port can be used either for Modbus or for M-Bus, not both at the same time.

  1. In the main view of the gateway, click on the serial port icon.
  2. Select the tab of the port the converter is connected to and set Protocol to M-Bus. The serial parameters are set to the M-Bus standard: 2400 baud, 8 data bits, even parity, 1 stop bit. Change them only if the meters are configured differently.
  3. Click on Save.

Note

The protocol of a port can't be changed while some data sources still use it: the window lists them. Delete them or move them to another port first.

Configuration

Connection

  1. Choose the data source Generic M-Bus.
  2. Select the Serial port. Only RS232 ports and RS485 ports set to M-Bus can be selected.
  3. Choose how to address the meter:
    • Primary address: a number from 0 to 250, which must be unique on the bus. Many meters ship with primary address 0: change it with the manufacturer's software when connecting several meters.
    • Secondary address: 16 hexadecimal digits (identification number, manufacturer, version, medium, e.g. 12345678A5110407), unique for each meter. It works also when several meters share the same primary address, so it is recommended when more than one meter is connected.
  4. Click on Discovery to search the meters on the port and fill in the address automatically. You can search by:

    • Secondary address: finds every meter on the port, also meters sharing a primary address. It takes a few seconds per meter.
    • Primary address: queries each primary address from 0 to 250 in turn, which takes about two minutes. Meters sharing the same address are reported as collisions and can't be told apart: use the secondary address search for them.

    Click on Search, select the meter in the list (secondary address, primary address, manufacturer, medium and version are shown) and click on Select.

  5. Click on Test to check that the meter answers.

  6. Set Read every (seconds), the polling period (default 60 seconds).

Battery powered meters

Battery powered meters (typically heat and water meters) may allow a limited number of reads, or drain the battery faster when read often: read them every few minutes or more.

A warning is shown if another data source already reads the same meter on the same port.

Variables

An M-Bus meter sends all its values in a single response, as a list of data records. The easiest way to configure the variables is to read the meter and choose the records to keep:

  1. Click on Read from device: the gateway reads the meter and lists all the records it sends, with the current value and what identifies the record. Records already configured as variables are marked as Already a variable.
  2. Select the records of interest and click on Add: a variable is added for each of them.
  3. For each variable, set:
    • Name and metadata (see here for more details)
    • Scale (see here for more details)
    • Save on (see here for more details)
  4. Click on Read in the Value column header to read all the variables and check their values.
  5. Click on Next to go to the Metadata tab.

Each variable has a Topic:

  • Record: a data record of the meter (e.g. energy, volume, flow temperature).
  • Header: a field of the header that the meter sends with its records: - Identification number, Manufacturer, Version, Medium: identify the meter - Access number: counter of the meter's responses - Status: status byte with the meter's error flags (e.g. low battery)
  • Info: status of the data source: - Disconnected: 1 while the meter doesn't answer. This variable is added automatically and can't be deleted: only its metadata and save options can be changed. - Errors: highest error level (0 no error, 2 errors reading the meter or a record)

Record identification

A record is identified by the following fields, which Read from device fills in automatically. Click on the icon of a variable to view or change them, e.g. to configure a record that the meter doesn't send yet:

Field Description
Quantity What the record measures (e.g. energy, volume, power, flow temperature). The value is reported in the unit of the quantity (e.g. Wh, m³).
Meter resolution What one count of the meter is worth (e.g. 1 kWh, 10 mL). The value is converted to the quantity's unit anyway: a 1 kWh energy record is reported in Wh.
Extension Additional meaning of the quantity (e.g. forward flow, per hour). Usually none.
Function Instantaneous, Maximum, Minimum or During error value.
Storage 0 is the current value, higher numbers are stored values (e.g. at the end of last month), as defined by the meter.
Tariff Tariff of the value, 0 if the meter doesn't use tariffs.
Subunit Unit number for meters made of several units, usually 0.
Occurrence Among records identical in all the fields above, which one: 0 the first.

Tip

The meaning of storage numbers, tariffs and subunits depends on the meter: check the manufacturer's documentation, or compare the values shown by Read from device with the meter's display.

To import or modify many variables at once, use Edit with Excel or Edit as JSON (see bulk configuration). In the spreadsheet, the record fields are the area, quantity, resolution, extensions, function, storage, tariff, subunit and occurrence columns; header fields use the field column and info variables the slot_out column.

Metadata and save

  1. In the Metadata tab, give a name and an optional description to the data source and choose where to place it within the device hierarchy.
  2. Click on Save. Once the window is closed:
    • if you are using the local web interface, the changes have been successfully applied
    • if you are operating through the cloud, the configuration has been saved and placed in a sending queue. Until the configuration is applied, a ⚠ yellow triangle will be shown at the top of the gateway configuration page.
      • if the gateway is online, it is sent immediately.
      • if the gateway is offline, it will be sent when the connection is re-established.