MBus Driver
This driver provides support for interacting with MBus slaves using the Driver and Asset models.
Features:
- Meter readout in the JSON format
- Bus scanning
- Support for primary and secondary addressing
Note
It is not possible to connect the serial ports of Eurotech gateways to a MBus network directly. Connection should be made using an external MBus level converter with echo suppression.
Global driver configuration
The driver global configuration contains parameters related to the connection. The relevant parameters depend on the mode.
Serial mode
For establishing an serial connection, the following parameters are relevant:
-
Connection mode must be set to
SERIAL -
Serial port name should be set to the desired used serial port device (e.g.
/dev/ttyO3) -
Serial baud rate
-
Serial data bits
-
Serial stop bits
-
Serial parity
IP mode
For establishing an IP connection, the following parameters are relevant:
-
Connection mode must be set to
IP -
IP address should be set to the remote hostname or IP address
-
IP port number
Channel configuration
The driver support the following modes for READ channels configurable by the Read mode channel parameter, the meaning of the other parameters depends on the channel mode:
-
READ: Reads a specific slave addressed using either the primary or secondary address.
-
Primary address: If this parameter is set to a non-zero value, it specifies the primary address of the slave. If set to 0, the Secondary address parameter will be used.
-
Secondary address: A JSON object that defines the secondary address of the slave to read. The format of the JSON object is described in the SecondaryAddressIn section. The secondary address can contain wildcards.
The result will contain as a JSON array of VariableDataStructure objects, one for each frame received from the slave.
-
-
SCAN: Discovers the secondary addresses of the devices connected to the bus.
-
Primary address: Must be set to 0
-
Secondary address: A JSON object that defines the mask to be used for scanning. The format of the JSON object is described in the SecondaryAddressIn section. The secondary address should contain wildcards.
The result will contain as a JSON array of SecondaryAddressOut objects, one for each discovered slave.
-
-
SCAN_AND_READ: Discovers the secondary addresses of the devices connected to the bus and performs a read on each discovered device.
-
Primary address: Must be set to 0
-
Secondary address: A JSON object that defines the mask to be used for scanning. The format of the JSON object is described in the SecondaryAddressIn section. The secondary address should contain wildcards.
The result will contain as a JSON array of SecondaryAddressOut objects, one for each discovered slave.
-
In all cases the value.type parameter must be set to STRING as the driver will use the JSON format for channel output.
JSON representation
This section describes the JSON format used by the driver for input and output data. It is recommended to check output data for missing and/or null fields, that might be present if decoding slave responses fail.
DeviceType
a device type
- type :
string(enumerated) - Possible values
OTHEROIL_METERELECTRICITY_METERGAS_METERHEAT_METERSTEAM_METERWARM_WATER_METERWATER_METERHEAT_COST_ALLOCATORCOMPRESSED_AIRCOOLING_METER_OUTLETCOOLING_METER_INLETHEAT_METER_INLETHEAT_COOLING_METERBUS_SYSTEM_COMPONENTUNKNOWNRESERVED_FOR_METER_16RESERVED_FOR_METER_17RESERVED_FOR_METER_18RESERVED_FOR_METER_19CALORIFIC_VALUEHOT_WATER_METERCOLD_WATER_METERDUAL_REGISTER_WATER_METERPRESSURE_METERAD_CONVERTERSMOKE_DETECTORROOM_SENSOR_TEMP_HUMGAS_DETECTORRESERVED_FOR_SENSOR_0X1DRESERVED_FOR_SENSOR_0X1ERESERVED_FOR_SENSOR_0X1FBREAKER_ELECVALVE_GAS_OR_WATERRESERVED_FOR_SWITCHING_DEVICE_0X22RESERVED_FOR_SWITCHING_DEVICE_0X23RESERVED_FOR_SWITCHING_DEVICE_0X24CUSTOMER_UNIT_DISPLAY_DEVICERESERVED_FOR_CUSTOMER_UNIT_0X26RESERVED_FOR_CUSTOMER_UNIT_0X27WASTE_WATER_METERGARBAGERESERVED_FOR_CO2RESERVED_FOR_ENV_METER_0X2BRESERVED_FOR_ENV_METER_0X2CRESERVED_FOR_ENV_METER_0X2DRESERVED_FOR_ENV_METER_0X2ERESERVED_FOR_ENV_METER_0X2FRESERVED_FOR_SYSTEM_DEVICES_0X30COM_CONTROLLERUNIDIRECTION_REPEATERBIDIRECTION_REPEATERRESERVED_FOR_SYSTEM_DEVICES_0X34RESERVED_FOR_SYSTEM_DEVICES_0X35RADIO_CONVERTER_SYSTEM_SIDERADIO_CONVERTER_METER_SIDERESERVED_FOR_SYSTEM_DEVICES_0X38RESERVED_FOR_SYSTEM_DEVICES_0X39RESERVED_FOR_SYSTEM_DEVICES_0X3ARESERVED_FOR_SYSTEM_DEVICES_0X3BRESERVED_FOR_SYSTEM_DEVICES_0X3CRESERVED_FOR_SYSTEM_DEVICES_0X3DRESERVED_FOR_SYSTEM_DEVICES_0X3ERESERVED_FOR_SYSTEM_DEVICES_0X3FRESERVED
DataValueType
the type of the dataValue field
- type :
string(enumerated) - Possible values
LONGDOUBLEDATESTRINGBCDNONE
FunctionField
a function field
- type :
string(enumerated) - Possible values
INST_VALMAX_VALMIN_VALERROR_VAL
Unit
a data unit
- type :
string(enumerated) - Possible values
YEARMONTHWEEKDAYHOURMINSECONDDEGREEDEGREE_CELSIUSCURRENCYMETREMETRE_PER_SECONDCUBIC_METRECUBIC_METRE_CORRECTEDCUBIC_METRE_PER_HOURCUBIC_METRE_PER_HOUR_CORRECTEDCUBIC_METRE_PER_DAYCUBIC_METRE_PER_DAY_CORRECTEDLITREKILOGRAMNEWTONNEWTONMETERPASCALBARJOULEJOULE_PER_HOURWATTVOLT_AMPEREVARWATT_HOURVOLT_AMPERE_HOURVAR_HOURAMPERECOULOMBVOLTVOLT_PER_METREFARADOHMOHM_METREWEBERTESLAAMPERE_PER_METREHENRYHERTZACTIVE_ENERGY_METER_CONSTANT_OR_PULSE_VALUEREACTIVE_ENERGY_METER_CONSTANT_OR_PULSE_VALUEAPPARENT_ENERGY_METER_CONSTANT_OR_PULSE_VALUEVOLT_SQUARED_HOURSAMPERE_SQUARED_HOURSKILOGRAM_PER_SECONDSIEMENSKELVINVOLT_SQUARED_HOUR_METER_CONSTANT_OR_PULSE_VALUEAMPERE_SQUARED_HOUR_METER_CONSTANT_OR_PULSE_VALUEMETER_CONSTANT_OR_PULSE_VALUEPERCENTAGEAMPERE_HOURENERGY_PER_VOLUMECALORIFIC_VALUEMOLE_PERCENTMASS_DENSITYPASCAL_SECONDSPECIFIC_ENERGYSIGNAL_STRENGTHSIGNAL_STRENGTH_MICROVOLTLOGARITHMICRESERVEDOTHER_UNITCOUNTCUBIC_METRE_PER_SECONDCUBIC_METRE_PER_MINUTEKILOGRAM_PER_HOURCUBIC_FEETUS_GALLONUS_GALLON_PER_MINUTEUS_GALLON_PER_HOURDEGREE_FAHRENHEIT
SecondaryAddressOut
a secondary address present in output data
- type :
object
Properties:
manufacturerId
the manufacturer id
- type :
string
deviceId
the device id
- type :
string
version
the device version
- type :
number
deviceType
- a DeviceType element
asBytes
the secondary address encoded as a byte array
- type :
array
Element type:
a secondary address byte as unsigned integer- type :
number
- type :
asHex
the secondary adddres represented as an hex string
- type :
string
Example:
{
"manufacturerId": "LSE",
"deviceId": 10318243,
"version": 30,
"deviceType": "BUS_SYSTEM_COMPONENT",
"asBytes": [67, 130, 49, 16, 101, 50, 30, 14],
"asHex": "4382311065321E0E"
}
DataValue
a data value
-
type :
variant
Variants:
a numeric value, if dataValue is
LONG,DOUBLE,BCDorDATE. In the latter case, this field represents the date as the number of milliseconds sice UNIX epoch- type :
number
a string value, if dataValue is
STRING- type :
string
- type :
DataRecord
a data record in a VariableDataStructure
- type :
object
Properties:
description
a description
- type :
string
multiplierExponent
the multiplier exponent
- type :
number
scaledDataValue
- can be null if dataValue is not a number
the scaled data value - type :
number
storageNumber
the storage number
- type :
number
subunit
the subunit
- type :
number
tariff
the tariff
- type :
number
dataValue
- can be null if the dataValueType field is
NONE - a DataValue element
dib
the dib
- type :
array
Element type:
a dib byte represented as unsigned integer- type :
number
- type :
vib
the vib
- type :
array
Element type:
a vib byte represented as unsigned integer- type :
number
- type :
dataValueType
- a DataValueType element
functionField
- a FunctionField element
unit
- a Unit element
VariableDataStructure
a variable structure received as part of a request
- type :
object
Properties:
encryptionMode
describes the encryption mode
- type :
string
accessNumber
the access number
- type :
number
secondaryAdddress
- a SecondaryAddressOut element
manufacturerData
the manufacturer data
- type :
array
Element type:
a manufacturer data byte represented as unsigned integer- type :
number
- type :
numberOfEncryptedBlocks
the number of encrypted blocks
- type :
number
header
the header
- type :
array
Element type:
a header byte represented as unsigned integer- type :
number
- type :
status
the status
- type :
string
Example:
{
"encryptionMode": "NONE",
"accessNumber": 25,
"secondaryAddress": {
"manufacturerId": "LSE",
"deviceId": 10318243,
"version": 30,
"deviceType": "BUS_SYSTEM_COMPONENT",
"asBytes": [67, 130, 49, 16, 101, 50, 30, 14],
"asHex": "4382311065321E0E"
},
"manufacturerData": [],
"numberOfEncryptedBlocks": 0,
"header": [114, 67, 130, 49, 16, 101, 50, 30, 14, 25, 0, 0, 0],
"status": 0,
"dataRecords": [{
"description": "ON_TIME",
"multiplierExponent": 0,
"scaledDataValue": 4283.0,
"storageNumber": 0,
"subunit": 0,
"tariff": 0,
"dataValue": 4283,
"dib": [12],
"vib": [34],
"dataValueType": "BCD",
"functionField": "INST_VAL",
"unit": "HOUR"
}, {
"description": "DATE_TIME",
"multiplierExponent": 0,
"scaledDataValue": null,
"storageNumber": 0,
"subunit": 0,
"tariff": 0,
"dataValue": 962106720099,
"dib": [4],
"vib": [109],
"dataValueType": "DATE",
"functionField": "INST_VAL",
"unit": null
}, {
"description": "MODEL_VERSION",
"multiplierExponent": 0,
"scaledDataValue": 3.444564688926E12,
"storageNumber": 0,
"subunit": 0,
"tariff": 0,
"dataValue": 3444564688926,
"dib": [6],
"vib": [253, 12],
"dataValueType": "LONG",
"functionField": "INST_VAL",
"unit": null
}, {
"description": "PARAMETER_SET_ID",
"multiplierExponent": 0,
"scaledDataValue": null,
"storageNumber": 0,
"subunit": 0,
"tariff": 0,
"dataValue": "WTT16",
"dib": [13],
"vib": [253, 11],
"dataValueType": "STRING",
"functionField": "INST_VAL",
"unit": null
}, {
"description": "DATE",
"multiplierExponent": 0,
"scaledDataValue": null,
"storageNumber": 0,
"subunit": 0,
"tariff": 0,
"dataValue": 4993747200100,
"dib": [50],
"vib": [108],
"dataValueType": "DATE",
"functionField": "ERROR_VAL",
"unit": null
}, {
"description": "ADDRESS",
"multiplierExponent": 0,
"scaledDataValue": 256.0,
"storageNumber": 0,
"subunit": 0,
"tariff": 0,
"dataValue": 256,
"dib": [2],
"vib": [250, 61],
"dataValueType": "LONG",
"functionField": "INST_VAL",
"unit": null
}, {
"description": "% BATT",
"multiplierExponent": 0,
"scaledDataValue": 94.0,
"storageNumber": 0,
"subunit": 0,
"tariff": 0,
"dataValue": 94,
"dib": [1],
"vib": [124, 6, 84, 84, 65, 66, 32, 37],
"dataValueType": "LONG",
"functionField": "INST_VAL",
"unit": null
}]
}
SecondaryAddressIn
a secondary address present in channel configuration
- type :
object
Properties:
manufacturerId
- can be null to use a wildcard, or
asBytesorasHexare specified
the manufacturer id - type :
string
deviceId
- can be null to use a wildcard, or
asBytesorasHexare specified
the device id - type :
variant
Variants:
the device id encoded a number between 0 and 99999999- type :
number
the device id encoded as a string, it must have lenght 8 and contain only digits orfwildcards- type :
string
- type :
version
- can be null to use a wildcard, or
asBytesorasHexare specified
the device version - type :
number
deviceType
- can be null to use a wildcard, or
asBytesorasHexare specified
the device type - type :
variant
Variants:
the device id encoded as a number- type :
number
- a DeviceType element
- type :
asBytes
- can be null if the other parameters are specified
the secondary address encoded as a byte array - type :
array
Element type:
a secondary address byte as unsigned integer- type :
number
- type :
asHex
- can be null if the other parameters are specified
the secondary adddres represented as an hex string - type :
string
Examples:
{
"asHex": "4382311065321E0E"
}
{
"deviceId": 10318243,
"manufacturerId": "LSE"
}
{
"asHex": "FFFFFFFFFFFFFFFF"
}
{
"deviceId": "1031FFFF"
}
Updated almost 2 years ago
