From 6ac8a6237efac489d792e715969ea658313969b7 Mon Sep 17 00:00:00 2001 From: Oleksandr Masliuchenko Date: Sun, 9 Jan 2022 21:38:58 +0200 Subject: [PATCH] Add support for local OTA firmware images (#10676) Co-authored-by: Koen Kanters --- lib/extension/otaUpdate.ts | 8 ++++++-- lib/types/zigbee-herdsman-converters.d.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/extension/otaUpdate.ts b/lib/extension/otaUpdate.ts index b3d7076e..3c9586c7 100644 --- a/lib/extension/otaUpdate.ts +++ b/lib/extension/otaUpdate.ts @@ -43,6 +43,7 @@ export default class OTAUpdate extends Extension { tradfriOTA.useTestURL(); } + // Let zigbeeOTA module know if the override index file is provided let overrideOTAIndex = settings.get().ota.zigbee_ota_override_index_location; if (overrideOTAIndex) { // If the file name is not a full path, then treat it as a relative to the data directory @@ -53,9 +54,12 @@ export default class OTAUpdate extends Extension { zigbeeOTA.useIndexOverride(overrideOTAIndex); } + // In order to support local firmware files we need to let zigbeeOTA know where the data directory is + zigbeeOTA.setDataDir(dataDir.getPath()); + + // In case Zigbee2MQTT is restared during an update, progress and remaining values are still in state. + // remove them. for (const device of this.zigbee.devices(false)) { - // In case Zigbee2MQTT is restared during an update, progress and remaining values are still in state. - // remove them. this.removeProgressAndRemainingFromState(device); } } diff --git a/lib/types/zigbee-herdsman-converters.d.ts b/lib/types/zigbee-herdsman-converters.d.ts index 74654ad1..0e54f23d 100644 --- a/lib/types/zigbee-herdsman-converters.d.ts +++ b/lib/types/zigbee-herdsman-converters.d.ts @@ -13,5 +13,5 @@ declare module 'zigbee-herdsman-converters/lib/ota/tradfri' { declare module 'zigbee-herdsman-converters/lib/ota/zigbeeOTA' { export function useIndexOverride(indexFileName: string): void; + export function setDataDir(dataDir: string): void; } -