diff --git a/examples/chip-tool/commands/clusters/ModelCommand.cpp b/examples/chip-tool/commands/clusters/ModelCommand.cpp index 768731260fcb56..fa24e0a526b3a4 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.cpp +++ b/examples/chip-tool/commands/clusters/ModelCommand.cpp @@ -38,8 +38,12 @@ CHIP_ERROR ModelCommand::RunCommand() if (mViaPase.ValueOr(0) == 1) { ChipLogProgress(chipTool, "Sending command via PASE to node 0x%" PRIx64, mNodeId); - CommissioneeDeviceProxy * device = CurrentCommissioner().FindCommissioneeDevice(mNodeId); - return this->SendCommand(device, this->mEndPointId); + CommissioneeDeviceProxy * commissioneeDevice = nullptr; + CHIP_ERROR err = CurrentCommissioner().GetDeviceBeingCommissioned(mNodeId, &commissioneeDevice); + VerifyOrReturnError(CHIP_NO_ERROR == err, err); + VerifyOrReturnError(commissioneeDevice != nullptr, CHIP_ERROR_NOT_CONNECTED); + + return this->SendCommand(commissioneeDevice, this->mEndPointId); } else { diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 1cff6bd7237fb4..c31f7fdfee8d5e 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -730,7 +730,6 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, void HandleAttestationResult(CHIP_ERROR err); -public: CommissioneeDeviceProxy * FindCommissioneeDevice(const SessionHandle & session); CommissioneeDeviceProxy * FindCommissioneeDevice(NodeId id); CommissioneeDeviceProxy * FindCommissioneeDevice(const Transport::PeerAddress & peerAddress);