X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=1699f046da3982353a45ec637d43adce4b91d6d8;hb=192927e0a96e35e9d302b3ce845a2db99f19e9df;hp=7b98ed35858bd4c524cccb1af9222c0100e3922b;hpb=ed6cfcff3ef6596cdf76c68f600effcb25dece72;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 7b98ed35..1699f046 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -707,9 +707,9 @@ export default class ChargingStation { ): Promise { const transactionId = this.getConnectorStatus(connectorId).transactionId; if ( - this.getBeginEndMeterValues() && - this.getOcppStrictCompliance() && - !this.getOutOfOrderEndMeterValues() + this.getBeginEndMeterValues() === true && + this.getOcppStrictCompliance() === true && + this.getOutOfOrderEndMeterValues() === false ) { // FIXME: Implement OCPP version agnostic helpers const transactionEndMeterValue = OCPP16ServiceUtils.buildTransactionEndMeterValue( @@ -1199,10 +1199,17 @@ export default class ChargingStation { } // Initialize transaction attributes on connectors for (const connectorId of this.connectors.keys()) { + if (connectorId > 0 && this.getConnectorStatus(connectorId).transactionStarted === true) { + logger.warn( + `${this.logPrefix()} Connector ${connectorId} at initialization has a transaction started: ${ + this.getConnectorStatus(connectorId).transactionId + }` + ); + } if ( connectorId > 0 && (this.getConnectorStatus(connectorId).transactionStarted === undefined || - this.getConnectorStatus(connectorId).transactionStarted === false) + this.getConnectorStatus(connectorId).transactionStarted === null) ) { this.initializeConnectorStatus(connectorId); } @@ -1308,7 +1315,7 @@ export default class ChargingStation { private getOcppConfigurationFromFile(): ChargingStationOcppConfiguration | null { let configuration: ChargingStationConfiguration = null; - if (this.getOcppPersistentConfiguration()) { + if (this.getOcppPersistentConfiguration() === true) { const configurationFromFile = this.getConfigurationFromFile(); configuration = configurationFromFile?.configurationKey && configurationFromFile; } @@ -1354,7 +1361,7 @@ export default class ChargingStation { ); } if (this.isRegistered() === true) { - if (this.isInAcceptedState()) { + if (this.isInAcceptedState() === true) { await this.startMessageSequence(); } } else { @@ -1843,9 +1850,7 @@ export default class ChargingStation { if (webSocketPingInterval > 0 && !this.webSocketPingSetInterval) { this.webSocketPingSetInterval = setInterval(() => { if (this.isWebSocketConnectionOpened() === true) { - this.wsConnection.ping((): void => { - /* This is intentional */ - }); + this.wsConnection.ping(); } }, webSocketPingInterval * 1000); logger.info(