Updated for firmware 3.00.00 (first published 02.01.2025).
1. Introduction
Wireless M-Bus (M-Bus) is a widely used communication protocol for remote meter reading in smart metering applications. The Open Metering System (OMS) standard ensures interoperability between different manufacturers' devices. When integrating Wireless M-Bus OMS data into an IoT ecosystem, MQTT (Message Queuing Telemetry Transport) is a preferred protocol due to its lightweight and efficient data transmission.
STG Series WMBus Gateways receive Wireless M-Bus (WMBus) telegrams of meters over the air, decrypt and parse them, and make the meter values available as Modbus registers and as MQTT messages. This article shows how to send the meter data to an MQTT broker; the details are in chapter 13 "Sending WMBus Data to an MQTT Server" of the STG user manual.
Prerequisites
Before starting, ensure you have the following:
• A Wireless M-Bus OMS-enabled meter
• An STG series gateway
• An MQTT broker that accepts an unencrypted MQTT connection with user name and password; encrypted MQTT (TLS) is not supported.
• An Ethernet connection between the gateway and the broker (the STG655 can also use its BPL link).

2.Step 1: Setting Up the STG Series Gateway
1. Connect to the gateway: power it up and open its web interface; the abcZ Network Tool finds its address by MAC address.
2. Choose a function that publishes: on the Operating Mode page set Device Function to WMBus Decoder/Parser and MQTT Publisher (MQTT only), or to one of the two Modbus gateway functions if Modbus should run at the same time.
3. Configure WMBus reception: on the WMBus Settings page select Rx Package Reception Mode - S - Mode, T - Mode or C / T - Mode ( combined reception of T and C Mode messages ) - as your meters transmit.
4. Add the meters and their keys: press Refresh Auto Config List, type the AES key of each encrypted meter and save. Each meter needs an enabled row in Device Query Settings on the Operating Mode page; saving with Add to Config creates that row.
5. Decoding is automatic: a meter is published when it has an enabled row and its telegram could be decrypted and decoded.
3. Step 2: Configuring MQTT Communication
1. Open Network Settings. In the Modbus gateway functions tick Enable MQTT Publisher for Parsed WMBus Packages.
2. Enter MQTT Broker IP or URL and MQTT Broker Port (usually 1883).
3. Enter a Client ID that is unique on the broker, then User Name and Password. Both are always sent and cannot be left empty.
4. Enter the Publish Topic (for example meters/wmbus/data) and a Subscribe Topic that belongs to this device only.
5. Choose the Data Format: RAW WMBUS DECRYPTED DATA, PARSED DATA AS OBJECTS or PARSED DATA AS MODBUS FRAME.
6. Set Minimum Send Interval for a Parsed Data (in seconds): the shortest time between two messages of the same meter (factory default 60).
7. Enter the NTP Server IP or URL if the messages should carry time stamps. Save and restart the device (Management page, Reboot Device).
Enable MQTT only when the broker can be reached: while it cannot be reached the gateway restarts after about 13 minutes, and once more after the same time, to recover the connection; after two such restarts in a row it stays up and waits.
4. Step 3: Testing and Monitoring
1. On the gateway: the Device Status page shows MQTT Status APP_MQTT_STATE_SUBSCRIBED when the device is connected to the broker and has subscribed; MQTT Sent Messages counts the published messages.
2. On the broker: use an MQTT client (e.g., Tago.io, MQTT Explorer, Mosquitto_sub) to monitor the topic.
3. Read a message. In PARSED DATA AS OBJECTS each record carries storage number, function, data type and value:
{"STGid":"5A9A","STGNme":"STG_21ea_LAB","Time":"1792047106","RxTm":"1792047106","Data":{"DevId":"19142190","ManId":"9B4","Ver":"13","Typ":"7","RSSI":"-64","AcNu":"58","DtCnt":"2","Blcks":[{"S":"0","F":"1","T":"3","V":"1230"},{"S":"0","F":"1","T":"47","V":"15-10-2026 10:01:00 DST:0"}]}}
Data type 3 is VOLUME l, data type 47 is DATE & TIME; the codes are the same as in the Modbus register map.
4. Compare the values with the meter readings. "Time" and "RxTm" are present only while the gateway has a current time from the NTP server.
NOTE: The message layouts of all three formats, the connection behaviour and configuration over MQTT are described in chapter 13 "Sending WMBus Data to an MQTT Server" of the STG user manual.

5.Conclusion
Integrating Wireless M-Bus OMS data with an MQTT server using the STG series gateway enables seamless remote monitoring and data analytics for smart metering applications. By following the setup steps outlined above, you can efficiently collect, format, and transmit meter data to any MQTT-compatible IoT platform, enhancing automation and decision-making processes.
For further customization, process the messages on the subscriber side of your broker. The gateway connects without TLS (encrypted MQTT is not supported), so a cloud platform that accepts only TLS connections cannot be the gateway's broker directly.
