From: Jérôme Benoit Date: Wed, 30 Mar 2022 17:47:57 +0000 (+0200) Subject: Add support for random meter serial number X-Git-Tag: v1.1.57~19 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=0b7c34ba120b560d2562228a3318a8673a7bf54f;p=e-mobility-charging-stations-simulator.git Add support for random meter serial number Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 4d08d493..457369ff 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -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, diff --git a/src/types/ChargingStationInfo.ts b/src/types/ChargingStationInfo.ts index eb77b601..70fda722 100644 --- a/src/types/ChargingStationInfo.ts +++ b/src/types/ChargingStationInfo.ts @@ -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 diff --git a/src/types/ChargingStationTemplate.ts b/src/types/ChargingStationTemplate.ts index ff17749a..e2f2a2bc 100644 --- a/src/types/ChargingStationTemplate.ts +++ b/src/types/ChargingStationTemplate.ts @@ -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;