Skip to content
Contents
GuidesOpenWrt

Buffer Modbus readings on OpenWrt and catch up over MQTT after an outage

First distinguish between read-only telemetry, alarms, and control. Each device records wiring, register mapping, units, sequence, and read cycle.

First distinguish between read-only telemetry, alarms, and control. Each device records wiring, register mapping, units, sequence, and read cycle. Separate industrial field networks from business networks. Device commands are determined by specific control channels.

Start with a read-only metric

Read a register from the manufacturer's datasheet and compare with actual measurement. The message includes device ID, UTC time, sequence number, and unit. MQTT uses minimum privileges and requires encrypted connections. During local network outages, cache data within bounded limits; upon recovery, perform idempotent upload.

Verify offline cache and duplicate messages against known input

Use a test Modbus register to generate known values and verify MQTT unit and timestamp. After disconnecting from the cloud network and then restoring connectivity, inspect the buffer and message ordering.

Shutdown the bus, stop the broker, and disconnect from the external network. Record timeout events, false alarms, retry attempts, and missing data points during retransmission. After increasing concurrency, verify that on-site safety and gateway forwarding are unaffected.

After recovery, it is possible to distinguish between new and old data and duplicate reporting. After testing stops, retain read-only data collection and enforce authorized write boundaries.

Verify the MQTT leg in the lab before connecting a device collector. · OpenWrt 25.12.6 x86/64 (QEMU/KVM).
Check the terminal output
Verify the MQTT leg in the lab before connecting a device collector. · OpenWrt 25.12.6 x86/64 (QEMU/KVM).
Verify the MQTT leg in the lab before connecting a device collector. · OpenWrt 25.12.6 x86/64 (QEMU/KVM). Open the original image

Reference

Related guides

Reference

Check the model, region and hardware revision on the label before selecting firmware.

Explore hardware

Comments