Improve charging profiles handling debug logs
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPServiceUtils.ts
index 06c22367991bf5d6ac83d356b5aeeee7ec6218f2..08618941d3308dfe7602d92df1726c599efb6552 100644 (file)
@@ -130,7 +130,7 @@ export class OCPPServiceUtils {
     connectorId: number,
     status: ConnectorStatusEnum
   ): StatusNotificationRequest {
-    switch (chargingStation.stationInfo.ocppVersion) {
+    switch (chargingStation.stationInfo.ocppVersion ?? OCPPVersion.VERSION_16) {
       case OCPPVersion.VERSION_16:
         return {
           connectorId,
@@ -145,6 +145,8 @@ export class OCPPServiceUtils {
           connectorId,
           evseId: connectorId,
         } as OCPP20StatusNotificationRequest;
+      default:
+        throw new BaseError('Cannot build status notification payload: OCPP version not supported');
     }
   }