From fda4af5708aacd343961751fa1f879161f0c6884 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 31 Oct 2020 13:00:43 +0100 Subject: [PATCH] Fix chargeBoxSerialNumberPrefix template tunable handling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../evlink.station-template.json | 2 +- .../schneider-imredd.station-template.json | 2 +- .../schneider.station-template.json | 2 +- src/charging-station/ChargingStation.js | 22 +++++++++---------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/assets/station-templates/evlink.station-template.json b/src/assets/station-templates/evlink.station-template.json index caa18f74..f340b985 100644 --- a/src/assets/station-templates/evlink.station-template.json +++ b/src/assets/station-templates/evlink.station-template.json @@ -3,7 +3,7 @@ "baseName": "CS-EVLINK", "chargePointModel": "MONOBLOCK", "chargePointVendor": "Schneider Electric", - "chargePointSerialNumberPrefix": "EV.2S7P04", + "chargeBoxSerialNumberPrefix": "EV.2S7P04", "firmwareVersion": "3.3.0.10", "power": 7360, "powerUnit": "W", diff --git a/src/assets/station-templates/schneider-imredd.station-template.json b/src/assets/station-templates/schneider-imredd.station-template.json index 40529ff9..1606c8f0 100644 --- a/src/assets/station-templates/schneider-imredd.station-template.json +++ b/src/assets/station-templates/schneider-imredd.station-template.json @@ -3,7 +3,7 @@ "baseName": "CS-SCHNEIDER", "chargePointModel": "MONOBLOCK", "chargePointVendor": "Schneider Electric", - "chargePointSerialNumberPrefix": "EV.2S22P04", + "chargeBoxSerialNumberPrefix": "EV.2S22P04", "firmwareVersion": "3.3.0.10", "power": 22080, "powerUnit": "W", diff --git a/src/assets/station-templates/schneider.station-template.json b/src/assets/station-templates/schneider.station-template.json index 9b442401..5583cf04 100644 --- a/src/assets/station-templates/schneider.station-template.json +++ b/src/assets/station-templates/schneider.station-template.json @@ -3,7 +3,7 @@ "baseName": "CS-SCHNEIDER", "chargePointModel": "MONOBLOCK", "chargePointVendor": "Schneider Electric", - "chargePointSerialNumberPrefix": "EV.2S22P44", + "chargeBoxSerialNumberPrefix": "EV.2S22P44", "firmwareVersion": "3.3.0.10", "power": 44160, "powerUnit": "W", diff --git a/src/charging-station/ChargingStation.js b/src/charging-station/ChargingStation.js index 1ffcfab7..28ae1707 100644 --- a/src/charging-station/ChargingStation.js +++ b/src/charging-station/ChargingStation.js @@ -61,7 +61,7 @@ export default class ChargingStation { this._bootNotificationMessage = { chargePointModel: this._stationInfo.chargePointModel, chargePointVendor: this._stationInfo.chargePointVendor, - ...!Utils.isUndefined(this._stationInfo.chargePointSerialNumberPrefix) && {chargePointSerialNumber: this._stationInfo.chargePointSerialNumberPrefix}, + ...!Utils.isUndefined(this._stationInfo.chargeBoxSerialNumberPrefix) && {chargeBoxSerialNumber: this._stationInfo.chargeBoxSerialNumberPrefix}, ...!Utils.isUndefined(this._stationInfo.firmwareVersion) && {firmwareVersion: this._stationInfo.firmwareVersion}, }; this._configuration = this._getConfiguration(); @@ -941,7 +941,7 @@ export default class ChargingStation { this._addConfigurationKey('HeartbeatInterval', Utils.convertToInt(payload.interval), false, false); this._basicStartMessageSequence(); } else if (payload.status === 'Pending') { - logger.info(this._logPrefix() + ' Charging station pending on the central server'); + logger.info(this._logPrefix() + ' Charging station in pending state on the central server'); } else { logger.info(this._logPrefix() + ' Charging station rejected by the central server'); } @@ -1040,10 +1040,10 @@ export default class ChargingStation { } let response; // Call - if (typeof this['handle' + commandName] === 'function') { + if (typeof this['handleRequest' + commandName] === 'function') { try { // Call the method to build the response - response = await this['handle' + commandName](commandPayload); + response = await this['handleRequest' + commandName](commandPayload); } catch (error) { // Log logger.error(this._logPrefix() + ' Handle request error: ' + error); @@ -1059,8 +1059,8 @@ export default class ChargingStation { await this.sendMessage(messageId, response, Constants.OCPP_JSON_CALL_RESULT_MESSAGE); } - async handleReset(commandPayload) { - // Simulate charging station restart + // Simulate charging station restart + async handleRequestReset(commandPayload) { setImmediate(async () => { await this.stop(commandPayload.type + 'Reset'); await Utils.sleep(this._stationInfo.resetTime); @@ -1095,7 +1095,7 @@ export default class ChargingStation { } } - async handleGetConfiguration(commandPayload) { + async handleRequestGetConfiguration(commandPayload) { const configurationKey = []; const unknownKey = []; if (Utils.isEmptyArray(commandPayload.key)) { @@ -1142,7 +1142,7 @@ export default class ChargingStation { }; } - async handleChangeConfiguration(commandPayload) { + async handleRequestChangeConfiguration(commandPayload) { const keyToChange = this._getConfigurationKey(commandPayload.key); if (!keyToChange) { return {status: Constants.OCPP_ERROR_NOT_SUPPORTED}; @@ -1174,9 +1174,9 @@ export default class ChargingStation { } } - async handleRemoteStartTransaction(commandPayload) { + async handleRequestRemoteStartTransaction(commandPayload) { const transactionConnectorID = commandPayload.connectorId ? commandPayload.connectorId : '1'; - if (this.hasAuthorizedTags() && this._getLocalAuthListEnabled() && this._getAuthorizeRemoteTxRequests()) { + if (this._getAuthorizeRemoteTxRequests() && this._getLocalAuthListEnabled() && this.hasAuthorizedTags()) { // Check if authorized if (this._authorizedTags.find((value) => value === commandPayload.idTag)) { // Authorization successful start transaction @@ -1193,7 +1193,7 @@ export default class ChargingStation { return Constants.OCPP_RESPONSE_ACCEPTED; } - async handleRemoteStopTransaction(commandPayload) { + async handleRequestRemoteStopTransaction(commandPayload) { for (const connector in this._connectors) { if (this.getConnector(connector).transactionId === commandPayload.transactionId) { this.sendStopTransaction(commandPayload.transactionId); -- 2.34.1