ocpp-client 0.2.0

OCPP Client Implementation. Use this library to implement an OCPP charge point
Documentation
# ๐Ÿ”Œ OCPP Client

> **A lightweight, embedded-friendly Rust OCPP communication framework for building real charge points and CSMS integrations.**

[![Rust](https://img.shields.io/badge/rust-stable-orange.svg)](https://www.rust-lang.org/)
[![License](https://img.shields.io/badge/license-MIT%20%2F%20Apache--2.0-blue.svg)](#license)
[![Crates.io](https://img.shields.io/crates/v/ocpp-client)](https://crates.io/crates/ocpp-client)
[![Documentation](https://docs.rs/ocpp-client/badge.svg)](https://docs.rs/ocpp-client)
[![.github/workflows/ci.yaml](https://github.com/flowionab/ocpp-client/actions/workflows/ci.yaml/badge.svg)](https://github.com/flowionab/ocpp-client/actions/workflows/ci.yaml)
[![no_std](https://img.shields.io/badge/no__std-compatible-brightgreen.svg)](#features)

---

## ๐Ÿš€ Overview

**OCPP Client** is the communication layer of the **Flowion Rust OCPP ecosystem**, providing the networking and transport foundation required to build OCPP-enabled charge points and backend integrations.

The library handles the complexities of establishing and managing OCPP connections, including:

* Connection lifecycle management
* Transport handling
* Message routing
* Communication reliability

OCPP message types and protocol definitions are provided by [`ocpp-types`](https://github.com/flowionab/ocpp-types), while OCPP Client focuses on the communication layer required to exchange messages between charge points and Charge Station Management Systems (CSMS).

Designed for both cloud/server environments and resource-constrained embedded systems, OCPP Client supports standard WebSocket connections as well as `no_std` compatible transports for STM32-based platforms.

The library currently supports **OCPP 1.6J**, **OCPP 2.0.1**, and **OCPP 2.1**.

---

## โœจ Features

* ๐Ÿฆ€ Native Rust implementation
* ๐Ÿ”Œ OCPP communication layer
* โšก OCPP **1.6J support**
* ๐Ÿš€ OCPP **2.0.1 support**
* โšก OCPP **2.1 support**
* ๐ŸŒ WebSocket transport
* ๐Ÿ”’ Secure WebSocket (WSS)
* ๐Ÿ”‹ STM32-compatible transport layer
* ๐Ÿ”„ Connection lifecycle management
* ๐Ÿ“จ Message routing
* ๐Ÿงฉ Transport abstraction
* ๐Ÿชถ Lightweight runtime
* ๐Ÿ’พ `no_std` support for embedded environments
* ๐Ÿ–ฅ๏ธ `std` support enabled by default for desktop and server applications

---

## ๐Ÿ”Œ Supported Protocols

| Protocol   | Status         |
| ---------- | -------------- |
| OCPP 1.6J  | โœ… Supported    |
| OCPP 2.0.1 | โœ… Supported    |
| OCPP 2.1   | โœ… Supported    |

---

## ๐ŸŒ Supported Transports

| Transport              | Status      |
| ---------------------- | ----------- |
| WebSocket              | โœ… Supported |
| Secure WebSocket (WSS) | โœ… Supported |
| STM32 transport        | โœ… Supported |

---

## โš™๏ธ Feature Flags

OCPP Client supports both standard Rust environments and embedded systems.

By default, the `std` feature is enabled:

```toml
[dependencies]
ocpp-client = "0.x"
```

For embedded targets or `no_std` environments:

```toml
[dependencies]
ocpp-client = { version = "0.x", default-features = false }
```

This allows the same OCPP communication foundation to run on resource-constrained devices such as STM32 microcontrollers while still supporting traditional server-side applications.

---

## ๐Ÿ—๏ธ Architecture

OCPP Client separates protocol definitions from communication.

```text
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚          Your Application                  โ”‚
โ”‚          Charge Point / CSMS Logic         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
                       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              ocpp-charge-point             โ”‚
โ”‚                                            โ”‚
โ”‚  Complete charge point firmware framework  โ”‚
โ”‚  Add hardware bindings and deploy          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
                       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              ocpp-client                   โ”‚
โ”‚                                            โ”‚
โ”‚  OCPP communication runtime                โ”‚
โ”‚  Transport abstraction                     โ”‚
โ”‚  WebSocket / embedded transports           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
                       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚               ocpp-types                   โ”‚
โ”‚                                            โ”‚
โ”‚  OCPP message types                        โ”‚
โ”‚  Protocol models                            โ”‚
โ”‚  Serialization                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

---

## ๐ŸŒ Flowion OCPP Ecosystem

OCPP Client is designed as a modular building block within the **Flowion Rust OCPP ecosystem**.

Each project has a focused responsibility, allowing developers to choose the right level of abstraction for their application.

---

### ๐Ÿ“ฆ ocpp-types

**OCPP protocol definitions and data models**

[`ocpp-types`](https://github.com/flowionab/ocpp-types) provides the foundation for working with OCPP messages in Rust.

It contains:

* OCPP message types
* Protocol models
* Serialization and deserialization
* Version-specific protocol definitions

OCPP Client builds on top of `ocpp-types` to provide communication capabilities.

---

### ๐Ÿ”Œ ocpp-client

**OCPP communication and transport layer**

This repository provides the runtime required to connect OCPP-enabled systems.

It handles:

* Connection management
* Transport abstraction
* Message routing
* WebSocket communication
* Embedded-compatible transports
* `no_std` environments

It is designed to run in both:

* ๐Ÿ–ฅ๏ธ Server environments
* ๐Ÿ”‹ Embedded charge point environments

---

### โšก ocpp-charge-point

**Complete charge point firmware framework**

[`ocpp-charge-point`](https://github.com/flowionab/ocpp-charge-point) provides a complete framework for building OCPP-enabled charge point firmware.

The goal is to make developing custom charging hardware as simple as implementing the required hardware bindings.

Developers provide hardware-specific implementations such as:

* GPIO control
* Contactor control
* Metering interfaces
* Connector handling
* LEDs and user interfaces
* Hardware drivers

while the framework handles:

* Charge point state management
* OCPP communication
* Charging workflows
* Backend communication
* Protocol integration

This allows manufacturers and developers to build custom OCPP-compatible chargers without implementing the complete protocol stack from scratch.

---

## ๐ŸŽฏ Use Cases

OCPP Client can be used for:

* ๐Ÿš— Building EV charge point firmware
* ๐Ÿญ Developing OCPP-enabled hardware
* ๐Ÿ–ฅ๏ธ Building CSMS integrations
* ๐Ÿงช Testing OCPP implementations
* ๐Ÿ”‹ Connecting embedded devices to charging platforms
* โšก Creating custom charging solutions
* ๐Ÿค– Automated integration testing

---

## ๐Ÿ“ฆ Installation

Add the dependency to your `Cargo.toml`:

```toml
[dependencies]
ocpp-client = "0.x"
```

---

## ๐Ÿš€ Quick Example

```rust
use ocpp_client::Client;

#[tokio::main]
async fn main() {
    let client = Client::new();

    client
        .connect("wss://example.com/ocpp")
        .await
        .unwrap();
}
```

---

## ๐Ÿงช Testing

OCPP Client is designed for:

* Integration testing
* Charge point development
* Embedded testing
* CSMS validation
* Automated test environments

It can be combined with simulators and real charging hardware to validate complete OCPP workflows.

---

## ๐Ÿ›ฃ๏ธ Roadmap

Planned improvements:

* ๐Ÿ”Œ Additional embedded transports
* ๐Ÿ“š More examples
* ๐Ÿงช Expanded integration tests
* ๐Ÿ”ง Improved developer tooling

---

## ๐Ÿค Contributing

Contributions are welcome!

You can help by:

* ๐Ÿ› Reporting issues
* ๐Ÿ’ก Suggesting improvements
* ๐Ÿ“ Improving documentation
* ๐Ÿ”ง Submitting pull requests

---

## ๐Ÿ“„ License

OCPP Client is dual licensed:

* MIT License
* Apache License 2.0

You may choose either license.

---

## ๐Ÿข About Flowion

**OCPP Client** is developed by **Flowion AB** as part of our effort to make EV charging development more accessible through modern, open-source tooling.

Flowion builds software solutions for electric vehicle charging using open standards such as **OCPP**, helping developers and businesses build reliable and scalable charging infrastructure.

---

## โญ Support the Project

If you find this library useful:

* โญ Star the repository
* ๐Ÿ› Report issues
* ๐Ÿ’ก Suggest improvements
* ๐Ÿค Contribute

Together we can make EV charging development easier and more accessible.