Add support for local OTA firmware images (#10676)

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
This commit is contained in:
Oleksandr Masliuchenko
2022-01-09 20:38:58 +01:00
committed by GitHub
co-authored by Koen Kanters
parent 44ee2f5f2b
commit 6ac8a6237e
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -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);
}
}
+1 -1
View File
@@ -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;
}