<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 8.0.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HomeKit",
  "identifier" : "/documentation/HomeKit/HMService",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "HomeKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HMService"
  },
  "title" : "HMService"
}
-->

# HMService

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

```
class HMService
```

## Overview

An [`HMService`](/documentation/HomeKit/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`](/documentation/HomeKit/HMAccessory/services) array of an [`HMAccessory`](/documentation/HomeKit/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`](/documentation/HomeKit/HMCharacteristic) instances to discover state, or modify behavior.

## Topics

### Getting service characteristics

[`characteristics`](/documentation/HomeKit/HMService/characteristics)

An array of characteristics for the service.

[`HMCharacteristic`](/documentation/HomeKit/HMCharacteristic)

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

### Identifying the service

[`name`](/documentation/HomeKit/HMService/name)

The user specified name of the service.

[`-  updateName:completionHandler:`](/documentation/HomeKit/HMService/updateName(_:completionHandler:))

Updates the name of the service to the specified string.

[`uniqueIdentifier`](/documentation/HomeKit/HMService/uniqueIdentifier)

A unique identifier for the service.

### Getting the service type

[`serviceType`](/documentation/HomeKit/HMService/serviceType)

The type of the service.

[Accessory Service Types](/documentation/HomeKit/accessory-service-types)

The service types supported by HomeKit.

[`localizedDescription`](/documentation/HomeKit/HMService/localizedDescription)

The localized description of the service.

### Reading service properties

[`primaryService`](/documentation/HomeKit/HMService/isPrimaryService)

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

[`userInteractive`](/documentation/HomeKit/HMService/isUserInteractive)

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

### Associating a secondary service

[`associatedServiceType`](/documentation/HomeKit/HMService/associatedServiceType)

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

[`-  updateAssociatedServiceType:completionHandler:`](/documentation/HomeKit/HMService/updateAssociatedServiceType(_:completionHandler:))

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

### Finding the linked services

[`linkedServices`](/documentation/HomeKit/HMService/linkedServices)

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

### Getting the service’s provider

[`accessory`](/documentation/HomeKit/HMService/accessory)

The accessory that provides this service.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Sendable`](/documentation/Swift/Sendable)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)