From 84e13ca9efa04e9516d65c99a54ba9b81457bef8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 14 Mar 2022 11:23:21 +0100 Subject: [PATCH] Better handling of missing serial number prefix in template 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 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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) -- 2.34.1