Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Better handling of missing serial number prefix in template
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
  • Loading branch information
Jérôme Benoit committed Mar 14, 2022
1 parent dbdcd51 commit 84e13ca
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/charging-station/ChargingStation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 84e13ca

Please sign in to comment.