Class

HMAccessory

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

Declaration

@interface HMAccessory : NSObject

Overview

An HMAccessory instance represents a physical device, like a garage door opener, installed in a home and assigned to a room.

You don’t create accessories directly. Instead you get them from the accessories array of an HMHome instance when you want all the accessories in a home, or the accessories array of an HMRoom instance when you want all the accessories in a particular room. Each physical accessory in the home is represented by exactly one accessory instance, so that one instance appears in both a home and a room collection. This is because it’s simultaneously part of the home and in one of the home’s rooms.

When you want to add new accessories, you call the home’s addAndSetupAccessoriesWithCompletionHandler: method. In response, HomeKit presents the user with an interface that steps through the process of searching for new accessories in the physical environment, naming them, and assigning them to a room.

Accessories provide one or more services, represented by instances of HMService, that are the features that the user can control, like the light attached to a garage door opener, or the door opener mechanism itself.

Topics

Tracking Changes to an Accessory

delegate

A delegate that receives updates on the state of the accessory.

HMAccessoryDelegate

A set of methods that defines the communication method for state updates from accessories to their delegates.

Identifying an Accessory

name

The name of the accessory.

- updateName:completionHandler:

Changes the name of the accessory.

uniqueIdentifier

A unique identifier for the accessory.

identifier

A unique identifier for the accessory.

Deprecated

Categorizing an Accessory

category

The category to which the accessory belongs.

HMAccessoryCategory

A category for a HomeKit accessory.

Locating an Accessory

room

The room containing the accessory.

HMRoom

The smallest subdivision of a home’s space.

Managing Accessory Profiles

profiles

An array of profiles implemented by the accessory.

HMAccessoryProfile

A profile implemented by an accessory.

HMNetworkConfigurationProfile

A profile that provides information about network protection for an accessory.

Beta

Managing Camera Profiles

cameraProfiles

An array of camera profiles implemented by the accessory.

HMCameraProfile

A camera profile that interacts with an accessory's camera.

HMCameraView

The view into which a video stream or an image snapshot is rendered.

Getting Accessory State

reachable

A Boolean value indicating whether the accessory can be communicated with in the current network environment.

blocked

A Boolean value indicating whether the accessory is blocked.

Asking an Accessory to Identify Itself

supportsIdentify

A Boolean value that indicates whether the accessory supports the identify action.

- identifyWithCompletionHandler:

Asks an accessory to identify itself.

Controlling Accessory Features

services

An array of services provided by the accessory.

HMService

A controllable feature of an accessory, like a light attached to a garage door opener.

Managing Bridged Accessories

bridged

A Boolean that indicates whether the accessory is accessed through a bridge.

uniqueIdentifiersForBridgedAccessories

An array of unique identifiers, each of which represents an accessory vended by the bridge.

identifiersForBridgedAccessories

An array of identifiers for accessories available through a bridge.

Deprecated

Getting Manufacturer Information

firmwareVersion

The firmware version of the accessory.

manufacturer

The manufacturer of the accessory.

model

The model name of the accessory.

Browsing for Accessories

HMAccessoryBrowser

A network browser you can use to discover new accessories in a home.

Relationships

Inherits From

See Also

Accessories

Interacting with a Home Automation Network

Find all the automation accessories in the primary home and control their state.

HMService

A controllable feature of an accessory, like a light attached to a garage door opener.

HMCharacteristic

A specific characteristic of a service, like the brightness of a dimmable light, or its color temperature.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software