Class

HMHome

The primary unit of living space, typically composed of rooms organized into zones.

Declaration

@interface HMHome : NSObject

Overview

An HMHome instance is a top-level container in HomeKit representing a structure that a user considers as a single home. Users might have multiple homes that are far apart, like a primary home and a vacation home. Or they might have two homes that are close together, but that they consider as distinct units—for example, a main home and a guest cottage on the same property.

An HMHome instance:

  • Is the main access point for communicating with and configuring accessories, like a garage door opener or a thermostat.

  • Organizes accessories into a number of rooms, which are themselves optionally grouped into zones, such as the upstairs.

  • Allows the user to define sets of actions that can be performed with a single operation, and triggers that cause an action set to be performed at a specific time.

You create a new home only in response to a specific user request, but you don’t do it directly. When the user asks your app to create a new home—for example, by tapping an Add button in your interface—your app calls the home manager’s addHomeWithName:completionHandler: method with a name that the user supplies. To get a list of existing home instances, use the homes array of the home manager (an instance of HMHomeManager).

Because HomeKit gives your app access to a shared database of home automation information, other apps can change the home’s configuration. Adopt the HMHomeDelegate protocol in your app to stay informed of any such changes that happen outside your app.

Topics

Keeping Track of Home Configuration Changes

delegate

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

HMHomeDelegate

An interface that communicates changes to a home’s configuration.

Identifying a Home

name

The name the user gives to the home.

- updateName:completionHandler:

Updates the name of the home.

uniqueIdentifier

A unique identifier for the home.

primary

A Boolean value that indicates whether this is the primary home for its home manager.

Dividing a House into Rooms

rooms

An array of the rooms in the home.

- roomForEntireHome

A room that represents all parts of the home that don’t have a more specific room to represent them.

- addRoomWithName:completionHandler:

Creates a new room with the specified name.

- removeRoom:completionHandler:

Removes a room from the home.

HMRoom

The smallest subdivision of a home’s space.

Grouping Rooms into Zones

zones

An array of all the zones in the home.

- addZoneWithName:completionHandler:

Adds a new zone to the home.

- removeZone:completionHandler:

Removes a zone from the home.

HMZone

A collection of rooms that users think of as a single area, like upstairs or downstairs.

Managing Accessories

accessories

The collection of accessories that are part of the home.

- addAndSetupAccessoriesWithCompletionHandler:

Finds and adds nearby accessories to the home.

- addAndSetupAccessoriesWithPayload:completionHandler:

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

- addAccessory:completionHandler:

Adds a new accessory to the home.

- assignAccessory:toRoom:completionHandler:

Assigns an accessory to a different room.

- removeAccessory:completionHandler:

Removes an accessory from the home.

- unblockAccessory:completionHandler:

Unblocks a blocked accessory.

HMAccessory

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

Grouping Services

- servicesWithTypes:

Returns an array of all services provided by accessories in the home that match the specified types.

serviceGroups

An array of all service groups in the home.

- addServiceGroupWithName:completionHandler:

Adds a service group to the home.

- removeServiceGroup:completionHandler:

Removes a service group from the home.

HMServiceGroup

A collection of accessory services.

Querying the State of a Home Hub

homeHubState

The state of the home hub.

HMHomeHubState

The possible states of the home hub.

Creating Action Sets

actionSets

An array of the action sets in the home.

- addActionSetWithName:completionHandler:

Adds a new action set to the home.

- removeActionSet:completionHandler:

Removes an action set from the home.

- executeActionSet:completionHandler:

Executes all the actions in a specified action set.

- builtinActionSetOfType:

Retrieves the builtin action set for the specified type.

HMActionSet

A collection of actions that you trigger as a group.

Triggering an Action Set

triggers

An array of triggers defined in the home.

- addTrigger:completionHandler:

Adds a trigger to the home.

- removeTrigger:completionHandler:

Removes a trigger from the home.

HMTimerTrigger

A trigger to activate an action set based on a periodic timer.

HMEventTrigger

A trigger to activate an action set based on a set of events and optional conditions.

HMTrigger

An abstract base class for triggering actions based on a set of conditions.

Managing Users

- manageUsersWithCompletionHandler:

Presents a view controller to manage users of the home.

currentUser

The current HomeKit user.

HMUser

A person in the home who may have access to control accessories and services in the home.

Controlling User Access

- homeAccessControlForUser:

Retrieves the access level of a user associated with the home.

HMHomeAccessControl

The access privileges of a user associated with a home.

HMAccessControl

An abstract superclass for accessing user privileges.

HMUserFailedAccessoriesKey

The key for retrieving details of what accessories failed to add or remove a user.

Deprecated Symbols

users

All users associated with the home.

Deprecated
- addUserWithCompletionHandler:

Adds a user to the home.

Deprecated
- removeUser:completionHandler:

Removes a user from the home.

Deprecated

Instance Properties

Relationships

Inherits From

See Also

Working with the Home Layout

homes

An array of all homes managed by this home manager.