Skip to content

Commit 2a29297

Browse files
authored
Fix Node removal (#503)
1 parent e050981 commit 2a29297

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

matter_server/server/device_controller.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -587,18 +587,21 @@ async def remove_node(self, node_id: int) -> None:
587587
Clusters.OperationalCredentials.Attributes.CurrentFabricIndex,
588588
)
589589
fabric_index = node.attributes[attribute_path]
590-
591-
result: Clusters.OperationalCredentials.Commands.NOCResponse = (
592-
await self.chip_controller.SendCommand(
590+
result: Clusters.OperationalCredentials.Commands.NOCResponse | None = None
591+
try:
592+
result = await self.chip_controller.SendCommand(
593593
nodeid=node_id,
594594
endpoint=0,
595595
payload=Clusters.OperationalCredentials.Commands.RemoveFabric(
596596
fabricIndex=fabric_index,
597597
),
598598
)
599-
)
599+
except ChipStackError as err:
600+
LOGGER.warning("Removing current fabric from device failed.", exc_info=err)
601+
return
600602
if (
601-
result.statusCode
603+
result is None
604+
or result.statusCode
602605
== Clusters.OperationalCredentials.Enums.NodeOperationalCertStatusEnum.kOk
603606
):
604607
LOGGER.info("Successfully removed Home Assistant fabric from device.")

0 commit comments

Comments
 (0)