Skip to content

dumanburak/ocpp-client-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OCPP 1.6J Demo Charge Point (Python)

This project demonstrates a simple OCPP 1.6J (Open Charge Point Protocol) client implemented in Python. It simulates a charging station (Charge Point) communicating with a CSMS (Central System) using WebSocket connections.

Features

  • Fully asynchronous architecture using asyncio and websockets

  • Implements OCPP 1.6J (JSON over WebSocket)

  • Uses @on and @after decorators for event-based message handling

  • Simulates realistic transaction workflow:

    • BootNotification
    • StatusNotification (Preparing → Charging → Finishing → Available)
    • StartTransaction / StopTransaction
    • Periodic MeterValues
    • Supports DataTransfer, FirmwareUpdate, ReserveNow, and more

Requirements

Python 3.10 or later is recommended.

pip install asyncio websockets ocpp nest_asyncio

Usage

  1. Start an OCPP 1.6J CSMS server (e.g., mobilityhouse/ocpp).
  2. Run the client:
python ocpp_client.py

Default WebSocket URL:

ws_url = "ws://localhost:8000/OCPP/1/CP2"

You can change the URL inside the main() function.

Example Flow

When the CSMS sends a RemoteStartTransaction request, the client performs:

  1. CP → StatusNotification (Preparing)
  2. CP → StartTransaction
  3. CP → DataTransfer
  4. CP → MeterValues (SoC, Voltage, Current, Energy)
  5. CP → StopTransaction
  6. CP → StatusNotification (Available)

Notes

  • Designed for testing and demo purposes.
  • Can be easily extended with additional OCPP actions or integrated with real hardware.
  • Tested against both Python and .NET CSMS implementations.

License

MIT License — free to use, modify, and distribute.


Author

Burak Duman Embedded & Backend Developer | OCPP · IoT · Python GitHub · LinkedIn- Added note about WebSocket URL configuration.

About

A simple asynchronous OCPP 1.6J Charge Point client implemented in Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages