DrvMBus is a driver for MBus to Web Port.
To use DrvMBus, an IO device is first created which is then used to communicate via MBus TCP.
Installation
The installation of DrvMBus is done by selecting DrvMBus when installing the Web Port. See "Installation" for more information on the installation process.
IO device
To use DrvMBus, an IO device is created according to chapter "IO-devices" of the manual.
In addition to general settings (see "general settings" in IO-devices), the following settings are available for an IO device of type DrvMBus:
| Setting: | Description: |
| IP address or Hostname | IP or hostname |
| Port | Specifies port to MBus gateway |
| Read timeout | Maximum reading time before question time expires |
| Packet cache | Time that MBus packages are saved in Web Port cache. Tags that retrieve different values from the same MBus message then ask for the same saved packet |
| Initialization address | If no initialization address is specified, only simple connection validation is performed for TCP (verifies that the port is open). If the initialization address is specified, a query to that meter is used to confirm whether a connection has been established |
Tags
For more information on how to create tag lists and tags, see chapter "Tags" of the manual.
-
Tag addresses:
Web Port supports addressing via primary or secondary address.
-
Primary address: Number between 0 and 250.
-
Secondary address: Format
NNNNNNNN.AAAA.BB.CC
Where:
-
NNNNNNNN is the serial number
-
AAAA is producer code (HEX)
-
BB is firmware version (HEX)
-
CC is medium (HEX)
Example:
11034493.4C43.36.02
MBus packet formats
MBus meters respond in two different formats: variable length or fixed length packages. These are addressed in different ways.
To view the contents of the MBus packages:
-
Enter only the meter address (primary or secondary).
-
Set the data type to String.
Web Port will then display the entire MBus package converted to JSON, showing all available data and structure.
Note: This may take some time depending on how many registers the meter provides.
Addressing values in DrvMBus
The desired value is entered on a new tag by adding an address after the meter address, separated by an @ character.
Example:
1@EnergyWh.Instantaneous.Tariff0.SubUnit0Information about the meter itself can be retrieved in the same way.
1@Manufr
Normalized vs non-normalized values
By default, normalized values are returned for variable length packages.
To retrieve the raw (non-normalized) value, add
!nvafter the address:Example:
1@EnergyWh.Instantaneous.Tariff0.SubUnit0!nv
Special communication options
-
!nke – Some meters require an ACK (NKE packet) before values can be read:
1@EnergyWh.Instantaneous.Tariff0.SubUnit0!nv!nke -
!fcb – Handle non-standard frame control behavior:
1@EnergyWh.Instantaneous.Tariff0.SubUnit0!fcb -
!rst – Reset the application and MBus communication for a specific tag:
1@EnergyWh.Instantaneous.Tariff0.SubUnit0!rst
StorageNumber addressing
Some values are of the same type but are located in different StorageNumbers. These are addressed by adding
StorageNumberX(where X is the current StorageNumber) after the address.Example:
1@EnergyWh.Instantaneous.Tariff0.SubUnit0.StorageNumber0
Addressing by index (Telegram and Index)
In addition to addressing by name, it is possible to address values by index/order.
This is often documented in the meter’s manual and can also be seen in the JSON response under each Record.The addressing format is then:
<MeterID>@<Index>Example:
01247556@0
Understanding Telegram and Index in DrvMBus
When using numeric addressing (
@X), it is useful to understand how DrvMBus interprets Telegram and Index.Basic concepts
-
Meter ID – Each meter has a unique identification number (e.g.
01446666). -
Telegram – A telegram can be seen as a data frame or a group of registers sent by the meter.
-
Index – The index refers to a specific data field within a telegram.
How DrvMBus interprets numeric addressing (
@X)When using a number after @, DrvMBus expects a combined representation of Telegram and Index, where the first digit represents the Telegram and the remaining digits represent the Index.
Address = (Telegram * 10) + IndexExamples
Example 1:
01446666@0This addresses Telegram 0, Index 0 – the simplest case.
Example 2:
01446666@11This addresses Telegram 1, Index 0.
Interpreted as:
1 * 10 + 1 = 11-
First digit → Telegram (1)
-
Second digit → Index (0)
Example 3:
01446666@21!nvThis addresses Telegram 1, Index 10, and requests the non-normalized value.
Interpreted as:
2 * 10 + 1 = 21-
Telegram = 1
-
Index = 10
-
!nv= raw, non-normalized value
How to determine the correct Telegram and Index
To find a value in a meter:
-
Create a tag using only the meter ID (no
@). -
Set data type to String.
-
Web Port returns all registers in JSON format.
-
In the JSON, check the Record numbers (
"0": {...},"1": {...}) to find the correct Telegram and Index.
If reading does not work initially, try adding one of:
-
!nke– send an NKE before reading -
!rst– reset MBus communication -
!fcb– handle non-standard frame control behavior
Understanding how Telegram and Index are structured for your specific meter will make it much easier to correctly address and extract the required data.
-
Example of JSON response and addressing
JSON Answer:
{
"IdentificationNo": 1247556,
"Maneuver": 7222,
"Version": 90,
"DeviceType": 2,
"TransmissionCounter": 19,
"Status": 0,
"Signature": 0,
"FRecords": null,
"PacketType": "Variable",
"Address": 0,
"VRecords": {
"0": {
"RecordType": 4,
"Function": "Instantaneous",
"StorageNumber": 0,
"Tariff": 0,
"SubUnit": 0,
"ValueDataType": "_32_Bit_Integer",
"ValueData": null,
"Value": 417920,
"Units": [{
"Units": "EnergyWh",
"Unit": "Wh",
"Magnitude": 2,
"Quantity": "Energy",
"VIF_string": "05h"
}],
"Magnitude": 2,
"Offset": 0,
"Name": "EnergyWh.Instantaneous.Tariff0.SubUnit0",
"NormalizedValue": {
"Item1": "EnergyWh.Instantaneous.Tariff0.SubUnit0",
"Item2": 41792000.0
}
}
}
}
-
Normalized value:
0@EnergyWh.Instantaneous.Tariff0.SubUnit0
-
Non-normalized value:
0@EnergyWh.Instantaneous.Tariff0.SubUnit0!nv
-
Meter ID:
0@IdentificationNo
- Import:
The MBus driver also provides the ability to scan and import tags from meters.
In a tag list, there is the option to select import tags, select the MBus device and there is the option to select which addresses to import.
It is possible to specify individual addresses or address ranges.
Examples of primary addresses: 1,20-30,145 tries to read the addresses 1, 20 to 30 and 145.
Examples of secondary addresses: 1FFFFFFF or FFFFFFFF.FFFF.FF.FF, where F is used as a wildcard when searching.
The search may take some time.
Under /assets/import/drvmbus there is a script to load 2 tags per meter. The packages in JSON format and meter ID.
More scripts where it will be possible to load tags for different values will be added at a later time.