Table of Contents

Transactions

A transaction is a single charging session, from the moment the preconditions for charging are met until they are no longer met. This is the OCPP 2.0.1 Transactions functional block and the OCPP 1.6 Core profile.

The transaction model differs between versions

This is the area where OCPP 2.0.1 and 1.6 differ most, so it is worth understanding before you integrate.

  • OCPP 2.0.1 uses a single messageTransactionEvent — for the whole lifecycle, with an eventType of Started, Updated, or Ended. Meter values are carried inside these events. The transaction is identified by a string transactionId.
  • OCPP 1.6 uses separate messagesStartTransaction, MeterValues, and StopTransaction. The transaction is identified by an integer transactionId.

When your CSMS speaks 1.6, Enua translates the native 2.0.1 TransactionEvent stream into the equivalent 1.6 messages, and maps the 2.0.1 string transactionId to a 1.6 integer. See Deviations from the Standard for the caveats of this mapping.

sequenceDiagram
    actor User
    participant CS as Enua Charging Station
    participant CSMS as Your CSMS
    User->>CS: Plug in & authorize
    Note over CS,CSMS: OCPP 2.0.1 = TransactionEvent(Started)<br/>OCPP 1.6 = StartTransaction
    CS->>CSMS: Transaction start (idToken, meterStart)
    CSMS-->>CS: Response (transactionId, authorization result)
    loop during charging
        Note over CS,CSMS: 2.0.1 = TransactionEvent(Updated)<br/>1.6 = MeterValues
        CS->>CSMS: Sampled meter values
    end
    User->>CS: Unplug / stop
    Note over CS,CSMS: 2.0.1 = TransactionEvent(Ended)<br/>1.6 = StopTransaction
    CS->>CSMS: Transaction end (meterStop, reason)
    CSMS-->>CS: Response

Starting and stopping: when a transaction begins and ends

In OCPP 2.0.1 the exact events that start and stop a transaction are configurable through the TxCtrlr component's TxStartPoint and TxStopPoint variables. An Enua charger evaluates these against the physical and authorization state of the session.

Value Meaning
EVConnected The charging cable has been connected at both ends (or a cable plugged into the socket is detected).
Authorized The driver or EV has been authorized.
PowerPathClosed All preconditions for charging are met and power can flow — the logical combination of EVConnected and Authorized.

TxStartPoint defines which of these events starts a transaction; TxStopPoint defines which, when no longer valid, ends it. See Supported Configuration Keys for the full value lists.

Transaction start

[
  2,
  "12345",
  "TransactionEvent",
  {
    "eventType": "Started",
    "timestamp": "2026-01-01T12:00:00Z",
    "triggerReason": "Authorized",
    "seqNo": 0,
    "transactionInfo": {
      "transactionId": "a3e1b9c4-..."
    },
    "idToken": {
      "idToken": "<RFID/NFC token>",
      "type": "ISO14443"
    },
    "evse": { "id": 1, "connectorId": 1 }
  }
]

Meter values during charging

While charging, the charger periodically sends sampled meter values. In OCPP 2.0.1 these are carried inside TransactionEvent (eventType = Updated); in OCPP 1.6 they are sent as standalone MeterValues.

Which measurands are sampled is configured with SampledDataCtrlr (2.0.1) or MeterValuesSampledData (1.6). Enua chargers report Energy.Active.Import.Register (imported active energy). See Supported Configuration Keys.

[
  2,
  "12346",
  "MeterValues",
  {
    "connectorId": 1,
    "transactionId": 1,
    "meterValue": [
      {
        "timestamp": "2026-01-01T12:05:00Z",
        "sampledValue": [
          { "value": "1500", "measurand": "Energy.Active.Import.Register", "unit": "Wh" }
        ]
      }
    ]
  }
]

Transaction end

[
  2,
  "12347",
  "TransactionEvent",
  {
    "eventType": "Ended",
    "timestamp": "2026-01-01T13:00:00Z",
    "triggerReason": "EVCommunicationLost",
    "seqNo": 5,
    "transactionInfo": {
      "transactionId": "a3e1b9c4-...",
      "stoppedReason": "EVDisconnected"
    }
  }
]

Deauthorizing an active transaction

Whether an ongoing transaction is stopped when the cable is disconnected, or when the CSMS returns a non-Accepted authorization status, is controlled by configuration:

  • TxCtrlr.StopTxOnEVSideDisconnect / StopTransactionOnEVSideDisconnect (1.6) — end the transaction when the cable is unplugged from the EV.
  • TxCtrlr.StopTxOnInvalidId / StopTransactionOnInvalidId (1.6) — end the transaction when the CSMS rejects the identifier.

See Supported Configuration Keys.