Class

HMService

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

Declaration

@interface HMService : NSObject

Overview

An HMService instance represents a service provided by an accessory. Accessories have both user-controllable services, like a light, and services that are for the use of the accessory itself, like a firmware update service.

You don’t create services directly. Instead you find them in the services array of an HMAccessory instance.

A single accessory may have more than one user-controllable service. For example, most garage door openers have a service for opening and closing the door, and another service for the light on the garage door opener. These services are what Apple’s Home app labels as "accessories".

You inspect or change a service’s HMCharacteristic instances to discover state, or modify behavior.

Topics

Getting Service Characteristics

characteristics

An array of characteristics for the service.

HMCharacteristic

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

Identifying the Service

name

The user specified name of the service.

- updateName:completionHandler:

Updates the name of the service to the specified string.

uniqueIdentifier

A unique identifier for the service.

Getting the Service Type

serviceType

The type of the service.

Accessory Service Types

The service types supported by HomeKit.

localizedDescription

The localized description of the service.

Reading Service Properties

primaryService

A Boolean value that indicates whether this service is the primary service on the accessory.

userInteractive

A Boolean value that indicates whether this service supports user interaction.

Associating a Secondary Service

associatedServiceType

The type of the service associated with an outlet or a switch.

- updateAssociatedServiceType:completionHandler:

Associates the service type of the plugged-in device with a switch or an outlet service.

Finding the Linked Services

linkedServices

An array of service objects that represents all the services to which the service links.

Getting the Service’s Provider

accessory

The accessory that provides this service.

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.

HMAccessory

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

HMCharacteristic

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