dmmb - reads observations from Modbus RTU/TCP device
dmmb --help
dmmb --version
dmmb --config file [--name name] [--node id] [--sensor id] [--logger name] [--format name] [--output file] [--mqueue] [--debug] [--verbose]
The dmmb program reads values from or writes values to Modbus RTU/TCP registers by sequentially processing the job list loaded from a configuration file. Each request of an observation must contain the Modbus register parameters in the request string. The value of the first response is set to the result of the read operation. Up to 8 requests to read and/or write values are permitted. Integers read from a register may be scaled using an optional scale denominator.
The following fields are supported in the command string:
- access [read|write]
-
Read or write value of given type.
- address n
-
Register address.
- code hex
-
Optional Modbus function code in hexadecimal format. Set to
0x01to read coil status and to0x05to write coil status. - order [abcd|badc|cdab|dcba]
-
Byte order of type
float. - scale n
-
Optional integer scale denominator.
- slave id
-
Slave id.
- type [int16|int32|uint16|uint32|float]
-
Data type to read or write.
- value n
-
Integer value to write.
For example, to read a 2-byte unsigned integer from holding register 40050 of
slave device 1 with a scale factor of 1/10, the attribute request of a request
must be set to:
access=read, slave=1, address=40050, type=uint16, scale=10
Or, to read a 4-byte floating-point value in ABCD byte order from register 40060:
access=read, slave=1, address=40060, type=float, order=abcd
Only integer values may be written to an input register, for instance:
access=write, slave=1, address=30010, type=uint16, value=1
The value is converted to uint16 automatically. The command string can be in
lower or upper case. White spaces will be ignored.
Observations will be forwarded to the next receiver via POSIX message queue if
any receiver is specified. The program can act as a sole data logger if output
and format are set. If the output path is set to -, observations are printed
to stdout, else to file.
A configuration file is required to configure the jobs to perform. Each observation must have a valid target id. The database must contain the specified node, sensor, and targets.
- --config, -c file
-
File path to the configuration file.
- --debug, -D
-
Forward logs messages of level
LL_DEBUGvia IPC (if logger is set). - --format, -f [csv|jsonl]
-
Output format of observations if
--outputis set. Either CSV or JSON Lines. - --help, -h
-
Print available command-line arguments and quit.
- --logger, -l name
-
Name of logger. If set, sends logs to dmlogger(1) process of given name.
- --name, -n name
-
Name of program instance, configuration, and message queue (default is
dmmb). - --mqueue, -Q
-
Create message queue to receive observations.
- --node, -N id
-
Node id.
- --output, -o file
-
Output file to append observations to (
-for stdout). - --sensor, -S id
-
Sensor id.
- --verbose, -V
-
Print log messages to stderr.
- --version, -v
-
Print version information and quit.
Read the jobs to perform from configuration file and execute them sequentially:
$ dmmb -n dmmb -c /usr/local/etc/dmpack/dmmb.conf -V