Quickstart

OCPP Quickstart: Connect a Virtual Charger

Connect a virtual OCPP 1.6J charger to a test CSMS and inspect registration and meter values.

Before you begin

Install SPX with OCPP and SPX UI. Have a test CSMS that accepts OCPP 1.6J WebSocket connections. This quickstart uses the ready-made EVSE model.

Run the test

1. Start the charger

  • In Instances → New instance, select Energy.EVSE.Ocpp. If needed, import the linked YAML through Models → Load model from file.
  • Configure the exact CSMS WebSocket URL, charge-point ID and ocpp1.6 subprotocol, then start the instance. Use a CSMS address reachable from SPX; localhost inside Docker refers to that container.
SPX UI showing the charger OCPP connection settings and charging telemetry chart.
Configure the charger to connect to a reachable CSMS.

Screenshot preview

Configure the charger to connect to a reachable CSMS. Open original image

2. Verify registration

  • Watch the CSMS receive BootNotification and send an Accepted response with the same message ID. Check the boot status in SPX.
  • The test CSMS also needs to answer subsequent Heartbeat, StatusNotification and MeterValues calls.

3. Observe the charging simulation

  • In SPX Scenarios, run session_charging.
  • Check your CSMS logs for Charging status and MeterValues, and compare the values with the SPX chart. After the scenario, verify the return to Available.
SPX UI showing a charger scenario and the current and energy history.
A recorded charging scenario shows current and accumulated energy.

Screenshot preview

A recorded charging scenario shows current and accumulated energy. Open original image

Check the result

The example verifies registration, status and meter telemetry with a test CSMS. A sample transaction ID alone does not establish a complete OCPP transaction; remote start and stop are outside this quickstart.

Protocol communication

Use these settings and messages with the library’s OCPP EVSE charge point model.

SPX role
Charge Point / WebSocket client; your CSMS accepts the connection
CSMS endpoint
ws://CSMS_HOST:9000/ocpp in this exercise; use the exact path required by your CSMS
Handshake
WebSocket subprotocol ocpp1.6; default charge-point identity spx-evse-01

Replace host placeholders with reachable addresses and use your published ports.

Swipe the table to see requests and replies.

Addresses, requests and expected replies
Address / messageOperation / payloadExpected reply
BootNotificationSPX → CSMS: chargePointVendor="Hammerheads EV", chargePointModel="SPX-EVSE"CSMS → SPX: status="Accepted", currentTime=UTC timestamp, interval=30 in this test
HeartbeatSPX → CSMS: {}; model interval 30 secondsCSMS → SPX: {"currentTime":"<UTC timestamp>"}
StatusNotificationSPX → CSMS: connectorId=1, status="Available", errorCode="NoError" at idleCSMS → SPX: {} acknowledgement
MeterValuesSPX → CSMS: connectorId=1; meterValue array with Wh, W, A and V samplesCSMS → SPX: {} acknowledgement; inspect telemetry at your CSMS

Values describe this model’s nominal setup unless noted. Live measurements change as the simulation runs.

Example request and reply

Verify boot_status=Accepted and heartbeat updates in SPX. Run session_charging in SPX, then confirm Charging status and changing MeterValues at the CSMS. Status/meter bindings repeat every 6/5 seconds.

SPX → CSMS (example message ID boot-1):
[2,"boot-1","BootNotification",{"chargePointVendor":"Hammerheads EV","chargePointModel":"SPX-EVSE"}]
CSMS → SPX (same ID; example UTC time):
[3,"boot-1",{"status":"Accepted","currentTime":"2026-11-08T12:00:00Z","interval":30}]

SPX → CSMS: [2,"hb-1","Heartbeat",{}]
CSMS → SPX: [3,"hb-1",{"currentTime":"2026-11-08T12:00:30Z"}]
No reply or an unexpected value?
  • Use your CSMS’s exact URL. The bundled SPX CSMS listens at /ocpp exactly; do not append /spx-evse-01 to that URL. Other CSMS products may require an identity in the path.
  • CSMS_HOST must be reachable from SPX. localhost in Docker refers to the SPX container, not your desktop. Include ocpp1.6 in the handshake.
  • The example reply is a CSMS response you must provide. This EVSE model has no RemoteStartTransaction/RemoteStopTransaction bindings; session_charging drives the demo locally. Example message IDs/timestamps below are illustrative; replies use the actual request ID and current UTC time.

Ask your AI agent

Open your SPX workspace in a local AI agent. We tested this prompt with GPT-6 Luna · Medium using a dedicated temporary CSMS:

Prompt for your AI agent

Using the ready-made SPX OCPP 1.6J charge-point model, run a real local WebSocket quickstart against a separate temporary test CSMS server (not an SPX instance). Create only one temporary SPX instance for the charge point. Keep both endpoints on a private network with no host port mappings, and preserve all pre-existing instances. Start the test CSMS, then the charge point. Verify the actual OCPP exchange: BootNotification sent and Accepted response received; check whether any Charging/transaction messages occur; confirm telemetry only after the CSMS receives and acknowledges MeterValues. Record the exact observed message sequence and values. Do not claim a complete transaction unless its protocol messages and resulting state are verified. Remove only resources created for this test and release the SPX license slot afterward.

Tested with GPT-6 Luna · Medium

Estimated API cost · $0.0085 per run

In our test, the CSMS accepted the boot request and acknowledged Charging and meter samples including 24 A, 400 V and 9,600 W; energy rose from 1,211.9 Wh to 1,265.2 Wh across later samples. No StartTransaction or StopTransaction exchange was observed, so this is not a complete transaction test.

Next steps

Create a custom virtual charger with an AI agent. See the OCPP adapter guide for connection and binding details.