)
)
logger.info(
- `${this.logPrefix(
- connectorId
- )} transaction started with id ${this.chargingStation.getConnectorStatus(connectorId)
- ?.transactionId} and will stop in ${formatDurationMilliSeconds(waitTrxEnd)}`
+ `${this.logPrefix(connectorId)} transaction started with id ${
+ this.chargingStation.getConnectorStatus(connectorId)?.transactionId
+ } and will stop in ${formatDurationMilliSeconds(waitTrxEnd)}`
)
await sleep(waitTrxEnd)
await this.stopTransaction(connectorId)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
++this.connectorsStatus.get(connectorId)!.skippedTransactions
logger.info(
- `${this.logPrefix(connectorId)} skipped consecutively ${this.connectorsStatus.get(
- connectorId
- )?.skippedConsecutiveTransactions}/${this.connectorsStatus.get(connectorId)
- ?.skippedTransactions} transaction(s)`
+ `${this.logPrefix(connectorId)} skipped consecutively ${
+ this.connectorsStatus.get(connectorId)?.skippedConsecutiveTransactions
+ }/${this.connectorsStatus.get(connectorId)?.skippedTransactions} transaction(s)`
)
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
}
private setStartConnectorStatus (connectorId: number): void {
- const previousRunDuration =
- isValidTime(this.connectorsStatus.get(connectorId)?.startDate) &&
- isValidTime(this.connectorsStatus.get(connectorId)?.lastRunDate) &&
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- this.connectorsStatus.get(connectorId)!.lastRunDate! >
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- this.connectorsStatus.get(connectorId)!.startDate!
- ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- this.connectorsStatus.get(connectorId)!.lastRunDate!.getTime() -
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- this.connectorsStatus.get(connectorId)!.startDate!.getTime()
- : 0
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.connectorsStatus.get(connectorId)!.startDate = new Date()
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- this.connectorsStatus.get(connectorId)!.stopDate = new Date(
+ if (
+ this.chargingStation.getAutomaticTransactionGeneratorConfiguration()?.stopAbsoluteDuration ===
+ false ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- this.connectorsStatus.get(connectorId)!.startDate!.getTime() +
- hoursToMilliseconds(
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- this.chargingStation.getAutomaticTransactionGeneratorConfiguration()!.stopAfterHours
- ) -
- previousRunDuration
- )
+ !isValidTime(this.connectorsStatus.get(connectorId)!.stopDate)
+ ) {
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ this.connectorsStatus.get(connectorId)!.stopDate = new Date(
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ this.connectorsStatus.get(connectorId)!.startDate!.getTime() +
+ hoursToMilliseconds(
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ this.chargingStation.getAutomaticTransactionGeneratorConfiguration()!.stopAfterHours
+ )
+ )
+ }
delete this.connectorsStatus.get(connectorId)?.stoppedDate
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.connectorsStatus.get(connectorId)!.skippedConsecutiveTransactions = 0
let stopResponse: StopTransactionResponse | undefined
if (this.chargingStation.getConnectorStatus(connectorId)?.transactionStarted === true) {
logger.info(
- `${this.logPrefix(
- connectorId
- )} stop transaction with id ${this.chargingStation.getConnectorStatus(connectorId)
- ?.transactionId}`
+ `${this.logPrefix(connectorId)} stop transaction with id ${
+ this.chargingStation.getConnectorStatus(connectorId)?.transactionId
+ }`
)
stopResponse = await this.chargingStation.stopTransactionOnConnector(connectorId, reason)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion