From 1aaa98dfc6fad0142f127e658071a5935fc66bd7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 28 Nov 2020 15:39:17 +0100 Subject: [PATCH] Send meterStop at stop transaction 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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 9109d53e..6bd51d01 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -318,6 +318,14 @@ export default class ChargingStation { } } + _getTransactionMeterStop(transactionId: number): number { + for (const connector in this._connectors) { + if (this.getConnector(Utils.convertToInt(connector)).transactionId === transactionId) { + return this.getConnector(Utils.convertToInt(connector)).lastEnergyActiveImportRegisterValue; + } + } + } + _getPowerOutType(): PowerOutType { return !Utils.isUndefined(this._stationInfo.powerOutType) ? this._stationInfo.powerOutType : PowerOutType.AC; } @@ -768,7 +776,7 @@ export default class ChargingStation { const payload: StopTransactionRequest = { transactionId, ...!Utils.isUndefined(idTag) && { idTag: idTag }, - meterStop: 0, + meterStop: this._getTransactionMeterStop(transactionId), timestamp: new Date().toISOString(), ...reason && { reason }, }; -- 2.34.1