feat(discovery): surface corrupt modules as a Repairs message (reprogram)#460
Merged
Conversation
…ram) Companion to nikobus-connect 0.27.2 (corrupt link-table detection). When the library flags a module's link table as corrupt (misaligned with the scanned register window — decode skipped, no phantom buttons), the integration now tells the USER about it instead of silently dropping those links. - _surface_corrupt_modules() reads nikobus_discovery.corrupt_link_tables after a module scan (register decode) and creates/clears a Repairs issue listing the affected modules. is_fixable=False — the cure is reprogramming in the Nikobus PC software, nothing HA can do — so it's an informational warning with clear guidance, no fix flow. Auto-clears on the next module scan once the module reads cleanly. Gated to module scans (not pure PC-Link inventory) so an inventory-only run can't clear a still-valid warning. Also logged at WARNING. - ISSUE_CORRUPT_MODULES constant; en/fr/nl issue translations. Policy (per maintainer): we do NOT try to recover buttons from a corrupt module — detect, warn the user, wait for reprogramming. Tests: +3 (creates informational issue with sorted module list; clears when none; tolerates an older library without the attribute). 449 passed, ruff clean, mypy 101 (baseline 100; the +1 is the same documented NikobusConfigEntry-alias 'entry_id' artifact as the sibling _surface_legacy_undecoded_buttons, not a new issue). https://claude.ai/code/session_01LH7yGDY8ttvZUVMVjfSNXj
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.
Summary
Companion to nikobus-connect #121 (which I pivoted per your call: detect a corrupt module link table and skip it — no re-alignment, no phantom buttons). This is the HA side: the user-facing message.
When the library flags a module's link table as corrupt (misaligned with the scanned register window — decode skipped), the integration now surfaces it as a Repairs issue instead of silently dropping those links:
_surface_corrupt_modules()readsnikobus_discovery.corrupt_link_tablesafter a module scan and creates/clears a Repairs issue listing the affected modules.is_fixable=False— the cure is reprogramming in the Nikobus PC software, nothing HA can do — so it's an informational warning with clear guidance (en/fr/nl), no fix flow. Also logged at WARNING.The message (en): "N Nikobus module(s) reported a corrupt link table and were skipped… This is a module-side issue — the Nikobus PC software reports the same and asks for reprogramming. Reprogram the listed module(s), then run Load Existing Installation again."
Policy
Per your decision: detect → tell the user → wait for reprogramming. We do not try to find buttons on a corrupt module. This matches exactly what your 4707 case proved — reprogramming was the real and complete cure.
Verification
449 passed(+3: creates informational issue with sorted module list; clears when none; tolerates an older library without the attribute),ruffclean,mypy101 (baseline 100; the +1 is the same documentedNikobusConfigEntry-aliasentry_idartifact as the sibling_surface_legacy_undecoded_buttons, not a new issue).Gating
Needs nikobus-connect 0.27.2 (the
corrupt_link_tablesattribute). The HA pin is already>=0.27.0, and the code usesgetattr(..., None)so it degrades gracefully on 0.27.0/0.27.1 (no flag → no issue). Merge order: publish lib 0.27.2 (#121) → this is safe to merge anytime.https://claude.ai/code/session_01LH7yGDY8ttvZUVMVjfSNXj
Generated by Claude Code