## --- "request" configuration style --- ## Per request definition ## ## Define a request sent to the device ## Multiple of those requests can be defined. Data will be collated into metrics at the end of data collection. [[inputs.modbus.request]] ## ID of the modbus slave device to query. ## If you need to query multiple slave-devices, create several "request" definitions. slave_id = 1 ## Byte order of the data. ## |---ABCD -- Big Endian (Motorola) ## |---DCBA -- Little Endian (Intel) ## |---BADC -- Big Endian with byte swap ## |---CDAB -- Little Endian with byte swap byte_order = "ABCD" ## Type of the register for the request ## Can be "coil", "discrete", "holding" or "input" register = "coil" ## Name of the measurement. ## Can be overriden by the individual field definitions. Defaults to "modbus" # measurement = "modbus" ## Field definitions ## Analog Variables, Input Registers and Holding Registers ## address - address of the register to query. For coil and discrete inputs this is the bit address. ## name *1 - field name ## type *1,2 - type of the modbus field, can be INT16, UINT16, INT32, UINT32, INT64, UINT64 and ## FLOAT32, FLOAT64 (IEEE 754 binary representation) ## scale *1,2 - (optional) factor to scale the variable with ## output *1,2 - (optional) type of resulting field, can be INT64, UINT64 or FLOAT64. Defaults to FLOAT64 if ## "scale" is provided and to the input "type" class otherwise (i.e. INT* -> INT64, etc). ## measurement *1 - (optional) measurement name, defaults to the setting of the request ## omit - (optional) omit this field. Useful to leave out single values when querying many registers ## with a single request. Defaults to "false". ## ## *1: Those fields are ignored if field is omitted ("omit"=true) ## ## *2: Thise fields are ignored for both "coil" and "discrete"-input type of registers. For those register types ## the fields are output as zero or one in UINT64 format by default. ## Coil / discrete input example fields = [ { address=0, name="motor1_run"}, { address=1, name="jog", measurement="motor"}, { address=2, name="motor1_stop", omit=true}, { address=3, name="motor1_overheating"}, ] [inputs.modbus.request.tags] machine = "impresser" location = "main building" [[inputs.modbus.request]] ## Holding example ## All of those examples will result in FLOAT64 field outputs slave_id = 1 byte_order = "DCBA" register = "holding" fields = [ { address=0, name="voltage", type="INT16", scale=0.1 }, { address=1, name="current", type="INT32", scale=0.001 }, { address=3, name="power", type="UINT32", omit=true }, { address=5, name="energy", type="FLOAT32", scale=0.001, measurement="W" }, { address=7, name="frequency", type="UINT32", scale=0.1 }, { address=8, name="power_factor", type="INT64", scale=0.01 }, ] [inputs.modbus.request.tags] machine = "impresser" location = "main building" [[inputs.modbus.request]] ## Input example with type conversions slave_id = 1 byte_order = "ABCD" register = "input" fields = [ { address=0, name="rpm", type="INT16" }, # will result in INT64 field { address=1, name="temperature", type="INT16", scale=0.1 }, # will result in FLOAT64 field { address=2, name="force", type="INT32", output="FLOAT64" }, # will result in FLOAT64 field { address=4, name="hours", type="UINT32" }, # will result in UIN64 field ] [inputs.modbus.request.tags] machine = "impresser" location = "main building"