From e644918b4a997877aeae1c7875ef1296585872c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 4 Jun 2021 13:05:50 +0200 Subject: [PATCH] Default ATG to send authorize command before starting a transaction MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- README.md | 2 +- src/assets/station-templates/abb.station-template.json | 2 +- src/assets/station-templates/evlink.station-template.json | 2 +- src/assets/station-templates/keba.station-template.json | 2 +- .../station-templates/schneider-imredd.station-template.json | 2 +- src/assets/station-templates/schneider.station-template.json | 2 +- src/assets/station-templates/siemens.station-template.json | 2 +- .../virtual-simple-atg.station-template.json | 2 +- .../station-templates/virtual-simple.station-template.json | 2 +- src/assets/station-templates/virtual.station-template.json | 2 +- src/charging-station/AutomaticTransactionGenerator.ts | 2 +- src/charging-station/ChargingStation.ts | 4 ++++ 12 files changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index cec08120..a525ad66 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Connectors | | | Connectors | charging stations connectors configuration "probabilityOfStart": 1, "stopAfterHours": 0.3, "stopOnConnectionFailure": true, - "requireAuthorize": false + "requireAuthorize": true } ``` #### Connectors section diff --git a/src/assets/station-templates/abb.station-template.json b/src/assets/station-templates/abb.station-template.json index 0ba61ec6..eb30dd4a 100644 --- a/src/assets/station-templates/abb.station-template.json +++ b/src/assets/station-templates/abb.station-template.json @@ -63,7 +63,7 @@ "probabilityOfStart": 1, "stopAfterHours": 0.3, "stopOnConnectionFailure": true, - "requireAuthorize": false + "requireAuthorize": true }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/evlink.station-template.json b/src/assets/station-templates/evlink.station-template.json index 74436fc3..de6d2983 100644 --- a/src/assets/station-templates/evlink.station-template.json +++ b/src/assets/station-templates/evlink.station-template.json @@ -49,7 +49,7 @@ "probabilityOfStart": 1, "stopAfterHours": 0.3, "stopOnConnectionFailure": false, - "requireAuthorize": false + "requireAuthorize": true }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/keba.station-template.json b/src/assets/station-templates/keba.station-template.json index 236f0ce5..78e43df9 100644 --- a/src/assets/station-templates/keba.station-template.json +++ b/src/assets/station-templates/keba.station-template.json @@ -46,7 +46,7 @@ "probabilityOfStart": 1, "stopAfterHours": 0.3, "stopOnConnectionFailure": false, - "requireAuthorize": false + "requireAuthorize": true }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/schneider-imredd.station-template.json b/src/assets/station-templates/schneider-imredd.station-template.json index 6daad3a7..24f6daac 100644 --- a/src/assets/station-templates/schneider-imredd.station-template.json +++ b/src/assets/station-templates/schneider-imredd.station-template.json @@ -48,7 +48,7 @@ "probabilityOfStart": 1, "stopAfterHours": 0.3, "stopOnConnectionFailure": false, - "requireAuthorize": false + "requireAuthorize": true }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/schneider.station-template.json b/src/assets/station-templates/schneider.station-template.json index 353ad567..605a7fe1 100644 --- a/src/assets/station-templates/schneider.station-template.json +++ b/src/assets/station-templates/schneider.station-template.json @@ -53,7 +53,7 @@ "probabilityOfStart": 1, "stopAfterHours": 0.3, "stopOnConnectionFailure": false, - "requireAuthorize": false + "requireAuthorize": true }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/siemens.station-template.json b/src/assets/station-templates/siemens.station-template.json index fa05caf0..4d78cca2 100644 --- a/src/assets/station-templates/siemens.station-template.json +++ b/src/assets/station-templates/siemens.station-template.json @@ -47,7 +47,7 @@ "probabilityOfStart": 1, "stopAfterHours": 0.3, "stopOnConnectionFailure": false, - "requireAuthorize": false + "requireAuthorize": true }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/virtual-simple-atg.station-template.json b/src/assets/station-templates/virtual-simple-atg.station-template.json index a695e2bd..306e03a1 100644 --- a/src/assets/station-templates/virtual-simple-atg.station-template.json +++ b/src/assets/station-templates/virtual-simple-atg.station-template.json @@ -47,7 +47,7 @@ "probabilityOfStart": 1, "stopAfterHours": 0.3, "stopOnConnectionFailure": false, - "requireAuthorize": false + "requireAuthorize": true }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/virtual-simple.station-template.json b/src/assets/station-templates/virtual-simple.station-template.json index 4af1ab1d..6eb68a46 100644 --- a/src/assets/station-templates/virtual-simple.station-template.json +++ b/src/assets/station-templates/virtual-simple.station-template.json @@ -47,7 +47,7 @@ "probabilityOfStart": 1, "stopAfterHours": 0.3, "stopOnConnectionFailure": false, - "requireAuthorize": false + "requireAuthorize": true }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/virtual.station-template.json b/src/assets/station-templates/virtual.station-template.json index 0a713610..31d52b59 100644 --- a/src/assets/station-templates/virtual.station-template.json +++ b/src/assets/station-templates/virtual.station-template.json @@ -47,7 +47,7 @@ "probabilityOfStart": 1, "stopAfterHours": 0.3, "stopOnConnectionFailure": false, - "requireAuthorize": false + "requireAuthorize": true }, "Connectors": { "0": {}, diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 0562a897..7268f445 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -128,7 +128,7 @@ export default class AutomaticTransactionGenerator { private async startTransaction(connectorId: number, self: AutomaticTransactionGenerator): Promise { if (self.chargingStation.hasAuthorizedTags()) { const tagId = self.chargingStation.getRandomTagId(); - if (self.chargingStation.stationInfo.AutomaticTransactionGenerator.requireAuthorize) { + if (self.chargingStation.getAutomaticTransactionGeneratorRequireAuthorize()) { // Authorize tagId const authorizeResponse = await self.chargingStation.ocppRequestService.sendAuthorize(tagId); if (authorizeResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 5f8e9677..e9eb86b4 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -174,6 +174,10 @@ export default class ChargingStation { this.startWebSocketPing(); } + public getAutomaticTransactionGeneratorRequireAuthorize(): boolean { + return this.stationInfo.AutomaticTransactionGenerator.requireAuthorize ?? true; + } + public startHeartbeat(): void { if (this.getHeartbeatInterval() && this.getHeartbeatInterval() > 0 && !this.heartbeatSetInterval) { // eslint-disable-next-line @typescript-eslint/no-misused-promises -- 2.34.1