Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Node removal #503

Merged
merged 4 commits into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions matter_server/server/device_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,18 +587,21 @@ async def remove_node(self, node_id: int) -> None:
Clusters.OperationalCredentials.Attributes.CurrentFabricIndex,
)
fabric_index = node.attributes[attribute_path]

result: Clusters.OperationalCredentials.Commands.NOCResponse = (
await self.chip_controller.SendCommand(
result: Clusters.OperationalCredentials.Commands.NOCResponse | None = None
try:
result = await self.chip_controller.SendCommand(
nodeid=node_id,
endpoint=0,
payload=Clusters.OperationalCredentials.Commands.RemoveFabric(
fabricIndex=fabric_index,
),
)
)
except ChipStackError as err:
LOGGER.warning("Removing current fabric from device failed.", exc_info=err)
return
if (
result.statusCode
result is None
or result.statusCode
== Clusters.OperationalCredentials.Enums.NodeOperationalCertStatusEnum.kOk
):
LOGGER.info("Successfully removed Home Assistant fabric from device.")
Expand Down