Instance Method

addAndSetupAccessories(with:completionHandler:)

Finds and adds nearby accessories to the home using a HomeKit code provided by your app.

Declaration

func addAndSetupAccessories(with payload: HMAccessorySetupPayload, completionHandler completion: @escaping ([HMAccessory]?, Error?) -> Void)

Discussion

Use this method to add accessories that have already been deployed (for example, accessories that have HomeKit support added as a firmware update), or accessories for which scanning a QR code would be difficult. Your app provides the accessory’s HomeKit code using a setup payload. For details on the payload’s content, please join the MFi program (see MFi Program).

During this process, the user assigns the accessory to a room and configures its services.

Topics

Defining the Setup Payload

class HMAccessorySetupPayload

A payload for authenticating a HomeKit accessory.

See Also

Managing Accessories

var accessories: [HMAccessory]

The collection of accessories that are part of the home.

func addAndSetupAccessories(completionHandler: (Error?) -> Void)

Finds and adds nearby accessories to the home.

class HMAccessory

A home automation accessory, like a garage door opener or a thermostat.