A lightweight OCPP 1.6 Central System implementation built with .NET 8. It communicates with EV chargepoints over WebSockets and exposes a REST API for managing charging sessions, profiles, and configuration.
The solution consists of three projects:
| Project | Description |
|---|---|
| SimpleOcppServer | Main server — WebSocket listener, REST API, OCPP message handling |
| SimpleOcppServer.Messages | Shared OCPP 1.6 message models (requests & responses) |
| SimpleOcppClient | Simple test client that sends OCPP messages over WebSocket |
- WebSocket server on port
8080accepting chargepoint connections atws://host:8080/ocpp/{chargepointId} - OCPP 1.6 message handlers — Authorize, BootNotification, Heartbeat, MeterValues, StartTransaction, StopTransaction, StatusNotification, ChargingProfile, CompositeSchedule, Configuration
- REST API for external control and monitoring
- MQTT integration for publishing events
- MongoDB for persisting transactions and status
- MediatR for in-process messaging between components
| Method | Route | Description |
|---|---|---|
GET |
/status |
Get the latest chargepoint status |
GET |
/transactions |
Get the latest transactions |
GET |
/configuration/{chargePointId} |
Get chargepoint configuration |
GET |
/compositeSchedule/{chargePointId} |
Get composite schedule |
POST |
/chargingProfile/{chargePointId} |
Set max amperage |
POST |
/chargingProfile/{chargePointId}/clear |
Clear charging profiles |
- .NET 8 SDK
- MongoDB instance
- MQTT broker (optional)
Settings are in SimpleOcppServer/appsettings.json and can be overridden with environment variables:
{
"MqttSettings": {
"MqttIp": "192.168.1.5"
},
"AuthSettings": {
"AllowedIdTags": "F6C0D248"
}
}| Setting | Description |
|---|---|
MqttSettings:MqttIp |
IP address of the MQTT broker |
AuthSettings:AllowedIdTags |
Comma-separated list of authorized RFID tags |
cd SimpleOcppServer
dotnet runThe WebSocket server will start listening on http://+:8080/ocpp/.
Build and run with Docker:
docker build -t simpleocppserver .
docker run -p 8080:8080 simpleocppserverOr use Docker Buildx Bake:
docker buildx bakeA simple WebSocket test client is included:
cd SimpleOcppClient
dotnet runIt connects to ws://localhost:8080/ocpp/WS-1337 and sends sample OCPP messages.