Contents

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  @Sendable ([HMAccessory]?, (any Error)?) -> Void)
func addAndSetUpAccessories(payload: HMAccessorySetupPayload) async throws -> [HMAccessory]

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.

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

Topics

Defining the Setup Payload

See Also

Managing accessories