From de4a7cecf2848f332f6646bbc24b51d469e5056a Mon Sep 17 00:00:00 2001 From: AlCalzone Date: Tue, 5 Nov 2024 14:53:57 +0100 Subject: [PATCH] feat: allow specifying RF region for OTA firmware updates if unknown (#7369) --- packages/zwave-js/src/lib/controller/Controller.ts | 3 ++- packages/zwave-js/src/lib/controller/_Types.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/zwave-js/src/lib/controller/Controller.ts b/packages/zwave-js/src/lib/controller/Controller.ts index e7b2bcdd6cac..dea03ea19a1c 100644 --- a/packages/zwave-js/src/lib/controller/Controller.ts +++ b/packages/zwave-js/src/lib/controller/Controller.ts @@ -8207,7 +8207,7 @@ export class ZWaveController productType, productId, firmwareVersion, - rfRegion: this.rfRegion, + rfRegion: this.rfRegion ?? options?.rfRegion, }, { userAgent: this.driver.getUserAgentStringWithComponents( @@ -8250,6 +8250,7 @@ export class ZWaveController ): Promise { if ( deviceId.rfRegion !== undefined + && this.rfRegion !== NOT_KNOWN && deviceId.rfRegion !== this.rfRegion ) { throw new ZWaveError( diff --git a/packages/zwave-js/src/lib/controller/_Types.ts b/packages/zwave-js/src/lib/controller/_Types.ts index 02f21a9e9f1a..ec53fb715242 100644 --- a/packages/zwave-js/src/lib/controller/_Types.ts +++ b/packages/zwave-js/src/lib/controller/_Types.ts @@ -52,6 +52,16 @@ export interface GetFirmwareUpdatesOptions { additionalUserAgentComponents?: Record; /** Whether the returned firmware upgrades should include prereleases from the `"beta"` channel. Default: `false`. */ includePrereleases?: boolean; + /** + * Can be used to specify the RF region if the Z-Wave controller + * does not support querying this information. + * + * **WARNING:** Specifying the wrong region may result in bricking the device! + * + * For this reason, the specified value is only used as a fallback + * if the RF region of the controller is not already known. + */ + rfRegion?: RFRegion; } export interface ControllerFirmwareUpdateProgress {