From 0b7c34ba120b560d2562228a3318a8673a7bf54f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 30 Mar 2022 19:47:57 +0200 Subject: [PATCH] Add support for random meter serial number MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 9 +++++++-- src/types/ChargingStationInfo.ts | 1 + src/types/ChargingStationTemplate.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) 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; -- 2.34.1