From b25b86842dc61b2a95f672dcf38992f7d63d6ec3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 23 Dec 2022 21:50:05 +0100 Subject: [PATCH] Apply dependencies update MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- package-lock.json | 14 +++++++------- package.json | 2 +- .../abb-atg.station-template.json | 1 + .../station-templates/abb.station-template.json | 1 + .../station-templates/evlink.station-template.json | 1 + .../schneider-imredd.station-template.json | 1 + .../schneider.station-template.json | 1 + src/charging-station/ChargingStation.ts | 13 +++++++++++++ src/types/ChargingStationTemplate.ts | 12 ++++++++++++ src/utils/Constants.ts | 4 ++++ ui/web/src/types/ChargingStationType.ts | 1 + 11 files changed, 43 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f1ebea9..6f3c1b5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -65,7 +65,7 @@ "prettier": "^2.8.1", "release-it": "^15.5.1", "robohydra": "^0.6.9", - "rollup": "^3.8.0", + "rollup": "^3.8.1", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-delete": "^2.0.0", @@ -14335,9 +14335,9 @@ } }, "node_modules/rollup": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.8.0.tgz", - "integrity": "sha512-+UR6PnUslneJNiJfLSzy4XH6R50ZGF0MS7UCv20ftXrktF/TkvZDwiBtXX65esblLR5p8w6LmXgPwt2f2B8SoQ==", + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.8.1.tgz", + "integrity": "sha512-4yh9eMW7byOroYcN8DlF9P/2jCpu6txVIHjEqquQVSx7DI0RgyCCN3tjrcy4ra6yVtV336aLBB3v2AarYAxePQ==", "dev": true, "bin": { "rollup": "dist/bin/rollup" @@ -28574,9 +28574,9 @@ } }, "rollup": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.8.0.tgz", - "integrity": "sha512-+UR6PnUslneJNiJfLSzy4XH6R50ZGF0MS7UCv20ftXrktF/TkvZDwiBtXX65esblLR5p8w6LmXgPwt2f2B8SoQ==", + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.8.1.tgz", + "integrity": "sha512-4yh9eMW7byOroYcN8DlF9P/2jCpu6txVIHjEqquQVSx7DI0RgyCCN3tjrcy4ra6yVtV336aLBB3v2AarYAxePQ==", "dev": true, "requires": { "fsevents": "~2.3.2" diff --git a/package.json b/package.json index 43204820..ed1bf832 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "prettier": "^2.8.1", "release-it": "^15.5.1", "robohydra": "^0.6.9", - "rollup": "^3.8.0", + "rollup": "^3.8.1", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-delete": "^2.0.0", diff --git a/src/assets/station-templates/abb-atg.station-template.json b/src/assets/station-templates/abb-atg.station-template.json index 8deb8d6f..cda5806e 100644 --- a/src/assets/station-templates/abb-atg.station-template.json +++ b/src/assets/station-templates/abb-atg.station-template.json @@ -3,6 +3,7 @@ "baseName": "CS-ABB", "chargePointModel": "MD_TERRA_53", "chargePointVendor": "ABB", + "firmwareVersionPattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$", "firmwareVersion": "4.0.4.22", "power": 50000, "powerSharedByConnectors": true, diff --git a/src/assets/station-templates/abb.station-template.json b/src/assets/station-templates/abb.station-template.json index 81f2d099..2aef581a 100644 --- a/src/assets/station-templates/abb.station-template.json +++ b/src/assets/station-templates/abb.station-template.json @@ -3,6 +3,7 @@ "baseName": "CS-ABB", "chargePointModel": "MD_TERRA_53", "chargePointVendor": "ABB", + "firmwareVersionPattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$", "firmwareVersion": "4.0.4.22", "power": 50000, "powerSharedByConnectors": true, diff --git a/src/assets/station-templates/evlink.station-template.json b/src/assets/station-templates/evlink.station-template.json index fbaa37e1..307db670 100644 --- a/src/assets/station-templates/evlink.station-template.json +++ b/src/assets/station-templates/evlink.station-template.json @@ -6,6 +6,7 @@ "chargePointModel": "MONOBLOCK", "chargePointVendor": "Schneider Electric", "chargeBoxSerialNumberPrefix": "EV.2S7P04", + "firmwareVersionPattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$", "firmwareVersion": "3.3.0.10", "power": 7360, "powerUnit": "W", diff --git a/src/assets/station-templates/schneider-imredd.station-template.json b/src/assets/station-templates/schneider-imredd.station-template.json index 63ee8c01..18c6ea47 100644 --- a/src/assets/station-templates/schneider-imredd.station-template.json +++ b/src/assets/station-templates/schneider-imredd.station-template.json @@ -6,6 +6,7 @@ "chargePointModel": "MONOBLOCK", "chargePointVendor": "Schneider Electric", "chargeBoxSerialNumberPrefix": "EV.2S22P04", + "firmwareVersionPattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$", "firmwareVersion": "3.3.0.10", "power": 22080, "powerUnit": "W", diff --git a/src/assets/station-templates/schneider.station-template.json b/src/assets/station-templates/schneider.station-template.json index 2482a439..65f7f304 100644 --- a/src/assets/station-templates/schneider.station-template.json +++ b/src/assets/station-templates/schneider.station-template.json @@ -6,6 +6,7 @@ "chargePointModel": "MONOBLOCK", "chargePointVendor": "Schneider Electric", "chargeBoxSerialNumberPrefix": "EV.2S22P44", + "firmwareVersionPattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$", "firmwareVersion": "3.3.0.10", "power": 44160, "powerUnit": "W", diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index f7cad5db..01e34060 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -818,6 +818,19 @@ export default class ChargingStation { 'supervisionUrl', 'supervisionUrls' ); + const firmwareVersionRegExp = stationTemplate.firmwareVersionPattern + ? new RegExp(stationTemplate.firmwareVersionPattern) + : Constants.SEMVER_REGEXP; + if ( + stationTemplate.firmwareVersion && + firmwareVersionRegExp.test(stationTemplate.firmwareVersion) === false + ) { + logger.warn( + `${this.logPrefix()} Firmware version '${ + stationTemplate.firmwareVersion + }' does not match regular expression '${firmwareVersionRegExp.toString()}'` + ); + } const stationInfo: ChargingStationInfo = ChargingStationUtils.stationTemplateToStationInfo(stationTemplate); stationInfo.hashId = ChargingStationUtils.getHashId(this.index, stationTemplate); diff --git a/src/types/ChargingStationTemplate.ts b/src/types/ChargingStationTemplate.ts index 3945e892..cd92616c 100644 --- a/src/types/ChargingStationTemplate.ts +++ b/src/types/ChargingStationTemplate.ts @@ -35,6 +35,16 @@ export enum Voltage { export type WsOptions = ClientOptions & ClientRequestArgs; +type FirmwareUpgrade = { + versionUpgrade: { + patternGroup?: number | number[]; + to?: string; + }; + reset?: boolean; + resetDelay?: number; + checkIntegrity?: boolean; +}; + type CommandsSupport = { incomingCommands: Record; outgoingCommands?: Record; @@ -61,7 +71,9 @@ export type ChargingStationTemplate = { chargePointVendor: string; chargePointSerialNumberPrefix?: string; chargeBoxSerialNumberPrefix?: string; + firmwareVersionPattern?: string; firmwareVersion?: string; + firmwareUpgrade?: FirmwareUpgrade; iccid?: string; imsi?: string; meterSerialNumberPrefix?: string; diff --git a/src/utils/Constants.ts b/src/utils/Constants.ts index 74b88834..ee9d96d9 100644 --- a/src/utils/Constants.ts +++ b/src/utils/Constants.ts @@ -95,6 +95,10 @@ export default class Constants { static readonly CHARGING_STATION_ATG_INITIALIZATION_TIME = 1000; // Ms static readonly CHARGING_STATION_ATG_DEFAULT_STOP_AFTER_HOURS = 0.25; // Hours + // See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string + static readonly SEMVER_REGEXP = + /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; + static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY = Number.MAX_SAFE_INTEGER; static readonly DEFAULT_HASH_ALGORITHM = 'sha384'; diff --git a/ui/web/src/types/ChargingStationType.ts b/ui/web/src/types/ChargingStationType.ts index ae049bd0..3aa76983 100644 --- a/ui/web/src/types/ChargingStationType.ts +++ b/ui/web/src/types/ChargingStationType.ts @@ -18,6 +18,7 @@ export type ChargingStationInfo = { chargingStationId?: string; chargePointModel: string; chargePointVendor: string; + firmwareVersionPattern?: string; firmwareVersion?: string; numberOfConnectors?: number | number[]; baseName: string; -- 2.34.1