]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
fix(ocpp2.0): guard BroadcastChannel MeterValues for both VERSION_20 and VERSION_201
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 20 Mar 2026 19:10:38 +0000 (20:10 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 20 Mar 2026 19:10:38 +0000 (20:10 +0100)
The early return in handleMeterValues only checked VERSION_201, missing
VERSION_20. A station configured with ocppVersion '2.0' would fall
through to the OCPP 1.6 path and call convertToInt on a UUID string.

src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts

index ba414170d30f9e106b74406945ebdccd1be12d00..57a87856c6ac9fe1d42720d6b887d87988ad7eeb 100644 (file)
@@ -470,7 +470,10 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
   private async handleMeterValues (
     requestPayload?: BroadcastChannelRequestPayload
   ): Promise<MeterValuesResponse> {
-    if (this.chargingStation.stationInfo?.ocppVersion === OCPPVersion.VERSION_201) {
+    if (
+      this.chargingStation.stationInfo?.ocppVersion === OCPPVersion.VERSION_20 ||
+      this.chargingStation.stationInfo?.ocppVersion === OCPPVersion.VERSION_201
+    ) {
       return await this.chargingStation.ocppRequestService.requestHandler<
         MeterValuesRequest,
         MeterValuesResponse