{% extends '_mbusascii2mqtt_layout.html' %} {% block content %} Pi-900 MBus2MQTT Documentation

Pi-900 MBus2MQTT Documentation

Chapter 0 About

This manual applies to MBus2MQTT >= 1.0.0 The program needs MBusHub >= 2.03.01

Manual version 2023-10-27

Chapter 1 Quick setup

MBusHub setup:

  • Set the masterport configuration file to your configuration file (myconfig.csv)
  • Set slaveport 2 to MBusAscii, UDP port 10002

MBus2MQTT Azure setup:

  • Set Broker Type to Azure
  • Set Enable to Yes
  • MBusAscii ip address and port to UDP 127.0.0.1 10002
  • Configuration file to your config file (myconfig.csv)
  • Hub address to the Azure address
  • Hub port must be 8883
  • Device ID to your Azure Device Id
  • UserName to mqtt, not used but empty is not tested.
  • Device Key to your Azure Device Key
  • Topic, not used.
  • Insecure: NO if hostname should be verified, YES for no verification. Azure requires Insecure = NO.
  • Certificate, used for port 8883. Must be the correct for the MQTT broker.

MBus2MQTT Standard MQTT setup:

  • Broker type to MQTT
  • Enable to YES
  • MBusAscii ip address and port to UDP 127.0.0.1 10002
  • Configuration file to your config file (myconfig.csv)
  • Hub address to the MQTT address
  • Hub port must be 8883 for encrypted secure connection, 1883 for plain text.
  • Device ID, user defined ID (no spaces)
  • Username to MQTT username
  • Device Key/Password
  • Topic. Topic ahead of OPC item <Topic>/<OPC-item>
  • Insecure. NO
  • Certificate file to no file for using internal CA-bundle

Chapter 2 General description

MBus2MQTT reads out MBusAscii OPC-items from MBusHub and pushes them to an MQTT broker. The behavior is very similar to Quickpost.

The program uses the same (CSV) configuration file as Quickpost, MBusHub and OPC-server.

It supports both normal MQTT and Azure MQTT but the output file formats are a bit different for the two platforms.

MQTT standard format:

Topic = "MyTopic/Channel/Device/Tag" where Channel, Device, Tag can contain any number of slashes "/".

The channel can be set as the Pi-900 serial number. The device can be automatically configured as the device secondary address and the tag can be automatically defined from the datarecord VIB.

In the MBusOPC program there is support for Groups OPC item = Channel.Group_Device.Tag

Group can be used to define location but the automatic configuration doesn't support groups.

Payload = {"v" : Value, "u" : "Unit", "ts" : "ISO8601 GMT Timestamp", "q" : "OPC Quality"}

v:

Value

u:

Unit

ts:

Timestamp. UTC or GMT in ISO8601 format

q:

Quality of measured value. The OPC quality definition will most probably be used. (This is not the same as the MQTT QoS)

Example:

Topic = MyTopic/16784926/00011494LAS0732/FabricationNo

Payload = {"v" : 16784926,"u" : " Fabrication No","ts" : "2019-11-29T11:32:25Z","q" : "0x00C0"}

Azure format:

Topic:Hard coded to 'devices/' + deviceId + '/messages/events/'
Payload:{"payload":[{"Channel" : "Channel value", "Device" : "Device value", "Tag" : "Tag value", "v" : "Value", "u" : "Unit", "ts" : "GMT Timestamp", "q" : "Quality"}]}
Example:{"payload":[{"Channel" : "pi900","Device" : "PIIa","Tag" : "FabricationNo","v" : 16784911,"u" : " Fabrication No","ts" : "2020-03-09T09:24:51Z","q" : "0x00C0"},{"Channel" : "pi900","Device" : "PIIa","Tag" : "Voltage","v" : 397E-1,"u" : "V","ts" : "2020-03-09T09:24:52Z","q" : "0x00C0"}]}

Note on "Device value". The PiiGAB programs use an optional Group value which will be added to the Device value with a "_" in between. "Device" : "GroupValue_DeviceValue"

Chapter 2 Configuration parameters

Main Configuration

Read Period:Read period in seconds. This is a delay between the last reading to the first reading of the next readout.
Broker type:Available values MQTT and Azure.

M-BusAscii port configuration

Type and IP:Should be Type=UDP, Remote IP = 127.0.0.1 unless you want to connect to another Pi-900 gateway.
Remote Port:Set to the portnumber of the Slaveport. Default = 10002, Slaveport2 is the recommended port.
Configuration file:
 CSV configuration file. The configuration file for MBusHub masterport must either contain the same OPC-items or be the same file.

MQTT Port Configuration

Hub address:IP address of MQTT broker.
Hub Port:IP port of MQTT broker. 8883 for TLS, 1883 for non-TLS.
Device ID:Must be defined for Azure, can be any value for MQTT.
Device Key:Device key without SAS token for Azure, password for MQTT.
User name:MQTT user name, not used for Azure.
Insecure:Yes means that the identity of the broker will not be checked.
Certificate File:
 TLS certificate file. This file must match the MQTT broker. This will be replaced by a bundle of certificates or at least the option will be added. Note: Baltimore_CyberTrust_Root.crt is obsolete. If using it, please remove and set Certificate to "No File" for using internal CA-bundle or upload a modern file if a non-standard file is needed.
Use TLS:Set to YES if unsure. TLS will not be used for port 1883 even if Use TLS = YES. In general, port 8883 uses TLS and 1883 does not.
Quality Of Service (QOS):
 Sets how MQTT sends messages. Please refer to MQTT documentation for details. Default 1.

Troubleshooting guide

If your mqtt is not sending data to your azure portal try the following steps: #. Check that the correct configuration file is selected #. Make sure you use a unique Device ID. #. Remove username and topic. #. make sure insecure is set correctly according to the manual. #. set certificate file to "no file". #. Try changing the QOS to find someone who fits.

{% endblock content %}