Quickstart
modpoll2mqtt communicates with Modbus devices using CSV configuration files. For the examples below, replace the TCP address with your device IP (or use examples/modsim.csv against a local Modbus TCP simulator).
Poll once
modpoll --once --tcp 192.168.1.10 --config examples/modsim.csv
Publish to MQTT
modpoll --tcp 192.168.1.10 --mqtt-host broker.emqx.io --config examples/modsim.csv
With successful polling and publishing, subscribe to modpoll/{device_name}/data on the same broker to view the data.
Add --mqtt-retain so the broker keeps the last data and diagnostics message per topic for new subscribers. The status topic modpoll/status is always retained. See Basic Usage for caveats.
Write by reference
Publish to modpoll/{device}/set:
{
"holding_reg01": 42
}
See Basic Usage for MQTT topics, write constraints (including bool8 array values), and read-only object types.
Validate before running
modpoll --check-config --config examples/modsim.csv
For separate gateways sharing a broker, give each process its own
--mqtt-namespace and, if persistent sessions are needed, --mqtt-clientid.
Use Operation and migration from 2.2.1 to configure bounded queues and safe command handling.