fix: ensure ATG status is refreshed in the UI at stop
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 7 Jun 2024 21:00:49 +0000 (23:00 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 7 Jun 2024 21:00:49 +0000 (23:00 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/charging-station/AutomaticTransactionGenerator.ts

index 0eb47381876d833aef74796f6471a8af4bcb8c35..9f1c4d39af45133373e889711eab2739e8c11da4 100644 (file)
@@ -8,6 +8,7 @@ import { BaseError } from '../exception/index.js'
 import { PerformanceStatistics } from '../performance/index.js'
 import {
   AuthorizationStatus,
+  ChargingStationEvents,
   RequestCommand,
   type StartTransactionRequest,
   type StartTransactionResponse,
@@ -262,9 +263,10 @@ export class AutomaticTransactionGenerator {
       )}`
     )
     logger.debug(
-      `${this.logPrefix(connectorId)} connector status: %j`,
+      `${this.logPrefix(connectorId)} stopped with connector status: %j`,
       this.connectorsStatus.get(connectorId)
     )
+    this.chargingStation.emit(ChargingStationEvents.updated)
   }
 
   private setStartConnectorStatus (
@@ -294,6 +296,7 @@ export class AutomaticTransactionGenerator {
     this.connectorsStatus.get(connectorId)!.skippedConsecutiveTransactions = 0
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     this.connectorsStatus.get(connectorId)!.start = true
+    this.chargingStation.emit(ChargingStationEvents.updated)
   }
 
   private canStartConnector (connectorId: number): boolean {