I have a problem while adding a new accessory to the home kit. When I call below metho then it gives me error or success. But I want an accessory object when it is successfully onboarded. So, Is there any way to get the accessory object which is successfully added via the below method?
Right now, I have found only this method. Another via payload method is deprecated from iOS15. If there is any other method then this also you can suggest me. But I need a method for setup and adding accessories that opened the default view of the home kit.
fun addAccessory() {
home.addAndSetupAccessories { error in
if let error = error {
print("error")
}
else {
print("success added")
}
}
}```