Identifying bridge accessory in HomeKit

368 Views Asked by At

How can I identify an HMAccessory as a bridge? Perhaps I have missed something but I cannot seem to find any HMServiceType or HMCharacteristicType that corresponds to a bridge. Any help appreciated.

2

There are 2 best solutions below

0
On

There is a category: HMAccessoryCategoryType property on HMAccessory where HMAccessoryCategoryTypeBridge represents bridge apparently. The online docs seem to be missing a lot of new properties and functions introduced in iOS9. One can also use uniqueIdentifiersForBridgedAccessories: [NSUUID]? on HMAccessory which returns non-nil if the accessory is a bridge

0
On

You can find out if an accessory is a bridge using the following code when inspecting a specific accessory:

if accessory.category.categoryType == HMAccessoryCategoryTypeBridge {
  print("I'M A BRIDGE")
}