Explainer
Why an MQTT service cannot export attached serial device data
Short answer
Yes — the built-in MQTT client on a groov RIO publishes only the unit's own I/O data. It cannot set an attached serial device's baud rate or parity, poll its Modbus RTU registers, or derive a device state. Read the device in Node-RED and publish through an MQTT out node, with any derived state on its own topic.
On this page
- What can the built-in MQTT client publish by itself?
- Why can't MQTT read or configure an attached serial device?
- How do Modbus RTU register values reach the cloud broker?
- Where does an attached device's 'state' come from?
- Does this keep the groov RIO as the only computer on premises?
- Can serial values join the Sparkplug B namespace the built-in client uses?
- What do you verify before leaving the RIO alone on site?
- Questions asked
Correct — and the reason is structural, not a missing setting. The MQTT client built into a groov RIO publishes only the RIO's own I/O, as Sparkplug B or plain string payloads. MQTT is a message transport: nothing in it sets an attached RS-485 device's baud rate or parity, and nothing in it knows which Modbus RTU registers your device holds. The bridge is Node-RED running on the RIO itself: a serial node or a Modbus RTU poll node reads the device, an MQTT out node publishes the values to your cloud broker, and any 'device state' is computed in flow logic and sent on its own topic. The RIO stays the only computer on premises.
What can the built-in MQTT client publish by itself? #
The MQTT client configured in groov Manage publishes the RIO's own I/O — on groov EPIC, PAC Control tag data joins it — as Sparkplug B or plain string payloads, and it publishes on change, the report-by-exception behavior the vendor documents for these built-in clients.
The client reads the module's internal I/O database and sends what changed; it also subscribes, so commands can come back down to its own outputs. Its data sources stop there. The configuration lives in groov Manage, and no source in that configuration corresponds to an attached serial device. That is the whole boundary: data the client never holds is data it can never publish.
| Data source | What publishes it | Where a subscriber finds it |
|---|---|---|
| The RIO's own I/O channels | The built-in MQTT client configured in groov Manage | The client's Sparkplug B or string-payload topics |
| Register values from an attached RS-485 or Modbus RTU device | A Node-RED poll or serial node feeding an MQTT out node | The topics you assign in the MQTT out node |
| Derived device state | Node-RED flow logic feeding an MQTT out node | A topic of its own, kept separate from measured values |
Why can't MQTT read or configure an attached serial device? #
Because MQTT only moves messages that a client already holds: the protocol has no message that sets a serial port's baud rate or parity, no register model, and no polling scheduler, so the built-in client has nothing to configure and nothing to read on the RS-485 bus.
MQTT, published as an OASIS standard, is publish/subscribe messaging: a client connects to a broker and exchanges topic and payload pairs. It defines no port parameters, no register map and no scheduler. The attached device, meanwhile, speaks Modbus RTU frames on the RS-485 pair, and something local has to open that port at the device's framing, address it as a slave (addresses run from 1 to 247), and drive the request/response cycle with function codes such as read holding registers (03) and read input registers (04).
The built-in client does none of that: it never opens the serial port and holds no register addresses, which is why its configuration has no place to enter a baud rate, a parity or a poll table. The decision follows directly — any data from an attached serial device needs a local reader on the bus, and on this platform that reader is Node-RED.
How do Modbus RTU register values reach the cloud broker? #
A Node-RED Modbus RTU poll node opens the RIO's serial port with the device's settings, cycles read requests against the register list, and hands the decoded values to an MQTT out node that publishes them to your cloud broker on the topics you choose.
Set it up in this order:
- The serial node's port settings — baud rate, parity, stop bits and the device's slave address — matched to the device's own documentation.
- The poll: function code, starting register and register count.
- The interval between polls.
- The MQTT out node: cloud broker address, TLS, credentials and the topic prefix for these values.
What can one RS-485 segment carry per poll? #
At 9600 baud with 8 data bits, no parity and 1 stop bit, one read of ten holding registers costs about 42 ms of wire time including framing silence, and that number — not MQTT — is what decides how many slaves and how fast one segment can cycle.
Worked example, at example settings: one slave, function code 03, 9600 baud, 8 data bits, no parity, 1 stop bit, immediate slave response. An asynchronous byte costs 10 bits on the wire (start bit, 8 data bits, stop bit). A single-register read is an 8-byte request and a 7-byte response, so 15 × 10 = 150 bits ÷ 9600 b/s ≈ 15.6 ms, plus the silent gap of 3.5 character times required on each side of a frame (2 × 3.5 × 1.04 ms ≈ 7.3 ms), giving about 23 ms per single-register poll.
Reading ten registers in one request grows the response to 25 bytes: (8 + 25) × 10 = 330 bits ÷ 9600 b/s ≈ 34.4 ms, and with the same gaps about 42 ms — one transaction where ten singles would cost roughly 10 × 23 ms ≈ 230 ms, about 5.5× more wire time for the same ten values. On a 500 ms cycle the batched read occupies about 42 ÷ 500 ≈ 8.3% of the segment, leaving room for more slaves; the same ten values as ten separate polls would occupy about 46%, which is where a second slave no longer fits in the cycle.
The framing the device demands moves every one of these numbers: at 8E1, even parity, each byte costs 11 bits, so the same single-register exchange is 15 × 11 = 165 bits ÷ 9600 b/s ≈ 17.2 ms plus about 8 ms of gaps ≈ 25 ms. Treat the arithmetic as a floor: a slow slave adds its own turnaround time to every transaction on top of it.
None of this touches MQTT. The out node publishes whatever the poll delivers — on change only, or on every poll when a consumer wants a fixed heartbeat — and the poll interval, not the broker, sizes the wire load.
Where does an attached device's 'state' come from? #
From your own definition, computed in flow logic: a register stream carries no connection-status object, so 'device running' or 'device failed' exists only after you decide what those mean and have Node-RED derive and publish them on a topic separate from the measured values.
Make the definition operational. A workable rule: with the poll interval at 500 ms, publish offline on the state topic after three consecutive polls without a valid CRC-checked response — about 1.5 s without good data — and publish online again on the first valid frame. A status register inside the device is still just a value: poll it with the rest if it helps your definition, but keep the timeout rule anyway, because a dead device and a frozen register look identical on the wire.
Keeping measured values and derived state on separate topics lets a subscriber alarm on the state without parsing registers, and trust the values without inheriting your state logic.
If anything downstream will write back to the device, route it through an MQTT in node into a function node that checks range and plausibility before any Modbus write executes: a broker message should never move a physical output on its own.
Does this keep the groov RIO as the only computer on premises? #
Yes: Node-RED ships with the groov platform and runs on the RIO itself, so the polling flow, the derived-state logic and the MQTT out connection all execute on the same box that owns the I/O, and the only other participant is the broker in the cloud.
The two publishers share the box, so give them separate identities at the broker: a client ID and credentials for the built-in client, a different pair for the out node, and out-node topics kept outside the built-in client's Sparkplug namespace. Deployment stays scriptable too, because you can start and stop the RIO's Data Services from Node-RED — starting and stopping groov RIO Data Services from Node-RED covers that procedure.
The same box also scales further than most single-device jobs: dozens of registers across a few slaves sit comfortably inside the budget above. When the polling grows into several protocols, or you want local buffering and history next to the flows, move that logic onto a fanless industrial mini PC in the same cabinet and leave the RIO on I/O duty.
Can serial values join the Sparkplug B namespace the built-in client uses? #
Not from the MQTT out node: a plain out-node publish writes a topic and a payload, while Sparkplug B requires a birth/certificate sequence and an encoded payload that only a Sparkplug-aware client produces, so keep plain topics and the built-in client's namespace separate.
The built-in client declares the RIO itself as the Sparkplug edge node, and its metrics are the RIO's I/O. Your serial device contributes no metrics to that client, so no broker-side configuration makes it appear as a Sparkplug device: device metrics exist because a publishing client declares them, a point traced in detail in why a missing Sparkplug B device tag points back to the publishing client. The namespace also runs its own lifecycle — DBIRTH once, then DDATA only on change — which why Sparkplug B sends DBIRTH once and DDATA only on change explains.
So decide deliberately. For a single site feeding a historian or a dashboard, publish the polled values on plain application topics and let subscribers follow both namespaces; that is the simpler default. Adopt a Sparkplug-aware client for Node-RED — one that declares the serial device as its own Sparkplug device with birth and death certificates — only when the upstream host consumes the Sparkplug model exclusively.
What do you verify before leaving the RIO alone on site? #
Four checks, each against its own path: the built-in client's I/O topics arrive at the broker, the polled register values arrive on your out-node topics, the derived state topic flips on a real timeout, and the whole chain recovers after a broker outage.
- Break the RS-485 line at a known moment. The state topic must publish offline inside the timeout window — about 1.5 s under the example rule — and the register topics must stop updating, not repeat their last value.
- Check independence in the same test: the built-in client keeps publishing the RIO's own I/O throughout, because the two paths share nothing.
- Prove payload fidelity: place a known value in a register you can write, or read one shown on the device's own display, and confirm that exact value arrives on the broker topic with a fresh timestamp.
- Test recovery: drop the uplink to the broker for a minute and watch the out node. If it reconnects but then publishes nothing, work through why an MQTT client reconnects but then publishes nothing before touching the serial side.
Questions asked
What should the MQTT out node point at for a cloud broker?
Use TLS on the broker's secure port, commonly 8883 for MQTT over TLS, with credentials created for this publisher alone and a client ID no other client uses. Quality of service 1 suits register values; quality of service 0 is acceptable when the next poll soon supersedes the last. Leave retain cleared on register values so a restarting subscriber does not mistake a stale value for a live one, and set retain on the derived state topic so the last known state survives a subscriber restart.
How much broker traffic does one polled serial device generate?
Worst case, the flow publishes on every poll: at one poll every 500 ms that is 2 publishes per second, and with an example 10-register JSON payload of roughly 180 bytes the stream is about 360 bytes per second, or about 31 MB per day for that one device. Publishing only on change cuts this by however often the process actually moves, and slower poll intervals cut it proportionally.
Can anything on the broker reach the RS-485 bus directly?
No. MQTT has no serial side; the bus exists only behind the RIO's port. Any cloud service that claims to read Modbus RTU still needs a local translator on site, either the Node-RED flow described above or an external serial gateway with its own Modbus and MQTT clients. Keeping the translator on the RIO is what lets one box remain the only computer on the premises.
How should I choose the poll interval for the serial device?
Derive it from the process first and the wire second: a value that matters at one-minute resolution does not need half-second polling. Then check the segment budget — with the example numbers, a batched 10-register read costs about 42 ms of wire time at 9600 baud, so a 500 ms cycle leaves roughly 92% of the segment idle and room for more slaves. Shorten the interval only when the process needs it; the MQTT side is not the constraint.