> ## 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.

# CANbus

### Required Parameters

To add a device using the CANbus communication protocol, the following parameters are required.

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

  **Example:** `battery1`
</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 `CANbus`.

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

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

  **Example:** `canbus_device_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 CANbus protocol to work properly. However, sometimes it is desirable to add these optional parameters for specific device requirements.

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

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

<ParamField path="frameFormat" type="string">
  Specifies the CAN frame format to use for communication. Defaults to `29-bit` if not specified.

  **Options:** `11-bit | 29-bit`
</ParamField>

<ParamField path="module" type="number">
  Physical CAN module number. Defaults to `1` if not specified. If you only have one physical CAN module, this parameter is not needed. If you have more than one, each CAN device needs this parameter set, otherwise it will default to CAN module `1`.

  **Options:** `1 | 2`
</ParamField>

### Example

The snippet below demonstrates a device with id `battery1` and protocol `CANbus`, including all the required parameters along with the optional parameters.

```json icon="code" theme={null}
{
  "id": "battery1",
  "type": "battery",
  "protocol": "CANbus",
  "addressMap": "canbus_device_address_map",
  "controlMap": "canbus_device_control",
  "disabled": false,
  "frameFormat": "11-bit",
  "module": 1
}
```

<Warning>
  When configuring a device with CANbus communication, ensure all required parameters are correctly specified to prevent configuration errors.
  Always verify that the paths provided for addressMap and controlMap are accurate and that the files exist in the specified locations.
</Warning>
