fix: ensure updated CS event is emitted on all possible changes
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStation.ts
index e354b4b5164979c794e43a26b740ed9e2295db9b..508567f37e7999a97fc3ad20564b2c37b1e6ae77 100644 (file)
@@ -1853,6 +1853,7 @@ export class ChargingStation extends EventEmitter {
       commandName,
       commandPayload,
     );
+    this.emit(ChargingStationEvents.updated);
   }
 
   private handleResponseMessage(response: Response): void {
@@ -1929,7 +1930,6 @@ export class ChargingStation extends EventEmitter {
             logger.error(`${this.logPrefix()} ${errorMsg}`);
             throw new OCPPError(ErrorType.PROTOCOL_ERROR, errorMsg);
         }
-        this.emit(ChargingStationEvents.updated);
       } else {
         throw new OCPPError(
           ErrorType.PROTOCOL_ERROR,