diff --git a/examples/chip-tool/commands/pairing/PairingCommand.cpp b/examples/chip-tool/commands/pairing/PairingCommand.cpp index 20fa405af043ad..b8507afb96dc3d 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.cpp +++ b/examples/chip-tool/commands/pairing/PairingCommand.cpp @@ -36,8 +36,15 @@ CHIP_ERROR PairingCommand::RunCommand() { CHIP_ERROR err = CHIP_NO_ERROR; - mController.RegisterDeviceAddressUpdateDelegate(this); - mController.RegisterPairingDelegate(this); + // If we're OpenCommissioningWindow we don't need to be registered as a + // delegate; we just get notified directly via the callbacks we pass to + // GetConnectedDevice. In fact, if we _do_ register as a delegate we get + // callbacks we don't expect and then weird things happen. + if (mPairingMode != PairingMode::OpenCommissioningWindow) + { + mController.RegisterDeviceAddressUpdateDelegate(this); + mController.RegisterPairingDelegate(this); + } err = RunInternal(mNodeId); VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(chipTool, "Init Failure! PairDevice: %s", ErrorStr(err)));