mbus: M-Bus

Top  Previous  Next

M-Bus is a series of European standards for remote reading of water, gas, and electricity meters (EN 13757).

 

This API has support for two different types of M-Bus: Wired M-Bus and Wireless M-Bus.

 

Wired M-Bus uses two wires to communicate with a number of devices that might be powered by the master.

The master sends a request and the slave devices respond.

The slave devices can be addressed using either a short primary address which is an integer typically in the range 1-250, or the secondary address which is a unique 16-byte string. See mbusScan for details about the format of the secondary address.

 

Wireless M-Bus uses RF to transmit the messages.

The slaves send data periodically without the master needing to do anything.

Wireless M-Bus only uses secondary addresses.

Wireless M-Bus data is often encrypted, so the correct decryption key is needed to parse the data.

When a Wireless M-Bus frame is received, it is kept in an internal buffer until it is either read with mbusRecordSlaveInfo or mbusReceive or it is overwritten by a newer message when the buffer is full.

 

 

The following functions are used to access both types of M-Bus:


mbusOpen

Opens a connection to an M-Bus interface,


mbusClose

Closes an M-Bus connection.


mbusRecordSlaveInfo

Get information about slave device.


mbusRecordCount

Get number of records on slave device.


mbusRecordGetInfo

Get information about a record.


mbusRecordGetType

Get record data type.


mbusRecordGetBuffer

Read record value into a buffer.


mbusRecordGetInt

Read record value as a DINT.


mbusRecordGetIntLarge

Read large record value as two DINTs


mbusRecordGetFloat

Read record value as a float.


mbusRecordGetString

Read record value as a string.


mbusRecordGetLinsec

Read record value as a linsec value.


mbusSend

Send a raw M-Bus frame.


mbusReceive

Receive a raw M-Bus frame.

 

The following functions are only used for wired M-Bus:


mbusBaudSet

Change the baud rate for an M-Bus connection.


mbusScan

Scan for M-bus slave devices.


mbusScanStop

Stop the M-Bus scan.


mbusSlaveConfigBaud

Change baud rate on slave device.


mbusSlaveConfigAddress

Change primary address on slave device.


mbusSlaveConfigReset

Send application reset to slave device.


mbusDataRequest

Request data from slave device.


mbusSelectSecondary

Select a secondary address to be made available as primary address 253, for use with mbusSend.

 

The following functions are only used for wireless M-Bus:


mbusSlaveRegister

Register a wireless M-Bus slave device with optional decryption key.


mbusSlaveUnregister

Remove registration.


mbusFilterEnable

Control if data from all or only registered slaves should be received.


mbusDataReceive

Receive a frame from wireless M-Bus


mbusSetSenderAddress

Set address to use as sender when sending Wireless M-Bus frames with mbusSend.