Modbus JSON profiles

Modbus JSON profile reference #

Global profile fields #

manufacturer #

Manufacturer name. string, required

Example: Embedded Systems

description #

Device description or model name. string, required

Example: Universal 16+4 I/O module

timeout #

Overrides default response timeout of 0.5 seconds for RTU or 3 seconds for TCP. number

product_code #

Product code which can be used for automatic profile mapping. string

Obtained from the device via read device identification object id 1 request.

read_swap #

Sets global byte/word swap order during conversion (endianness). boolean/string

Same as read_swap field from mapping.

read_delay #

Delay in seconds (max 1 second) between consecutive read requests from the slave. number

Should only be used if consecutives reads result in a timeout error.

Mapping fields #

name #

Datapoint name. string, required

Example: Output 2

bus_datatype #

Mapped object data type, key from dt table string/number, required

Example: uint8, scale or float32

type #

Modbus datapoint type. string, required

Possible values: coil discreteinput register inputregister

address #

Datapoint address (0-based). number, required

writable #

Set to true to enable writing to coil or register boolean

write_only #

Set to true to disable reading coil or register value when writable is enabled. boolean

write_multiple #

Set to true to force writing using multiple coil/register write function (code 16) even when writing to a single coil/register. boolean

datatype #

Modbus value data type. Read length is chosen based on data type, data conversion is done automatically. string

Possible values: uint16 int16 float16 uint32 int32 float32 uint64 int64 quad10k s10k

value_delta #

New value is sent when the difference between previously sent value and current value is larger than delta. Defaults to unset, send on any value changed. number

value_base #

Add a specified number to the resulting value. number

value_multiplier #

Multiply the resulting value by a specified number. number

Value calculation: value = value_base + value * value_multiplier

value_bitmask #

Bit mask to apply when reading and writing. number

Shifting is done automatically using the Count Trailing Zeros (CTZ) function.

Example: if value = 0xABCD and mask = 0x0F00 then CTZ(mask) = 8

The resulting value is (value & mask) >> 8 = 0x0B00 >> 8 = 0xB

write_bitmask #

Set to true to enable writing shifted value to the register using value_bitmask boolean

Only uint16 datatype is supported.

value_nan #

Array of 16-bit integers. array

If specified and read operation returns the same array then no further processing of value is done.

value_custom #

A list of key → value mapping. object

Example: { "0": "Off", "1": "Low", "2": "Medium", "3": "High" }

value_default #

Default value that is sent when coil/register cannot be read. boolean/number

internal #

Not visible to the user when set to true, should be used for scale registers. boolean

units #

Object units/suffix. string

address_scale #

Address of the register containing value scale factor. number

Value calculation: value = value * 10 ^ scale

read_count #

Number of registers to be read at once. number

Only for devices that only support reading of a specific block of registers; up to 125 registers can read at once.

read_swap #

Swap byte/word order during conversion (endianness). boolean/string

Default value is word (2-byte) swap.

Possible values:

  • n (no swap = 0xABCD)
  • w (word swap = 0xCDAB)
  • b (byte swap = 0xBADC)
  • bw (byte and word swap = 0xDCBA)

read_offset #

Position of the first coil/register in the data from the block of registers (0-based). number

bus_address #

Group address of mapped object. group address as a string

Recommended to use only during development.