Stream from a PLC over Modbus
Read a PLC, power meter or controller over Modbus TCP or RTU. Each register you map becomes a channel.
Before you start
- For TCP, the device's address and port (usually
502). For RTU, its serial port (/dev/ttyUSB0,COM3) and line settings. - Its unit ID — usually
1. - Its register map, from the device manual.
Steps
Open Connectors, search for
modbus, and press Install.Open Inputs, press Add input, and choose modbus.
Fill the fields:
Field Example Device name plc1— channels read/modbus/plc1/…Connection (host:port or serial device) 192.168.1.60:502or/dev/ttyUSB0Transport tcp(default) orrtuUnit ID 1Poll rate (Hz) 10For
rtu, also set Serial baud rate (RTU), Serial parity (RTU), Serial stop bits (RTU) and Serial data bits (RTU). Defaults are 9600 8N1.Paste your device's map into Register map (JSON), one entry per value:
[{"alias": "temp", "address": 0, "kind": "input", "dtype": "i16", "scale": {"gain": 0.1, "offset": 0}, "unit": "degC"}, {"alias": "pump_speed_sp", "address": 10, "kind": "holding", "dtype": "u16", "unit": "rpm", "writable": true}]Key Value aliasthe channel's last path segment addresszero-based — a manual's 40001is0kindinput·holding·coil·discretedtypeu16·i16·u32·i32·f32;boolforcoilanddiscretescalegainandoffsetinto engineering unitswritabletrueto accept setpointsPress Test connection. It reads the first mapped register. A pass means the device answered.
Press Add & start.
In Channels, type a name and unit for each, such as
temp→bearing temperature,degC.
Check it worked
On Inputs, the row counts samples at about your poll rate. On Live,
each value shows as /modbus/plc1/<alias>.
A 32-bit value reads as nonsense? Add "word_swap": true to its map
entry. Some devices send the low word first.
Updated