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

# OCPP bridge

> Connect a charge point to a Charge Point Management System over OCPP — the feature, the module, and the ocpp_bridge config section.

The **OCPP bridge** lets an Omega device act as an OCPP charge point: it opens an OCPP-J WebSocket to a Charge Point Management System (CPMS) and speaks the protocol — `BootNotification`, `Heartbeat`, `StartTransaction` / `StopTransaction`, `MeterValues`, `ChangeConfiguration`, and the rest — bridging that session to handlers on the device. It is **native to Omega** (not a deprecated module), but it is **opt-in**: you compile it in only for devices that need it.

## 1. Build with the feature

```bash theme={null}
cargo build --release -p omega-agent --no-default-features --features ocpp
```

`ocpp` pulls a tokio runtime and a ZeroMQ transport (the bridge talks to its session handler over ZeroMQ). See [Build Omega](/edge/install) for the feature model.

## 2. Enable the module

Add the module to the [profile](/edge/configure) and grant its capability. The module id is `ocpp-bridge`:

```yaml theme={null}
modules:
  required:
    - ocpp-bridge

security:
  capabilities:
    ocpp-bridge: true
```

## 3. Configure the bridge

The bridge reads an `ocpp_bridge:` section (note the underscore). The minimum is where to connect and how to identify the charge point:

```yaml theme={null}
ocpp_bridge:
  enabled: true
  cpms_url: wss://cpms.example.com/ocpp/CP-0001   # the CPMS WebSocket endpoint
  charge_point_id: CP-0001                        # sent as the WebSocket sub-protocol client id
  charge_point_vendor: Acme
  charge_point_model: DC-Fast-01
  firmware_version: 1.4.2
  heartbeat_interval_secs: 30
```

## Config reference — `ocpp_bridge`

| Field                                     | Type    | Default      | Meaning                                                                                                      |
| ----------------------------------------- | ------- | ------------ | ------------------------------------------------------------------------------------------------------------ |
| `enabled`                                 | bool    | `false`      | Turn the bridge on.                                                                                          |
| `cpms_url`                                | string  | —            | Full WebSocket URL of the CPMS, e.g. `wss://host/ocpp/CP-0001`. Use `wss://` in production.                  |
| `charge_point_id`                         | string  | `CP-0001`    | Charge-point identity, sent as the WebSocket sub-protocol client id.                                         |
| `charge_point_vendor`                     | string  | `Golain`     | Vendor reported in `BootNotification`.                                                                       |
| `charge_point_model`                      | string  | `Simulator`  | Model reported in `BootNotification`.                                                                        |
| `firmware_version`                        | string? | `0.1.0`      | Firmware version reported in `BootNotification`.                                                             |
| `heartbeat_interval_secs`                 | u32     | `10`         | Initial heartbeat interval; the CPMS can override it via `BootNotificationResponse` / `ChangeConfiguration`. |
| `transaction_message_attempts`            | u32     | *(built-in)* | Retries for transaction messages (`StartTransaction`, `StopTransaction`, `MeterValues`) before giving up.    |
| `transaction_message_retry_interval_secs` | u32     | *(built-in)* | Delay between those retries.                                                                                 |
| `web_socket_ping_interval_secs`           | u32     | `0`          | WebSocket Ping frame interval. `0` disables it.                                                              |
| `startup_sync_timeout_ms`                 | u64     | *(built-in)* | Max wait for startup synchronization before opening the barrier with a warning.                              |
| `tls`                                     | object? | none         | Custom TLS for `wss://` (below).                                                                             |

### TLS — `ocpp_bridge.tls`

For a CPMS that needs a custom CA or mutual TLS:

```yaml theme={null}
ocpp_bridge:
  tls:
    ca_cert_path: /etc/omega/cpms-ca.crt
    client_cert_path: /etc/omega/cp-client.crt
    client_key_path: /etc/omega/cp-client.key
```

| Field                                  | Meaning                                                  |
| -------------------------------------- | -------------------------------------------------------- |
| `ca_cert_path`                         | CA to trust for the CPMS server certificate.             |
| `client_cert_path` / `client_key_path` | Client certificate + key, for a CPMS that requires mTLS. |

Omit `tls` to use the system trust store with no client certificate.

### Internal transport (advanced)

The bridge communicates with its session handler over ZeroMQ. These default to loopback endpoints and rarely need changing:

| Field                   | Meaning                                                                    |
| ----------------------- | -------------------------------------------------------------------------- |
| `zmq_pub_endpoint`      | Where the session handler subscribes for bridge → handler messages.        |
| `zmq_sub_endpoint`      | Where the session handler pushes requests toward the bridge.               |
| `zmq_ctrl_rep_endpoint` | Control-plane endpoint the bridge exposes for readiness / synchronization. |

## Notes

* This is a **WebSocket-to-CPMS** path, separate from Omega's MQTT connection to the Golain platform — a device can run both: managed by Golain over MQTT, and speaking OCPP to a CPMS over its own WebSocket.
* `charge_point_id` must match what the CPMS expects for this device; it's part of the WebSocket URL and the sub-protocol handshake.

## See also

* [Build Omega](/edge/install) — the `ocpp` feature in the build model.
* [Configure Omega](/edge/configure) — the profile the `ocpp_bridge` section lives in.
