# Device settings

Some technology-specific fields are essential for the agent when setting up a Modbus TCP device (a.k.a., thing) in the IoTHub.

# Thing

A thing is a digital representation of a physical device (commonly termed "digital-twin").

# Configuration

The configuration defines connection-related settings for communicating with the device. Here, essential technology-specific fields to set are:

  • endpoint: The endpoint defines the devices address and listening port number. This information is used by the agent for establishing a connection with the device.
  • endianness: This field defines the byte order of the device.
  • slaveId: This field defines target slave identifier of the device.

# Attributes

The attributes define settings that do not directly affect the connection between agent-device but are still relevant for communication. Here, essential technology-specific fields are:

  • sampling_interval: The sampling interval defines a "best-effort" cyclic rate that the agent uses to sample data from the device. "Best-effort" in this context means that the agent does its best to sample data at the given time frame.

# Properties

Properties represent all items that the agent should monitor; this means reading or writing data from or into them, respectively.

# Predefined

For Modbus TCP devices, there are some predefined technology-specific properties:

  • last_poll: This property informs about the results of the latest polling attempt. For instance, the actual sampling rate in which the retrieving of the values was executed.

# Attributes

Each property contains the following technology-specific fields:

  • area: This field specifies the area type of the register to be monitored. Here, valid Modbus TCP areas are:
Area Quantity I/O Commonly used for
Coils 1 bit Read & Write Digital output signals
Discrete Input 1 bit Read only Digital input signals
Holding Registers 16 bit Read & Write Analog output signals
Input Registers 16 bit Read only Analog input signals
  • address: This field specifies the starting address of the area to monitor. In this case, the following offsets will be applied (added) to the given value:
Offset Area
0 Coils
10000 Discrete Input
30000 Input Registers
40000 Holding Registers
  • quantity: This field specifies the bit quantity to monitor. As mentioned in the area description, the default quantity for Coils and Discrete Input is 1 bit, and for Input Registers and Holding Registers is 16 bit. Find below some examples of valid quantities regarding different areas:
Quantity Area Total (bits) Encoding type
1 Coils 1 bit Bool
2 Discrete Input 2 bits int8
2 Input Registers 32 bits int32, float32
4 Holding Registers 64 bits int64, float64

WARNING

The implementation and accessibility of the Modbus registers may vary. Please check the user manual of your device for more details about their specific implementation.

# Actions

Actions are interaction affordances that allow to invoke specific functions on the device or retrieve information from it. Here, essential technology-specific actions are:

  • connect: Use this action for connecting and subscribing to the Modbus TCP device.
  • disconnect: Use this action for disconnecting and unsubscribing from the Modbus TCP device.
Last Updated: 1/14/2022, 2:13:49 PM