From: Jérôme Benoit Date: Fri, 28 Apr 2023 13:41:33 +0000 (+0200) Subject: feat: handle connectors status at stop with evses configuration X-Git-Tag: v1.2.12~52 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=039211f91daa930e261a976c0c5ffbf729fbe922;p=e-mobility-charging-stations-simulator.git feat: handle connectors status at stop with evses configuration Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index c51064f6..159a1adb 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -2054,21 +2054,43 @@ export class ChargingStation { } else { await this.stopRunningTransactions(reason); } - for (const connectorId of this.connectors.keys()) { - if (connectorId > 0) { - await this.ocppRequestService.requestHandler< - StatusNotificationRequest, - StatusNotificationResponse - >( - this, - RequestCommand.STATUS_NOTIFICATION, - OCPPServiceUtils.buildStatusNotificationRequest( + if (this.hasEvses) { + for (const [evseId, evseStatus] of this.evses) { + if (evseId > 0) { + for (const [connectorId, connectorStatus] of evseStatus.connectors) { + await this.ocppRequestService.requestHandler< + StatusNotificationRequest, + StatusNotificationResponse + >( + this, + RequestCommand.STATUS_NOTIFICATION, + OCPPServiceUtils.buildStatusNotificationRequest( + this, + connectorId, + ConnectorStatusEnum.Unavailable + ) + ); + delete connectorStatus?.status; + } + } + } + } else { + for (const connectorId of this.connectors.keys()) { + if (connectorId > 0) { + await this.ocppRequestService.requestHandler< + StatusNotificationRequest, + StatusNotificationResponse + >( this, - connectorId, - ConnectorStatusEnum.Unavailable - ) - ); - delete this.getConnectorStatus(connectorId)?.status; + RequestCommand.STATUS_NOTIFICATION, + OCPPServiceUtils.buildStatusNotificationRequest( + this, + connectorId, + ConnectorStatusEnum.Unavailable + ) + ); + delete this.getConnectorStatus(connectorId)?.status; + } } } }