Skip to content

Commit

Permalink
Fix Node removal (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Jan 16, 2024
1 parent e050981 commit 2a29297
Showing 1 changed file with 8 additions and 5 deletions.
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

0 comments on commit 2a29297

Please sign in to comment.