From: Jérôme Benoit Date: Sat, 27 May 2023 13:39:02 +0000 (+0200) Subject: fix: ensure template has priority over CS configuration X-Git-Tag: v1.2.15~32 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ba01a213717165f2996c4d27151b414d87c4bbf0;p=e-mobility-charging-stations-simulator.git fix: ensure template has priority over CS configuration Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 414a48c5..de005ddf 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1094,10 +1094,9 @@ export class ChargingStation { `${ChargingStationUtils.getHashId(this.index, stationTemplate)}.json` ); const chargingStationConfiguration = this.getConfigurationFromFile(); - // FIXME: template changes to evses or connectors are not taken into account if ( - chargingStationConfiguration?.connectorsStatus || - chargingStationConfiguration?.evsesStatus + chargingStationConfiguration?.stationInfo?.templateHash === stationTemplate?.templateHash && + (chargingStationConfiguration?.connectorsStatus || chargingStationConfiguration?.evsesStatus) ) { this.initializeConnectorsOrEvsesFromFile(chargingStationConfiguration); } else { @@ -1479,7 +1478,7 @@ export class ChargingStation { if (stationTemplate?.Evses) { const evsesConfigHash = crypto .createHash(Constants.DEFAULT_HASH_ALGORITHM) - .update(`${JSON.stringify(stationTemplate?.Evses)}`) + .update(JSON.stringify(stationTemplate?.Evses)) .digest('hex'); const evsesConfigChanged = this.evses?.size !== 0 && this.evsesConfigurationHash !== evsesConfigHash;