diff --git a/matter_server/server/device_controller.py b/matter_server/server/device_controller.py index 623e9971..05fdddf9 100644 --- a/matter_server/server/device_controller.py +++ b/matter_server/server/device_controller.py @@ -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.")