Skip to content

feat: "Replace a Matter node…" keeps a re-paired device's Indigo devices (#364) - #365

Merged
simons-plugins merged 19 commits into
mainfrom
feat/364-replace-node
Oct 17, 2026
Merged

simons-plugins merged 19 commits into
mainfrom
feat/364-replace-node

Conversation

@simons-plugins

Copy link
Copy Markdown
Owner

Closes #364.

What

A new plugin menu item, "Replace a Matter node…". It points the Indigo devices of a dead node at the node a factory-reset device came back as, then deletes the new node's duplicate devices. The Indigo ids don't change, so schedules, triggers, zones, exports and history keep working. The wording follows Indigo's own Z-Wave "Replacing a Z-Wave Device" flow: "Indigo devices to keep:", "Sync using node:".

How

The plan is in docs/plans/issue-364-replace-node.md; delete it once #364 is resolved. Two ordering traps shape it:

  • Delete the duplicates first, rebind last. Rewriting a device's props restarts it, and the restart re-registers it in the index under the new node. An index-driven delete after the rebind would delete the rescued devices.
  • Pause device creation for the new node while it runs, so a node_updated arriving mid-operation can't rebuild the duplicates.

Commits by section:

  1. S1: pure planner (node_replace.py).
  2. S2: DeviceSync primitives. _delete_devices is extracted from delete_node, with per-delete index pruning, plus creation_suspended.
  3. S3: DeviceSync.replace_node.
  4. S4: menu mixin, MenuItems.xml, docs, version 2026.33.0.

Found during verification:

  • Stale self-deleted mark: _delete_devices could mark a node device it never deleted as self-deleted. That would have swallowed a later user deletion, so no tombstone. Fixed at the source, with a test.
  • Group siblings in getDependencies: checked live on node 67, getDependencies lists a grouped device's own group siblings under devices. Unhandled, every replacement would have been refused. Same-node siblings are now ignored, and any other dependent still refuses. Both cases are tested.

Testing

  • pytest: 4331 passed (77 new tests).
  • Not yet run on jarvis. Live check: run it for the coffee machine, old node 52 → new node 67. The new relay 1723499117 currently has no dependents beyond its group sibling, so it should go through.
  • Watch for: whether Indigo puts the first picker option into valuesDict without the user touching it. If not, Execute asks for a selection, which is harmless.

🤖 Generated with Claude Code

https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL

simons-plugins and others added 5 commits October 17, 2026 14:52
Plan in docs/plans/issue-364-replace-node.md; tests pin S1-S4 and
fail on the missing implementation until it lands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
Pairs old and new devices by (endpoint, type), orders the refusals,
builds the preview rows and the rebound props. No indigo import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
Extract _delete_devices from delete_node and prune the index per
delete; add node_device_refs, creation_suspended and node_unreachable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
… S3)

Duplicates are deleted first from ids captured up front, with device
creation for the new node suspended; the old devices are rebound last.
Carries a tombstone from the old node (D8).

_delete_devices now ignores a node_dev_id it was not asked to delete:
"replace anyway" keeps an unmatched new node device, and marking it
self-deleted would have swallowed the user's later deletion of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
Menu, pickers and preview list using Indigo's Z-Wave replace wording
("Indigo devices to keep:", "Sync using node:"), wired into Plugin,
with MATTER.md, CHANGELOG and ARCHITECTURE entries. PluginVersion
2026.33.0.

getDependencies lists a grouped device's own siblings under
"devices" (checked live on node 67), so same-node siblings are not
treated as references; any other dependent still refuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f03e9287-d1cb-43b4-b1e4-cac05bec11a4
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

simons-plugins and others added 14 commits October 17, 2026 15:10
…ld a duplicate set (#364)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
…nd previewed (#364)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
No node_removed fires when matter-server no longer has the node, so
delete_node(forget=True) clears the retirement itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
…ng moved (#364)

Round-2 review: a retirement that outlived its node unheard would give
a later commission on that id no devices at all. create_from_raw (the
commission path) now clears it. replace_node retires the old node only
when at least one device was rebound, and delete_node un-retires
outside the lock since forgetting persists to pluginPrefs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
…lace anyway" unless shapes differ (#364)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
… wording (#364)

The preview list takes the exportList layout (heading label + empty
list Label) so it is not squeezed into the control column; rows read
"Switch → 0x44". The old-node checkbox no longer claims removal
usually fails: it worked for node 0x34.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
…#364)

The empty-Label layout did not widen the list in Indigo 2025.2; the
list sits in the control column whatever the markup. Rows are kept
short enough to fit instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
Indigo sizes the label column to the longest Label; the sentence-long
checkbox labels were squeezing every control, the preview list
included, into a narrow strip on the right. Short labels, the
explanation in <Description>, and numbered grey step headings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
The code and tests cite D1-D13, so the decision table now lives in
repo-local ADR-0018 (with D8 and the retired-node rule D13 updated to
what shipped), and the working plan is deleted as planned. Also fixes
the refusal text still naming the old "replace anyway" checkbox.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LWBygcTdnKUprkHZd1kqL
@simons-plugins
simons-plugins merged commit 66dacdc into main Oct 17, 2026
7 checks passed
@simons-plugins
simons-plugins deleted the feat/364-replace-node branch October 17, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "Replace a Matter node…" so a re-paired device keeps its Indigo devices

1 participant