]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
fix(ocpp2): implement StopTxOnInvalidId and MaxEnergyOnInvalidId per E05 (#1745)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 22 Mar 2026 18:26:00 +0000 (19:26 +0100)
committerGitHub <noreply@github.com>
Sun, 22 Mar 2026 18:26:00 +0000 (19:26 +0100)
commit865b7d1f8d56d1152d57784d2a542d1ca6b62f2b
tree566f5b23ef679991976490b4d321643e4e034f46
parentdbe034ffae6a2648fc9e41197f2c3e015a196592
fix(ocpp2): implement StopTxOnInvalidId and MaxEnergyOnInvalidId per E05 (#1745)

* fix(ocpp2): implement StopTxOnInvalidId and MaxEnergyOnInvalidId per E05

Implement the full deauthorization decision tree per OCPP 2.0.1 spec:
- StopTxOnInvalidId=false: transaction continues, no termination
- StopTxOnInvalidId=true + MaxEnergyOnInvalidId>0: defer termination
  until energy limit reached (checked in periodic meter values callback)
- StopTxOnInvalidId=true + MaxEnergyOnInvalidId=0: immediate suspension
  and termination

Also includes:
- Deduplicate transactionSetInterval/transactionTxUpdatedSetInterval
  into single transactionMeterValuesSetInterval field
- Add transactionDeauthorized/transactionDeauthorizedEnergyWh to
  ConnectorStatus for deauth state tracking (cleared in resetConnectorStatus)
- Extract readVariableValue/readVariableAsBoolean/readVariableAsInteger
  helpers using convertToInt and convertToBoolean utilities
- Fix buildEvsesStatus test that was missing evse-to-connector wiring

* refactor(ocpp2): address PR review comments

- Add logger.warn in readVariableAsInteger catch for diagnostic
- Replace unsafe 'as string' cast with .toString() in periodic callback
- Add tests for StopTxOnInvalidId=false and deauth state tracking

* chore: update webui.png

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* test: add resetConnectorStatus unit tests to Helpers.test.ts

Verify all 18 transaction fields are properly cleaned, TX_PROFILE
charging profiles matching the transaction are removed, and
non-transaction fields are preserved.

---------

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
12 files changed:
src/charging-station/Helpers.ts
src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts
src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts
src/types/ConnectorStatus.ts
src/utils/ChargingStationConfigurationUtils.ts
tests/charging-station/ChargingStation-Transactions.test.ts
tests/charging-station/Helpers.test.ts
tests/charging-station/helpers/StationHelpers.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts
tests/helpers/TestLifecycleHelpers.ts
tests/utils/ChargingStationConfigurationUtils.test.ts
ui/web/src/assets/webui.png