From: Jérôme Benoit Date: Mon, 14 Mar 2022 10:23:21 +0000 (+0100) Subject: Better handling of missing serial number prefix in template X-Git-Tag: v1.1.55~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=84e13ca9efa04e9516d65c99a54ba9b81457bef8;p=e-mobility-charging-stations-simulator.git Better handling of missing serial number prefix in template Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 88efd93c..bd3e9c9c 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -791,9 +791,13 @@ export default class ChargingStation { ); this.convertDeprecatedTemplateKey(stationTemplateFromFile, 'supervisionUrl', 'supervisionUrls'); const stationInfo: ChargingStationInfo = stationTemplateFromFile ?? ({} as ChargingStationInfo); - stationInfo.chargePointSerialNumber = stationTemplateFromFile?.chargePointSerialNumberPrefix; + stationInfo.chargePointSerialNumber = + stationTemplateFromFile?.chargePointSerialNumberPrefix && + stationTemplateFromFile.chargePointSerialNumberPrefix; delete stationInfo.chargePointSerialNumberPrefix; - stationInfo.chargeBoxSerialNumber = stationTemplateFromFile?.chargeBoxSerialNumberPrefix; + stationInfo.chargeBoxSerialNumber = + stationTemplateFromFile?.chargeBoxSerialNumberPrefix && + stationTemplateFromFile.chargeBoxSerialNumberPrefix; delete stationInfo.chargeBoxSerialNumberPrefix; stationInfo.wsOptions = stationTemplateFromFile?.wsOptions ?? {}; if (!Utils.isEmptyArray(stationTemplateFromFile.power)) { @@ -860,7 +864,6 @@ export default class ChargingStation { meterType: this.stationInfo.meterType, }), }; - this.hashId = crypto .createHash(Constants.DEFAULT_HASH_ALGORITHM) .update(JSON.stringify(this.bootNotificationRequest) + this.stationInfo.chargingStationId)