Integrations
Modbus to MQTT, without a script.
Poll the Modbus registers with MaestroHub, decode them into typed values with names and units, and publish them to your MQTT broker on clean topics. No script to maintain, and every value keeps its quality and origin.
The flow
One value, from the machine to MQTT. Illustrative.
Modbusfieldbus protocolholding register 40021
MaestroHubCompressor 2 pressure · 6.8 bar · Good
- named, unit, quality
- origin stamped
- buffered on disk
MQTTmessage brokerplant/line2/compressor2/pressureWhy do it with MaestroHub
More than a pipe from Modbus to MQTT.
Registers decoded once, properly
Data type, byte order and scaling are configured per register, so nobody downstream parses raw 16-bit words.
A real namespace, not loose topics
Topics come from the plant model, so the broker carries a structure people and AI can navigate.
Quality on every message
A device that stops answering shows up as bad quality, instead of the last value silently repeating.
What lands in MQTT
An example. You choose the fields in the pipeline.
| topic | value | unit | quality | ts |
|---|---|---|---|---|
| plant/line2/compressor2/pressure | 6.8 | bar | good | 2026-10-03T06:00:01Z |
Set it up in three steps
- 1
Connect Modbus
Add a Modbus TCP, RTU or ASCII connection and create read functions for the registers and coils, with data type and scaling.
- 2
Give the values meaning
Map each value to a topic in the namespace with its name, unit and schema. Quality and origin are stamped on every value.
- 3
Deliver to MQTT
Add an MQTT publish output with a topic template, so every value lands on a clean, predictable topic.
Before you start
What each side needs, from the connector documentation.
Modbus
- For Modbus TCP: the device address as host:port. The standard port is 502.
- For RTU or ASCII: the serial device path (/dev/ttyUSB0 on Linux, COM3 on Windows) and the device's baud rate, data bits, parity and stop bits.
- The Unit ID (slave address, 0 to 247) configured on the device.
Example settings
- Transport Mode
- tcp
- IP Address:Port
- 192.168.1.10:502
- Unit ID
- 1
- Request Timeout (ms)
- 5000
- Retry Count
- 2
- Health Check Method
- status
MQTT
- A reachable MQTT broker: hostname, port (typically 1883 plain, 8883 for TLS) and protocol tcp, ssl, ws or wss.
- Broker credentials if the broker requires them. A password needs a username.
- For verified TLS or mutual TLS: the CA certificate, client certificate and private key in PEM format.
Example settings
- Protocol
- ssl
- Broker Hostname
- broker.example.com
- Port
- 8883
- MQTT Version
- 3.1.1
- Client ID
- <your-client-id>
- Keep Alive (sec)
- 60
Things to know
Pitfalls and limits the documentation calls out, so they don't surprise you on site.
Modbus
- Selecting ASCII mode does not change Data Bits or Parity. Many ASCII devices use 7E1, so set Data Bits to 7 and Parity to E yourself.
- If every function in a Read Group returns exception 2 (illegal data address) but each works alone, the Coalesce Max Register Gap is too high. Lower it, or set it to 0.
- Multi-register types need a matching quantity: float32 needs 2 registers, float64 needs 4. Wrong values usually mean the data type does not match the device's register format.
Limits
- Per request: up to 125 registers or 2,000 coils for reads, 123 registers (FC16) or 1,968 coils (FC15) for writes.
- RS-485 mode uses the Linux serial driver's RS-485 support and is ignored on Windows.
MQTT
- Plain ws cannot use TLS. Use wss for TLS over WebSocket.
- The certificate fields appear only when TLS is on and certificate verification is not skipped.
- On MQTT 5.0, write a shared subscription in the topic filter to load-balance across clients: $share/<group>/<topic>.
Limits
- Reconnection, subscription recovery and message acknowledgement are handled by the platform and cannot be configured on the connection.
What teams use it for
Building a unified namespace
Older Modbus equipment joins the same broker as modern PLCs.
Energy meters and utilities
Power, flow and pressure meters on one topic structure.
Retrofitting legacy machines
Machines without OPC UA brought into modern apps.
Ways to connect Modbus to MQTT
In general terms. Check any specific product for its own details.
Compare a custom script, a flow tool, a cloud vendor's edge service and MaestroHub
Swipe sideways to see every column
| A custom script | A flow tool | A cloud vendor's edge service | MaestroHub | |
|---|---|---|---|---|
| Talks Modbus | A library you choose | Community plug-ins | Depends on the vendor | Built in, one of 90+ connectors |
| Names, units and schema | You write it | You build it | Partly, in the vendor's model | One governed namespace |
| Quality on every value | You write it | You build it | Depends on the vendor | Built in, carried through calculations |
| Where each value came from | You write it | You build it | Depends on the vendor | Stamped on every value |
| Survives a network outage | You build it | You build it | Usually, to that vendor's cloud | On disk, per destination, in order |
| Several destinations at once | One script each | Yes, flow by flow | Mostly that vendor's cloud | Any mix, each with its own buffer |
| Permissions and audit | You build it | You build it | Cloud account permissions | Roles, single sign-on, audit trail |
| AI agents can use the data | You build it | You build it | Depends on the vendor | Through the MCP server |
Questions
How do I send Modbus data to MQTT?
Poll the Modbus registers with MaestroHub, decode them into typed values with names and units, and publish them to your MQTT broker on clean topics. No script to maintain, and every value keeps its quality and origin.
Do I need to write code to connect Modbus to MQTT?
No. You configure the Modbus connection and the MQTT output in MaestroHub and join them with a pipeline. Transformations can be added where you need them.
Where does MaestroHub run for this?
On your own infrastructure next to the machines: an edge box, a virtual machine or Kubernetes. Nothing has to leave your network.
Why not just write a script for Modbus to MQTT?
A script works on day one. The cost comes later: decoding and naming values, handling bad quality, buffering through outages, keeping credentials safe, and doing it again for the next machine and the next destination. MaestroHub does those once, for every connector.
What else can Modbus data go to?
More than 90 connectors are included in every edition, among them historians, databases, cloud warehouses, message brokers and business systems, so the same values can feed several destinations at once.
Try Modbus to MQTT yourself.
The free trial includes every connector. No factory to hand? The Digital Factory Simulator serves OPC UA, Modbus, MQTT and more on your laptop.




