1. Introduction
The Modbus connector extracts values from Modbus devices and forwards the data to gRPC_kafka. Configuration is JSON‑based, enabling clear, repeatable deployments for both Modbus TCP and RTU environments.Key Features
- Unified TCP & RTU support – switch protocols per tag without changing code.
- Flexible polling triggers – send data when registers change or at fixed intervals.
- Batch grouping by request ID – reduce bus chatter by bundling registers into shared requests.
- Comprehensive logging – customizable log file location, size rotation, and log levels for easy troubleshooting.
- Byte‑order & data‑type handling – interpret register values correctly with configurable endianness and type definitions.
2. Configuration
The Modbus connector is configured through a JSON file composed of:- a
logSettingsobject (optional), - an
msDelayvalue (optional), - a
tagConfigurationarray (required).
tagConfiguration defines one register to poll and forward to the gRPC pipeline.
Top-level fields
IfmsDelayis not provided, the connector uses10ms.
IfmsDelayis below10, it is automatically clamped to10ms.
Backward compatibility: the legacy configuration format (root JSON array of tags) is still accepted. In that legacy format, msDelay is not available.
logSettings
tagConfiguration entries
Each entry describes one Modbus register to read.
Common fields
Note on dataPoint: The connector strips any text before the final / in the dataPoint value and uses only the number portion for the register address. This means prefixes (e.g., hr) are optional and serve only as human-readable hints; the register type is taken from commParams.registerType. It is useful to distinguish from modbus registers having the same addresses but on different registerType.
commParams for both TCP and RTU
Additional commParams for modbus_rtu
Example configurations
Modbus TCP
A bit offset can be appended with a -. The number after - selects the bit (0‑based) within the addressed register. Example configurations from the repository show usage such as “dataPoint”: “45-3”, meaning bit 3 of register 45:
Modbus RTU
3. Message format sent to Nexalis Cloud
4. Running the Connector
The Modbus connector is launched automatically by the Nexalis Agent.No manual execution is required under normal circumstances. For debugging purposes only, you can start it manually without using the Nexalis Agent launcher, you need to be in the directory of the executable “modbus_connector” and require four items:
- siteName: custom name of site where the data source is located
- deviceID: custom unique identification of the data source (Modbus server)
- communicationAddress: IP address and port being used by the outstation.
- deviceModel: Json file that contains the Modbus configuration (node definition, authentication, etc.).
5. Modbus data type
This section provides a detailed explanation of the possible configurable data types for the Nexalis agent Modbus connector. These types determine how data is structured, interpreted, and transmitted between a Modbus server and the Nexalis agent.-
Signed Integer Types
- s8: 8-bit signed integer (-128 to 127).
- s16: 16-bit signed integer (-32,768 to 32,767).
- s32: 32-bit signed integer (-2,147,483,648 to 2,147,483,647).
- s64: 64-bit signed integer (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807).
-
Unsigned Integer Types
- u8: 8-bit unsigned integer (0 to 255).
- u16: 16-bit unsigned integer (0 to 65,535).
- u32: 32-bit unsigned integer (0 to 4,294,967,295).
- u64: 64-bit unsigned integer (0 to 18,446,744,073,709,551,615).
-
Floating-Point Types
- float16: 16-bit floating-point number, IEEE 754 half precision (one registers).
- float32: 32-bit single-precision floating-point number, IEEE 754 single precision (two registers).
- float64: 64-bit double-precision floating-point number, IEEE 754 double precision (four registers).
-
String Types
- string-N: N-byte fixed-length string (use “A” or “B” as byteorder to skip most or least significant bytes). For example, string-4.
- utf8-N: N-byte UTF-8 encoded string (use A or B as byteorder to skip most or least significant bytes). For example, utf8-4.
- ascii-N: N-byte ASCII string (use A or B as byteorder to skip most or least significant bytes). For example, ascii-4.
- binary-N: N-byte binary string (Base64 encoded) (use A or B as byteorder to skip most or least significant bytes). For example, binary-4.
-
Timestamp Types
- timestamp-uint32: uint32 timestamp in seconds converted into 64bit integer milliseconds.
- timestamp-uint64: uint64 timestamp in seconds converted into 64bit integer milliseconds.
- timestamp-uint64-ms: uint64 timestamp in milliseconds converted into 64bit integer milliseconds.
- timestamp-float64: float64 timestamp in seconds converted into 64bit integer milliseconds.
- timestamp-float64-ms: float64 timestamp in millisecond converted into 64bit integer milliseconds.
- timestamp-ntp: ntp style timestamp 32 bit second and 32 bit fractional seconds converted into 64bit integer milliseconds
-
Bit Types
- bit: Single bit Boolean
- [Address]-N: Boolean extraction from a register. For example, 45-0 (register 45, bit 0). 45-3 means we extract the fourth bit.
- bit-N: N bits extracted from a specific register, the bit offset can be specified with LSB0 in the dataPoint. For example, dataPoint: 45-5 (register 45, bit 5) and bit-3 (3 bits from 45-5)
6. Modbus general information
Modbus data model
Modbus servers store values on register addresses. A Modbus register address is a specific location within a Modbus-compatible device (such as a sensor, actuator, or controller) where data is stored and can be read or written. These addresses are used in Modbus communication to specify where the data should be accessed or modified. A Modbus register is characterized by 1) Register type 2) Register Address 3) Size 4) Access and 5) byte order. There are four primary types of Modbus registers, each serving a different purpose: Table 1. Modbus register types
The technical manual, or pdf documentation, of a Modbus device usually
contains a list of all available registers, listed by type.
The type of Modbus registers used defines the read and write permissions
on the registers. The goal of the Nexalis Modbus connector is to mirror
asset data to the cloud, hence it only supports reading values, not
writing.
The registers may be grouped together in a single request using only
consecutive and not overlapping registers. This is configurable in the
Nexalis Modbus connector using the key “requestID”. A request contains
at most 125 registers for RTU or 123 registers for TCP. As Modbus
operates on register range, this limit means that the difference between
the last address + type size and the first register address must be
lower or equal to 122 for TCP and 124 for RTU.
The Modbus specification does not specify exactly how the data is stored
in the registers. The transmission order of bytes and words depends on
the manufacturer. The Nexalis Modbus connector uses the “bytesOrder”
attribute to specify the order in which the bytes are transmitted.
Table 2. Modbus Register Bytes Order