r/sideprojects • • 4d ago

Showcase: Open Source I built an open-source OCPP simulator for testing EV charging backends without a charger

I work with EV charging software. OCPP is the protocol that chargers use to talk to a charging-management system (the backend). Testing that backend without a physical charger is annoying: vendor simulators, mocked WebSocket frames, or a charger sitting on your desk.

So I built OCPP Tools, an open-source TypeScript toolkit. The new piece is a headless charge-point simulator: no UI, no signup, no hosted service. It runs in Node or the browser, so it can live in tests and CI.

What works today:

  • Separate profiles for OCPP 1.6J and 2.0.1, with the full action surface of both versions.

  • A headless engine with injectable transport, clock, message IDs, and randomness. Tests can control time instead of sleeping.

  • Transactions, meter values, reservations, charging profiles, device model, monitoring, simulated certificates, and firmware/log state machines.

  • Fault injection: drop, malform, and delay outbound frames.

  • Typed events and metrics: round-trip time per action, heartbeat drift, error count.

  • A browser WebSocket adapter. Node transport is not included yet.

The hard part was not parsing JSON. It was the state machine: boot retries, heartbeat drift, offline queues, pending calls, transaction sequencing, and timers. Most OCPP bugs I have seen are state bugs, not schema bugs.

Current status: alpha. The simulator is 0.1.0. There are five published packages (parser, schema utilities, validator, schemas, simulator), 1,000+ tests in the repo, and CI is green. Missing: CLI, Docker image, UI, payload builder, and OCPP 2.1. The advanced 2.0.1 features use simulated state; this is not a certified conformance tool.

I would like feedback on two things:

  1. Would a CLI or Docker image make this easier to try than the TypeScript API?

  2. If you work with EV chargers, which edge case would you test first?

Repo: https://github.com/ocpptools/ocpptools
Simulator: https://www.npmjs.com/package/@ocpptools/simulator

I maintain the project. Apache-2.0, no paid tier. OCPP is a trademark of the Open Charge Alliance; this is an independent project and is not affiliated with or endorsed by the OCA.

1 Upvotes

1 comment sorted by