Merge pull request #858 from SAP/combined-prs-branch
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 24 Nov 2023 08:53:55 +0000 (09:53 +0100)
committerGitHub <noreply@github.com>
Fri, 24 Nov 2023 08:53:55 +0000 (09:53 +0100)
Combined PRs

CHANGELOG.md
build-requirements.js
package.json
sonar-project.properties
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/OCPPRequestService.ts
src/utils/Constants.ts
ui/web/src/types/ChargingStationType.ts

index 3b5b8e0aec44acda108c21fbe4917ddaf1c27e1a..a2b10ecd91871b2d96592299c610567031b9eb21 100644 (file)
@@ -1,6 +1,36 @@
 # Changelog
 
-## [v1.2.25](https://github.com/sap/e-mobility-charging-stations-simulator/compare/v1.2.24...v1.2.25)
+## [v1.2.26](https://github.com/sap/e-mobility-charging-stations-simulator/compare/v1.2.25...v1.2.26)
+
+- fix(simulator): buffer OCPP payload at sending error [`#156`](https://github.com/sap/e-mobility-charging-stations-simulator/issues/156)
+- build(deps-dev): apply updates [`4a0329e`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/4a0329e11a89061df3af60db199fc11763748f8d)
+- build(deps-dev): apply updates [`5ca3b55`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/5ca3b55883ae9fe6e27587ee878b0281fe5fe5ba)
+- fix: make stationInfo attributes writable again [`33276ba`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/33276ba6a447f0beb92b934d2b8d5cb08eababb4)
+- refactor: stricter type checking in conditions [`4e3b1d6`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/4e3b1d6bdc767ec63949b998f0375fe2b5bc2b28)
+- feat: add message buffer flush interval [`1cee001`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/1cee0015ac704be480535c7228103525cc3c8cc2)
+- fix: add getter/setter on some station info attributes [`9fe79a1`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/9fe79a139245f48ce0b6b05a90e601a749c37507)
+- refactor: improve OCPP error defaults and usage [`7375968`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/7375968c99fc22707e16e5e7923ca130c824ce5b)
+- build(deps-dev): apply updates [`8e3118b`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/8e3118bd3b575d372ed39222424833e38193f794)
+- fix: do not log twice OCPP request sending error [`3febbc9`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/3febbc9f6498f7f5a6dc754a5fa687d112cc2c9b)
+- fix: fix configuration loading from file [`7878689`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/78786898ff255379a312fc2d9724515b9219b27c)
+- refactor: remove unneeded max power getter [`7ffc143`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/7ffc14365e06809bde30fff5fd03fb022d7483f5)
+- fix: ensure updated CS event is emitted on all possible changes [`8baae8e`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/8baae8ee55048e93af74e94a2a806675d738e3bb)
+- refactor: remove unneeded encapsulation in arrow function [`b7ee97c`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/b7ee97c15b5c634db6d1aa05f8c52dc2e25715fd)
+- refactor: remove unneeded registration status getter [`05e2446`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/05e2446f43d2fb81bfdfe43684186acdeb490085)
+- fix: ensure the message buffer is flushed once accepted state is reached [`6ccd865`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/6ccd865d6381ce21115dbe4c9271f64e5c8048c5)
+- refactor: explicit condition check in OCPP stack [`9aa1a33`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/9aa1a33f94dfe5b96a4715f87fb630a63b3250a6)
+- perf(ui): only build WS payload if connection is opened [`3133b91`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/3133b91cd6761645ddeabac18e6db8d34a10356e)
+- fix: ensure configuration keys are saved with the right data structure [`755a76d`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/755a76d5aeb7164b82c392048c11d401f99aad81)
+- refactor: cleanup persistent stationInfo tunable handling [`15af2fe`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/15af2feb2facd029a64f005074db43cdb175e69c)
+- build: bump volta node version [`3216379`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/321637937e652701db0aefb5b994ee46eff2080a)
+- build: remove now uneeded ESM workaround for esbuil [`f01a4e6`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/f01a4e61a5ba423fbb9636747de36505cbf0e5bd)
+- refactor: refine type casting in OCPP stack [`e3fd8f6`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/e3fd8f6dce61f4b723e18b524c50fd00c864c82d)
+- refactor: refine OCPP stack log message [`42b8cf5`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/42b8cf5cdca8eaab1e7442f7c92c2a5ed97434f6)
+- refactor: cleanup types signature namespace [`8b75cab`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/8b75cab6a9906ba8a0a571c07cc80489c761dc15)
+- refactor: more stricter type checking in condition [`bc0f4d8`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/bc0f4d8f4973f36baa3f468848fe4d7af25c9a9c)
+- refactor: add error name in worker set worker startup error reporting [`7cd4006`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/7cd4006c7ba46b245fe2e14e9ad336f6a8a0d7f0)
+
+## [v1.2.25](https://github.com/sap/e-mobility-charging-stations-simulator/compare/v1.2.24...v1.2.25) (2023-11-20)
 
 - build(deps-dev): apply udpates [`793a8ff`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/793a8ffcbc424b3552482f59f865e1adc25e4f23)
 - build(deps-dev): apply updates [`464d3e1`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/464d3e1aec162bc71f36399f575060cfa098dcbf)
@@ -16,6 +46,7 @@
 - refactor: factor out WS error handling code [`3c80de9`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/3c80de96aa61159bf5551c816264e878f2b84e35)
 - feat: ensure measurand min value are taken into account [`d71ce3f`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/d71ce3fa734fcefeb3dce31d78968b847c625c92)
 - fix: fix OCPP message sending promise leak [`9d7b5fa`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/9d7b5fa3591b5cbdfbfb44d7c2721b2050399664)
+- chore: version 1.2.25 [`3b50f6e`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/3b50f6e861c26b56e46a4a21f83883d7063b5752)
 - fix: remove incorrect promise race usage at stopping charging stations [`5b2721d`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/5b2721dbc4fa0b5ee6e48241a5077091a7b1c342)
 - build(deps-dev): apply updates [`42de5c9`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/42de5c96eddd902024485230d337a9047c4edaea)
 - refactor: strong type data sent to worker [`d769e04`](https://github.com/sap/e-mobility-charging-stations-simulator/commit/d769e04a20f93f2b11eacccc48c555236a65bf65)
index 839be558929cb737f192b90a24cc4152ea284cbd..632e7a3403d20936d001dbe60abbf4204235272d 100644 (file)
@@ -6,7 +6,7 @@ import { version, exit } from 'node:process';
 /**
  * Check if the current node version match the required engines version.
  */
-export function checkNodeVersion() {
+export const checkNodeVersion = () => {
   const enginesNodeVersion = packageJson.engines.node;
   if (semVer.satisfies(version, enginesNodeVersion) === false) {
     console.error(
@@ -17,6 +17,6 @@ export function checkNodeVersion() {
     // eslint-disable-next-line n/no-process-exit
     exit(1);
   }
-}
+};
 
 checkNodeVersion();
index 81e7226fa5a192c9a122361f5d6804a6e7c35c9e..453a7af37dad02dd5106385b83fad150ac965f3b 100644 (file)
@@ -1,7 +1,7 @@
 {
   "$schema": "https://json.schemastore.org/package",
   "name": "e-mobility-charging-stations-simulator",
-  "version": "1.2.25",
+  "version": "1.2.26",
   "engines": {
     "node": ">=18.18.0",
     "pnpm": ">=8.6.0"
index a5755e51b90e4fe3ae679234da872486cfcfcde0..231dc11388faba43b5c8911ad3c68f8ce32b231e 100644 (file)
@@ -3,7 +3,7 @@ sonar.organization=sap-1
 
 # This is the name and version displayed in the SonarCloud UI.
 sonar.projectName=e-mobility-charging-stations-simulator
-sonar.projectVersion=1.2.25
+sonar.projectVersion=1.2.26
 
 # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
 sonar.sources=src
index 508567f37e7999a97fc3ad20564b2c37b1e6ae77..f0fa08208c79241bf23d0c7cdd05b4c1d7e14991 100644 (file)
@@ -37,11 +37,9 @@ import {
   getMaxNumberOfEvses,
   getNumberOfReservableConnectors,
   getPhaseRotationValue,
-  hasFeatureProfile,
   hasReservationExpired,
   initializeConnectorsMapStatus,
   propagateSerialNumber,
-  removeExpiredReservations,
   stationTemplateToStationInfo,
   warnTemplateKeysDeprecation,
 } from './Helpers';
@@ -158,6 +156,7 @@ import {
 export class ChargingStation extends EventEmitter {
   public readonly index: number;
   public readonly templateFile: string;
+  public stationInfo!: ChargingStationInfo;
   public started: boolean;
   public starting: boolean;
   public idTagsCache: IdTagsCache;
@@ -173,7 +172,6 @@ export class ChargingStation extends EventEmitter {
   public bootNotificationRequest!: BootNotificationRequest;
   public bootNotificationResponse!: BootNotificationResponse | undefined;
   public powerDivider!: number;
-  private internalStationInfo!: ChargingStationInfo;
   private stopping: boolean;
   private configurationFile!: string;
   private configurationFileHash!: string;
@@ -189,7 +187,7 @@ export class ChargingStation extends EventEmitter {
   private readonly sharedLRUCache: SharedLRUCache;
   private webSocketPingSetInterval?: NodeJS.Timeout;
   private readonly chargingStationWorkerBroadcastChannel: ChargingStationWorkerBroadcastChannel;
-  private reservationExpirationSetInterval?: NodeJS.Timeout;
+  private flushMessageBufferSetInterval?: NodeJS.Timeout;
 
   constructor(index: number, templateFile: string) {
     super();
@@ -225,35 +223,6 @@ export class ChargingStation extends EventEmitter {
     return this.connectors.size === 0 && this.evses.size > 0;
   }
 
-  public get stationInfo(): ChargingStationInfo {
-    return {
-      ...{
-        enableStatistics: false,
-        remoteAuthorization: true,
-        currentOutType: CurrentType.AC,
-        mainVoltageMeterValues: true,
-        phaseLineToLineVoltageMeterValues: false,
-        customValueLimitationMeterValues: true,
-        ocppStrictCompliance: true,
-        outOfOrderEndMeterValues: false,
-        beginEndMeterValues: false,
-        meteringPerTransaction: true,
-        transactionDataMeterValues: false,
-        supervisionUrlOcppConfiguration: false,
-        supervisionUrlOcppKey: VendorParametersKey.ConnectionUrl,
-        ocppVersion: OCPPVersion.VERSION_16,
-        ocppPersistentConfiguration: true,
-        stationInfoPersistentConfiguration: true,
-        automaticTransactionGeneratorPersistentConfiguration: true,
-        autoReconnectMaxRetries: -1,
-        registrationMaxRetries: -1,
-        reconnectExponentialDelay: false,
-        stopTransactionsOnStopped: true,
-      },
-      ...this.internalStationInfo,
-    };
-  }
-
   private get wsConnectionUrl(): URL {
     return new URL(
       `${
@@ -295,10 +264,6 @@ export class ChargingStation extends EventEmitter {
     return this?.wsConnection?.readyState === WebSocket.OPEN;
   }
 
-  public getRegistrationStatus(): RegistrationStatusEnumType | undefined {
-    return this?.bootNotificationResponse?.status;
-  }
-
   public inUnknownState(): boolean {
     return isNullOrUndefined(this?.bootNotificationResponse?.status);
   }
@@ -647,9 +612,6 @@ export class ChargingStation extends EventEmitter {
         if (this.stationInfo?.enableStatistics === true) {
           this.performanceStatistics?.start();
         }
-        if (hasFeatureProfile(this, SupportedFeatureProfiles.Reservation)) {
-          this.startReservationExpirationSetInterval();
-        }
         this.openWSConnection();
         // Monitor charging station template file
         this.templateFileWatcher = watchJsonFile(
@@ -710,9 +672,6 @@ export class ChargingStation extends EventEmitter {
         if (this.stationInfo?.enableStatistics === true) {
           this.performanceStatistics?.stop();
         }
-        if (hasFeatureProfile(this, SupportedFeatureProfiles.Reservation)) {
-          this.stopReservationExpirationSetInterval();
-        }
         this.sharedLRUCache.deleteChargingStationConfiguration(this.configurationFileHash);
         this.templateFileWatcher?.close();
         this.sharedLRUCache.deleteChargingStationTemplate(this.templateFileHash);
@@ -744,6 +703,17 @@ export class ChargingStation extends EventEmitter {
 
   public bufferMessage(message: string): void {
     this.messageBuffer.add(message);
+    if (this.flushMessageBufferSetInterval === undefined) {
+      this.flushMessageBufferSetInterval = setInterval(() => {
+        if (this.isWebSocketConnectionOpened() === true && this.inAcceptedState() === true) {
+          this.flushMessageBuffer();
+        }
+        if (this.flushMessageBufferSetInterval !== undefined && this.messageBuffer.size === 0) {
+          clearInterval(this.flushMessageBufferSetInterval);
+          delete this.flushMessageBufferSetInterval;
+        }
+      }, Constants.DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL);
+    }
   }
 
   public openWSConnection(
@@ -1004,31 +974,6 @@ export class ChargingStation extends EventEmitter {
     return false;
   }
 
-  private startReservationExpirationSetInterval(customInterval?: number): void {
-    const interval = customInterval ?? Constants.DEFAULT_RESERVATION_EXPIRATION_INTERVAL;
-    if (interval > 0) {
-      logger.info(
-        `${this.logPrefix()} Reservation expiration date checks started every ${formatDurationMilliSeconds(
-          interval,
-        )}`,
-      );
-      this.reservationExpirationSetInterval = setInterval((): void => {
-        removeExpiredReservations(this).catch(Constants.EMPTY_FUNCTION);
-      }, interval);
-    }
-  }
-
-  private stopReservationExpirationSetInterval(): void {
-    if (!isNullOrUndefined(this.reservationExpirationSetInterval)) {
-      clearInterval(this.reservationExpirationSetInterval);
-    }
-  }
-
-  // private restartReservationExpiryDateSetInterval(): void {
-  //   this.stopReservationExpirationSetInterval();
-  //   this.startReservationExpirationSetInterval();
-  // }
-
   private getNumberOfReservableConnectors(): number {
     let numberOfReservableConnectors = 0;
     if (this.hasEvses) {
@@ -1161,9 +1106,11 @@ export class ChargingStation extends EventEmitter {
     return stationInfo;
   }
 
-  private getStationInfoFromFile(): ChargingStationInfo | undefined {
+  private getStationInfoFromFile(
+    stationInfoPersistentConfiguration = true,
+  ): ChargingStationInfo | undefined {
     let stationInfo: ChargingStationInfo | undefined;
-    if (this.stationInfo?.stationInfoPersistentConfiguration === true) {
+    if (stationInfoPersistentConfiguration === true) {
       stationInfo = this.getConfigurationFromFile()?.stationInfo;
       if (stationInfo) {
         delete stationInfo?.infoHash;
@@ -1173,13 +1120,38 @@ export class ChargingStation extends EventEmitter {
   }
 
   private getStationInfo(): ChargingStationInfo {
+    const defaultStationInfo: Partial<ChargingStationInfo> = {
+      enableStatistics: false,
+      remoteAuthorization: true,
+      currentOutType: CurrentType.AC,
+      mainVoltageMeterValues: true,
+      phaseLineToLineVoltageMeterValues: false,
+      customValueLimitationMeterValues: true,
+      ocppStrictCompliance: true,
+      outOfOrderEndMeterValues: false,
+      beginEndMeterValues: false,
+      meteringPerTransaction: true,
+      transactionDataMeterValues: false,
+      supervisionUrlOcppConfiguration: false,
+      supervisionUrlOcppKey: VendorParametersKey.ConnectionUrl,
+      ocppVersion: OCPPVersion.VERSION_16,
+      ocppPersistentConfiguration: true,
+      stationInfoPersistentConfiguration: true,
+      automaticTransactionGeneratorPersistentConfiguration: true,
+      autoReconnectMaxRetries: -1,
+      registrationMaxRetries: -1,
+      reconnectExponentialDelay: false,
+      stopTransactionsOnStopped: true,
+    };
     const stationInfoFromTemplate: ChargingStationInfo = this.getStationInfoFromTemplate();
-    const stationInfoFromFile: ChargingStationInfo | undefined = this.getStationInfoFromFile();
+    const stationInfoFromFile: ChargingStationInfo | undefined = this.getStationInfoFromFile(
+      stationInfoFromTemplate?.stationInfoPersistentConfiguration,
+    );
     // Priority:
     // 1. charging station info from template
     // 2. charging station info from configuration file
     if (stationInfoFromFile?.templateHash === stationInfoFromTemplate.templateHash) {
-      return stationInfoFromFile!;
+      return { ...defaultStationInfo, ...stationInfoFromFile! };
     }
     stationInfoFromFile &&
       propagateSerialNumber(
@@ -1187,7 +1159,7 @@ export class ChargingStation extends EventEmitter {
         stationInfoFromFile,
         stationInfoFromTemplate,
       );
-    return stationInfoFromTemplate;
+    return { ...defaultStationInfo, ...stationInfoFromTemplate };
   }
 
   private saveStationInfo(): void {
@@ -1219,7 +1191,7 @@ export class ChargingStation extends EventEmitter {
     } else {
       this.initializeConnectorsOrEvsesFromTemplate(stationTemplate);
     }
-    this.internalStationInfo = this.getStationInfo();
+    this.stationInfo = this.getStationInfo();
     if (
       this.stationInfo.firmwareStatus === FirmwareStatus.Installing &&
       isNotEmptyString(this.stationInfo.firmwareVersion) &&
@@ -1642,9 +1614,9 @@ export class ChargingStation extends EventEmitter {
         }
         if (
           this.stationInfo?.ocppPersistentConfiguration === true &&
-          this.ocppConfiguration?.configurationKey
+          Array.isArray(this.ocppConfiguration?.configurationKey)
         ) {
-          configurationData.configurationKey = this.ocppConfiguration.configurationKey;
+          configurationData.configurationKey = this.ocppConfiguration?.configurationKey;
         } else {
           delete configurationData.configurationKey;
         }
@@ -1732,7 +1704,7 @@ export class ChargingStation extends EventEmitter {
 
   private getOcppConfigurationFromFile(): ChargingStationOcppConfiguration | undefined {
     const configurationKey = this.getConfigurationFromFile()?.configurationKey;
-    if (this.stationInfo?.ocppPersistentConfiguration === true && configurationKey) {
+    if (this.stationInfo?.ocppPersistentConfiguration === true && Array.isArray(configurationKey)) {
       return { configurationKey };
     }
     return undefined;
@@ -2058,8 +2030,8 @@ export class ChargingStation extends EventEmitter {
     return powerDivider;
   }
 
-  private getMaximumAmperage(stationInfo: ChargingStationInfo): number | undefined {
-    const maximumPower = this.getMaximumPower(stationInfo);
+  private getMaximumAmperage(stationInfo?: ChargingStationInfo): number | undefined {
+    const maximumPower = (stationInfo ?? this.stationInfo).maximumPower!;
     switch (this.getCurrentOutType(stationInfo)) {
       case CurrentType.AC:
         return ACElectricUtils.amperagePerPhaseFromPower(
@@ -2072,10 +2044,6 @@ export class ChargingStation extends EventEmitter {
     }
   }
 
-  private getMaximumPower(stationInfo?: ChargingStationInfo): number {
-    return (stationInfo ?? this.stationInfo).maximumPower!;
-  }
-
   private getCurrentOutType(stationInfo?: ChargingStationInfo): CurrentType {
     return (stationInfo ?? this.stationInfo).currentOutType ?? CurrentType.AC;
   }
@@ -2140,7 +2108,7 @@ export class ChargingStation extends EventEmitter {
         }
       }
     }
-    if (this.stationInfo?.firmwareStatus === FirmwareStatus.Installing) {
+    if (this.stationInfo.firmwareStatus === FirmwareStatus.Installing) {
       await this.ocppRequestService.requestHandler<
         FirmwareStatusNotificationRequest,
         FirmwareStatusNotificationResponse
@@ -2220,7 +2188,7 @@ export class ChargingStation extends EventEmitter {
             getConfigurationKey(this, StandardParametersKey.WebSocketPingInterval)?.value,
           )
         : 0;
-    if (webSocketPingInterval > 0 && !this.webSocketPingSetInterval) {
+    if (webSocketPingInterval > 0 && this.webSocketPingSetInterval === undefined) {
       this.webSocketPingSetInterval = setInterval(() => {
         if (this.isWebSocketConnectionOpened() === true) {
           this.wsConnection?.ping();
@@ -2231,7 +2199,7 @@ export class ChargingStation extends EventEmitter {
           webSocketPingInterval,
         )}`,
       );
-    } else if (this.webSocketPingSetInterval) {
+    } else if (this.webSocketPingSetInterval !== undefined) {
       logger.info(
         `${this.logPrefix()} WebSocket ping already started every ${formatDurationSeconds(
           webSocketPingInterval,
@@ -2245,7 +2213,7 @@ export class ChargingStation extends EventEmitter {
   }
 
   private stopWebSocketPing(): void {
-    if (this.webSocketPingSetInterval) {
+    if (this.webSocketPingSetInterval !== undefined) {
       clearInterval(this.webSocketPingSetInterval);
       delete this.webSocketPingSetInterval;
     }
index 2c90e1a374df1bcc6ee5bf88a2f3f53a4ffa4bec..b9a75e5f943388b33b07be80e1654e47acf6cb3c 100644 (file)
@@ -478,7 +478,7 @@ export abstract class OCPPRequestService {
     }
     throw new OCPPError(
       ErrorType.SECURITY_ERROR,
-      `Cannot send command ${commandName} PDU when the charging station is in ${chargingStation.getRegistrationStatus()} state on the central server`,
+      `Cannot send command ${commandName} PDU when the charging station is in ${chargingStation?.bootNotificationResponse?.status} state on the central server`,
       commandName,
     );
   }
index 966fd83af261c12ecc44c4e907203bf7829f837b..a17b56a8b644b938c29a0f9eef68cfd1d53b1458 100644 (file)
@@ -56,7 +56,7 @@ export class Constants {
     /* This is intentional */
   });
 
-  static readonly DEFAULT_RESERVATION_EXPIRATION_INTERVAL = 60000; // Ms
+  static readonly DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL = 60000; // Ms
 
   private constructor() {
     // This is intentional
index 45418353adca329d7836d37db01fd76aebbe24b2..4bd84c5abed6be81eeb61248b2275d519773b3d7 100644 (file)
@@ -14,6 +14,21 @@ export type ChargingStationData = {
   automaticTransactionGenerator?: Status[];
 };
 
+export enum OCPP16FirmwareStatus {
+  Downloaded = 'Downloaded',
+  DownloadFailed = 'DownloadFailed',
+  Downloading = 'Downloading',
+  Idle = 'Idle',
+  InstallationFailed = 'InstallationFailed',
+  Installing = 'Installing',
+  Installed = 'Installed',
+}
+
+export const FirmwareStatus = {
+  ...OCPP16FirmwareStatus,
+} as const;
+export type FirmwareStatus = OCPP16FirmwareStatus;
+
 export type ChargingStationInfo = {
   hashId: string;
   chargingStationId?: string;
@@ -21,6 +36,7 @@ export type ChargingStationInfo = {
   chargePointVendor: string;
   firmwareVersionPattern?: string;
   firmwareVersion?: string;
+  firmwareStatus?: FirmwareStatus;
   numberOfConnectors?: number | number[];
   baseName: string;
   templateHash?: string;
@@ -189,14 +205,11 @@ export type EvseStatus = {
   connectors?: ConnectorStatus[];
 };
 
-export type AvailabilityType = OCPP16AvailabilityType;
-
 export enum OCPP16AvailabilityType {
   INOPERATIVE = 'Inoperative',
   OPERATIVE = 'Operative',
 }
-
-export type ChargePointStatus = OCPP16ChargePointStatus;
+export type AvailabilityType = OCPP16AvailabilityType;
 
 export enum OCPP16ChargePointStatus {
   AVAILABLE = 'Available',
@@ -210,6 +223,7 @@ export enum OCPP16ChargePointStatus {
   UNAVAILABLE = 'Unavailable',
   FAULTED = 'Faulted',
 }
+export type ChargePointStatus = OCPP16ChargePointStatus;
 
 export type Status = {
   start?: boolean;