From ab3fd769d5122f1a265c806d0ed0bbef1b72f8f7 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Wed, 9 Dec 2020 19:51:16 +0100 Subject: [PATCH] Allow to use IKEA TRADFRI OTA test server. https://github.com/Koenkk/zigbee2mqtt/issues/2921 --- lib/extension/otaUpdate.js | 5 +++++ test/otaUpdate.test.js | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/extension/otaUpdate.js b/lib/extension/otaUpdate.js index e6f3ec022..542496afc 100644 --- a/lib/extension/otaUpdate.js +++ b/lib/extension/otaUpdate.js @@ -3,6 +3,7 @@ const logger = require('../util/logger'); const stringify = require('json-stable-stringify-without-jsonify'); const utils = require('../util/utils'); const legacyTopicRegex = new RegExp(`^${settings.get().mqtt.base_topic}/bridge/ota_update/.+$`); +const tradfriOTA = require('zigbee-herdsman-converters/ota/tradfri'); const topicRegex = new RegExp(`^${settings.get().mqtt.base_topic}/bridge/request/device/ota_update/(update|check)`, 'i'); @@ -15,6 +16,10 @@ class OTAUpdate extends Extension { this.inProgress = new Set(); this.lastChecked = {}; this.legacyApi = settings.get().advanced.legacy_api; + + if (settings.get().advanced.ikea_ota_use_test_url) { + tradfriOTA.useTestURL(); + } } onMQTTConnected() { diff --git a/test/otaUpdate.test.js b/test/otaUpdate.test.js index 5d54d30ba..b553c1a44 100644 --- a/test/otaUpdate.test.js +++ b/test/otaUpdate.test.js @@ -19,6 +19,7 @@ describe('OTA update', () => { beforeEach(async () => { data.writeDefaultConfiguration(); settings._reRead(); + settings.set(['advanced', 'ikea_ota_use_test_url'], true); data.writeEmptyState(); controller = new Controller(); await controller.start();