HMHome
The primary unit of living space, typically composed of rooms organized into zones.
Declaration
class HMHomeOverview
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 addHome(withName: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
Identifying a home
Dividing a house into rooms
Grouping rooms into zones
Managing accessories
accessoriesaddAndSetupAccessories(completionHandler:)addAndSetupAccessories(with:completionHandler:)addAccessory(_:completionHandler:)assignAccessory(_:to:completionHandler:)removeAccessory(_:completionHandler:)supportsAddingNetworkRouterunblockAccessory(_:completionHandler:)HMAccessory
Grouping services
servicesWithTypes(_:)serviceGroupsaddServiceGroup(withName:completionHandler:)removeServiceGroup(_:completionHandler:)HMServiceGroup
Querying the state of a home hub
Creating action sets
actionSetsaddActionSet(withName:completionHandler:)removeActionSet(_:completionHandler:)executeActionSet(_:completionHandler:)builtinActionSet(ofType:)HMActionSet
Triggering an action set
triggersaddTrigger(_:completionHandler:)removeTrigger(_:completionHandler:)HMTimerTriggerHMEventTriggerHMTrigger