<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HomeKit",
  "identifier" : "/documentation/HomeKit/HMHome/addAccessory(_:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HomeKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HMHome(im)addAccessory:completionHandler:"
  },
  "title" : "addAccessory(_:completionHandler:)"
}
-->

# addAccessory(_:completionHandler:)

Adds a new accessory to the home.

```
func addAccessory(_ accessory: HMAccessory, completionHandler completion: @escaping @Sendable ((any Error)?) -> Void)
```

## Parameters

`accessory`

The accessory to add to the home.

`completion`

The block executed after the request is processed.

- error: `nil` on success; otherwise, error object indicating the reason for failure.

## Discussion

You discover accessories to add to a home using the [`HMAccessoryBrowser`](/documentation/HomeKit/HMAccessoryBrowser) class. Newly added accessories are automatically added to the room returned by [`roomForEntireHome()`](/documentation/HomeKit/HMHome/roomForEntireHome()).

> Important:
> To provide a consistent user experience, use the ``doc://com.apple.homekit/documentation/HomeKit/HMHome/addAndSetupAccessories(completionHandler:)`` method instead.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)