@@ -750,41 +750,10 @@ async def remove_node(self, node_id: int) -> None:
750
750
if node is None or node_id >= TEST_NODE_START :
751
751
return
752
752
753
- attribute_path = create_attribute_path_from_attribute (
754
- 0 ,
755
- Clusters .OperationalCredentials .Attributes .CurrentFabricIndex ,
756
- )
757
- fabric_index = node .attributes .get (attribute_path )
758
- if fabric_index is None :
759
- return
760
- result : Clusters .OperationalCredentials .Commands .NOCResponse | None = None
761
753
try :
762
- result = await self ._chip_device_controller .send_command (
763
- node_id = node_id ,
764
- endpoint_id = 0 ,
765
- command = Clusters .OperationalCredentials .Commands .RemoveFabric (
766
- fabricIndex = fabric_index ,
767
- ),
768
- )
754
+ await self ._chip_device_controller .unpair_device (node_id )
769
755
except ChipStackError as err :
770
- LOGGER .warning (
771
- "Removing current fabric from device failed: %s" ,
772
- str (err ) or err .__class__ .__name__ ,
773
- # only log stacktrace if we have verbose logging enabled
774
- exc_info = err if LOGGER .isEnabledFor (VERBOSE_LOG_LEVEL ) else None ,
775
- )
776
- return
777
- if (
778
- result is None
779
- or result .statusCode
780
- == Clusters .OperationalCredentials .Enums .NodeOperationalCertStatusEnum .kOk
781
- ):
782
- LOGGER .info ("Successfully removed Home Assistant fabric from device." )
783
- else :
784
- LOGGER .warning (
785
- "Removing current fabric from device failed with status code %d." ,
786
- result .statusCode ,
787
- )
756
+ LOGGER .warning ("Removing current fabric from device failed: %s" , err )
788
757
789
758
@api_command (APICommand .PING_NODE )
790
759
async def ping_node (self , node_id : int , attempts : int = 1 ) -> NodePingResult :
0 commit comments