Add support for random meter serial number
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 30 Mar 2022 17:47:57 +0000 (19:47 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 30 Mar 2022 17:47:57 +0000 (19:47 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts
src/types/ChargingStationInfo.ts
src/types/ChargingStationTemplate.ts

index 4d08d493cc93ebf58db83b8ff1cf068c89f92395..457369ff1ad029f30046e47432cb40c3546cc551 100644 (file)
@@ -926,6 +926,8 @@ export default class ChargingStation {
         (stationInfo.chargePointSerialNumber = existingStationInfo.chargePointSerialNumber);
       existingStationInfo?.chargeBoxSerialNumber &&
         (stationInfo.chargeBoxSerialNumber = existingStationInfo.chargeBoxSerialNumber);
+      existingStationInfo?.meterSerialNumber &&
+        (stationInfo.meterSerialNumber = existingStationInfo.meterSerialNumber);
     } else {
       const serialNumberSuffix = params?.randomSerialNumber
         ? this.getRandomSerialNumberSuffix({ upperCase: params.randomSerialNumberUpperCase })
@@ -936,6 +938,9 @@ export default class ChargingStation {
       stationInfo.chargeBoxSerialNumber =
         stationInfo?.chargeBoxSerialNumberPrefix &&
         stationInfo.chargeBoxSerialNumberPrefix + serialNumberSuffix;
+      stationInfo.meterSerialNumber =
+        stationInfo?.meterSerialNumberPrefix &&
+        stationInfo.meterSerialNumberPrefix + serialNumberSuffix;
     }
   }
 
@@ -1059,8 +1064,8 @@ export default class ChargingStation {
       }),
       ...(!Utils.isUndefined(stationInfo.iccid) && { iccid: stationInfo.iccid }),
       ...(!Utils.isUndefined(stationInfo.imsi) && { imsi: stationInfo.imsi }),
-      ...(!Utils.isUndefined(stationInfo.meterSerialNumber) && {
-        meterSerialNumber: stationInfo.meterSerialNumber,
+      ...(!Utils.isUndefined(stationInfo.meterSerialNumberPrefix) && {
+        meterSerialNumber: stationInfo.meterSerialNumberPrefix,
       }),
       ...(!Utils.isUndefined(stationInfo.meterType) && {
         meterType: stationInfo.meterType,
index eb77b601eb2febdfbd5e6ec30e6030ec0e3255ad..70fda722f1a0891c489a3099769909296e78aa61 100644 (file)
@@ -5,6 +5,7 @@ export default interface ChargingStationInfo extends ChargingStationTemplate {
   chargingStationId?: string;
   chargeBoxSerialNumber?: string;
   chargePointSerialNumber?: string;
+  meterSerialNumber?: string;
   maximumPower?: number; // Always in Watt
   powerDivider?: number;
   maximumAmperage?: number; // Always in Ampere
index ff17749a4534761c87bfa437d54c2b038a3881b7..e2f2a2bcfa79cab93ba31661687b8642fb43ea28 100644 (file)
@@ -65,7 +65,7 @@ export default interface ChargingStationTemplate {
   firmwareVersion?: string;
   iccid?: string;
   imsi?: string;
-  meterSerialNumber?: string;
+  meterSerialNumberPrefix?: string;
   meterType?: string;
   power: number | number[];
   powerSharedByConnectors?: boolean;