> ## Documentation Index
> Fetch the complete documentation index at: https://docs.directenergypartners.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Modbus TCP/IP

### Required Parameters

To add a device using the Modbus TCP/IP communication protocol, the following parameters are required.

<ParamField path="id" type="string" required>
  A unique identifier for the device.

  **Example:** `converter1`
</ParamField>

<ParamField path="type" type="string" required>
  Indicates the type of device.

  **Options:** `converter`, `battery`, `other`
</ParamField>

<ParamField path="protocol" type="string" required>
  The communication protocol between the controller and the device. For this type of device, it will always be `Modbus TCP/IP`.

  **Example:** `Modbus TCP/IP`
</ParamField>

<ParamField path="ipAddress" type="string" required>
  The static IP address set for the device.

  **Example:** `192.168.1.20`
</ParamField>

<ParamField path="port" type="int" required>
  The port number used for communication. Please consult the device's manual to determine the port on which it communicates.

  **Example:** `502`
</ParamField>

<ParamField path="slaveId" type="int" required>
  The slave ID of the device. Please consult the device's manual to determine the specific slave ID.

  **Example:** `1`
</ParamField>

<ParamField path="controlMap" type="string" required>
  The name of the device’s control map on the controller.

  **Example:** `cet_30C3_control`
</ParamField>

<ParamField path="addressMap" type="string" required>
  The name of the device’s address map on the controller.

  **Example:** `cet_30C3_address_map`
</ParamField>

<ParamField path="disabled" type="bool" required>
  Indicates whether the device is enabled or disabled. A value of true means the device is disabled, while false means the device is enabled.
</ParamField>

### Optional Parameters

The parameters listed below are optional and are not required for a device with the Modbus TCP/IP protocol to work properly. However, sometimes it is desirable to add these optional parameters for device monitoring or because they are required by the manufacturer.

<ParamField path="critical" type="bool">
  Marks this device as critical or not. If a device is marked as critical (value true), any fault occurring on this device will send out an alert or notification over Telegram.
</ParamField>

<ParamField path="communicationInterval" type="float">
  Indicates the delay between consecutive Modbus operations, read or write. Between each Modbus command, the controller will wait this amount of time. The value is expressed in seconds.

  **Example:** `0.2`
</ParamField>

<ParamField path="forwardMap" type="string">
  Indicates the name of the device’s forward map on the controller.

  **Example:** `cet_30C3_forward_map`
</ParamField>

### Example

The snippet below demonstrates a device with id `converter1` and protocol `Modbus TCP/IP`, including all the required parameters along with the optional parameters.

```json icon="code" theme={null}
{
  "id": "converter1",
  "type": "converter",
  "protocol": "Modbus TCP/IP",
  "ipAddress": "192.168.1.20",
  "port": 502,
  "slaveId": 240,
  "controlMap": "cet_30C3_control",
  "addressMap": "cet_30C3_address_map",
  "forwardMap": "cet_30C3_forward_map",
  "disabled": false,
  "critical": true,
  "communicationInterval": 0.2
}
```

<Warning>
  When configuring a device with Modbus TCP/IP communication, ensure all required parameters are correctly specified to prevent configuration errors. Optional parameters can offer additional
  functionality and control but are not essential for basic operation. Always verify that the paths provided for addressMap and controlMap are accurate and that the files exist in the specified locations.
</Warning>
