From 08a964a6ec10e8b9c87799f42421ab180f6c9c12 Mon Sep 17 00:00:00 2001 From: Johannes Krobath Date: Mon, 10 Aug 2026 22:48:37 +0200 Subject: [PATCH 1/2] fix(pairing): reset permitJoin countdown on network close On a pairing-window timeout, handlePermitJoinChanged clears the countdown interval but left _permitJoinTime at its last value (~1). A later permitJoin() then logs "Extending open network" instead of "Opening network", because it treats _permitJoinTime > 0 as a still-active window - so the adapter's pairing state stays "open" long after the radio has closed. Reset _permitJoinTime to 0 on close so the internal state matches the (correctly closed) radio state. Co-Authored-By: Claude Opus 4.8 --- lib/zigbeecontroller.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/zigbeecontroller.js b/lib/zigbeecontroller.js index 230d1b6e..5a476bef 100644 --- a/lib/zigbeecontroller.js +++ b/lib/zigbeecontroller.js @@ -993,6 +993,7 @@ class ZigbeeController extends EventEmitter { this.emit('pairing', `Closed network${timestr}`, 0); clearInterval(this._permitJoinInterval); this._permitJoinInterval = null; + this._permitJoinTime = 0; } } catch (error) { From 82b05290f83d9fc2232a4f5c3024367a93aead43 Mon Sep 17 00:00:00 2001 From: Johannes Krobath Date: Mon, 10 Aug 2026 22:48:37 +0200 Subject: [PATCH 2/2] fix(ota): guard undefined definition in update-availability check For a device without a resolved definition (e.g. one that never completed interview), entity.mapped is undefined, so entity.mapped.ota threw "Cannot read properties of undefined (reading 'ota')" - surfacing as a misleading "Failed to check if update available" warning on every OTA cycle. Use optional chaining (entity?.mapped?.ota), matching the four adjacent entity?.mapped?.model accesses in the same function. Such devices now take the existing not_supported path, and the warning is reserved for real check failures. Co-Authored-By: Claude Opus 4.8 --- lib/ota.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ota.js b/lib/ota.js index c247113f..43c01eea 100755 --- a/lib/ota.js +++ b/lib/ota.js @@ -284,7 +284,7 @@ class Ota { try { this.debug(`Checking if firmware update is available for '${devLabel(this.adapter, ieeeAddr, entity?.mapped?.model)}'`); - if (entity && entity.mapped.ota) { + if (entity?.mapped?.ota) { const available = await entity.device.checkOta({ downgrade:false }, undefined, typeof entity.mapped.ota === 'object' ? entity.mapped.ota : {}, undefined); result.status = available.available ? 'available' : 'not_available'; if (available.currentFileVersion !== available.otaFileVersion) {