Skip to content

Tutorials

Comprehensive tutorials for using OCPI Python in different scenarios.

Getting Started

Module Tutorials

Core Modules

  • Managing Locations - Complete guide to location management
  • Creating locations with EVSEs and connectors
  • CRUD operations
  • Advanced features (operating hours, energy mix, images)

  • Handling Sessions - Session lifecycle management

  • Starting and stopping sessions
  • Tracking energy consumption
  • Session status management
  • Charging preferences

  • Token Authorization - Token validation and authorization

  • Token types (RFID, mobile app, etc.)
  • Authorization flow
  • Whitelist management

  • CDR Generation - Creating Charge Detail Records

  • CDR structure
  • Cost calculation
  • Tariff integration
  • Charging periods

Advanced Modules

  • Commands - Sending commands to charge points
  • START_SESSION, STOP_SESSION
  • RESERVE_NOW, UNLOCK_CONNECTOR
  • Command handling and responses

  • Charging Profiles - Smart charging control

  • Setting charging profiles
  • Getting active profiles
  • Clearing profiles
  • Load balancing

  • Booking Reservations - EV charging reservations (OCPI 2.3.0)

  • Time slot reservations
  • Booking lifecycle management
  • Integration with sessions

Complete Working Examples

Ready-to-run examples with full source code:

  • Basic CPO - Simple location management for CPO
  • Complete CRUD implementation
  • In-memory storage (easily replaceable with a database)

  • EMSP Sessions - Session and token management

  • Session lifecycle management
  • Token authorization flow

  • Full CPO - Complete multi-module CPO application

  • Multiple modules (Locations, Sessions, CDRs, Tariffs, Commands)
  • Production-ready structure

  • Charging Profiles - Smart charging control

  • Charging profile management
  • Load balancing examples

  • Bookings - EV charging reservations (OCPI 2.3.0)

  • Booking lifecycle management
  • Time slot reservations

Additional Resources

Next Steps

After completing these tutorials:

  1. Explore the API Reference for complete endpoint documentation
  2. Check out Complete Examples for production-ready code
  3. Review the Installation Guide for deployment options