Links

Home Kit Overview

HomeKit allows your app to communicate with and control connected accessories that support Apple's Home Automation Protocol in a user’s home. To use HomeKit with your iOS apps just switch-on HomeKit in the project editor capabilities panel. HomeKit have a common/central accessories configuration database with read/write access to all apps.
We can find and add an new Accessory with Accessory Browser (a.k.a HMAccessoryBrowser). If found we can add the new Accessory to the Home, after that we can assign the same to a Room in that home.
We can use HomeKit Accessory Simulator (which act as a real accessory) to test custom made accessories in iOS Simulator. We can open it from Xcode > Open Developer Tool > Home Kit Accessory Simulator. Every accessory come with a setup code to associate it with a Home via HomeKit

HomeKit is managed by the Home Manager (a.k.a HMHomeManager), which provides a pointer to the common database, allowes to manage/create homes and notify the changes. Home (a.k.a HMHome) should have a unque name because its being used by Siri for commands. Home have Roomes (a.k.a HMRoom) in it, (which is also uniquely named for that perticular Home) and Rooms have accessories in them. An Accessory (a.k.a HMAccessory) corresponds to a phycical device (its also uniquely named in its room).
We can also group the Rooms in Zones (a.k.a HMZones), its completely optional and uniquely named with a home. A room can be in any number of zones. Its recognized by Siri.

Basic steps to setup an accessory are;
  1. Create a home
  2. Add rooms to the home
  3. Add accessories
Accessories functionality and characteristics (like temperature, illumination..) are managed by the Services (a.k.a HMService). A Service can be exposed with an unique name/type so that user can trigger the same with Siri. Characteristic (a.k.a HMCharacteristic) of a Services can be read-only, read-write or write-only.
Alike Zones, We can also group Services with HMServiceGroup
We can create Action Sets (a.k.a HMActionSet), which is a collection of Actions (a.k.a HMCharacteristicWriteAction) that are executed together. Its also uniquely named and recognized by Siri.
We can also create timed Triggers (a.k.a HMTimerTrigger) to execute an Action Set that will be fired on an specific date and time or repeatedly. They are managed by iOS itself and executed in background.

There are many-many delegate methods are exposed by the HomeKit to track each and every change caused by other apps, system or accessories state change. e.g;
  1. HMAccessoryBrowserDelegate - to notify a new accessories found or removed
  2. HMAccessoryDelegate - to notify state change of accessories
  3. HMHomeDelegate - to notify configuration changes in the home
  4. HMHomeManagerDelegate - to track changes to a collection of homes

Post a Comment