Two small fixes: OTA update-check guard (undefined definition) + permitJoin countdown reset on close - #2974
Open
krobipd wants to merge 2 commits into
Open
Conversation
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small, independent fixes, each triggered by a real event on a production
embercoordinator (EmberZNet 8.0.2). Both are one-line changes;eslintpasses. No test scenarios added (small changes) — the production logs below are the "seen it happen".They surfaced on the same instance but are unrelated (different subsystems) — happy to split into two PRs if you'd rather.
1.
fix(pairing)— permitJoin countdown not reset on closeSymptom (same session, ~16 min apart):
Opening the network a second time logs "Extending open network" although the previous window had already timed out and closed — the adapter still considers a pairing window active long after the radio closed.
Cause: in
handlePermitJoinChanged, the timeout-close branch clears the countdown interval but never resets_permitJoinTime(it is left at ~1 — the value shown in "1 second remaining").permitJoin()then treats_permitJoinTime > 0as an already-open window and logs "Extending …" instead of "Opening …". The manual stop path (permitJoin(0)) already resets it; only the timeout path did not.Fix: reset
_permitJoinTime = 0when the network closes.2.
fix(ota)— update-availability check throws for devices without a definitionSymptom (repeats every OTA cycle for un-interviewed devices):
A device that never completed interview has no resolved definition (
entity.mappedis undefined).lib/ota.jsaccessedentity.mapped.otadirectly, so the check throws and is logged as a misleading "Failed to check if update available" warning.Cause / consistency: that line was the only
entity.mapped.*access in the function not using optional chaining — the four adjacent accesses already useentity?.mapped?.model.Fix:
entity?.mapped?.ota. Such devices now take the existingnot_supportedbranch (which already logs a clean debug line with the id), and thewarnis reserved for genuine check failures (device didn't respond).Found on
ember; neither change is stack-specific (both are adapter-side JS).