---
title: "controller(_:commissioningComplete:nodeID:metrics:context:)"
framework: matter
role: symbol
role_heading: Instance Method
path: "matter/mtrdevicecontrollerdelegate/controller(_:commissioningcomplete:nodeid:metrics:context:)"
---

# controller(_:commissioningComplete:nodeID:metrics:context:)

Notify the delegate when commissioning is completed.

## Declaration

```swift
optional func controller(_ controller: MTRDeviceController, commissioningComplete error: (any Error)?, nodeID: NSNumber?, metrics: MTRMetrics, context: [String : Any])
```

## Discussion

Discussion Exactly one of error and nodeID will be nil. If nodeID is not nil, then it represents the node id the node was assigned, as encoded in its operational certificate. The metrics object contains information corresponding to the commissioning session. The context parameter is a dictionary. See MTRCommissioningDelegate’s commissioning:succeededForNodeID:metrics:context for the supported keys. If supported, this selector will be used in preference to controller:commissioningComplete:nodeID: and controller:commissioningComplete:nodeID:metrics:.
