HomeKit is the name for Apple's home automation framework for developers. With HomeKit, our iPhones and iPads have a rational way to configure, communicate with, and control "the internet of things" around us, including connected lights, speakers, security systems, blinds, and more. Both locally when you're home and remotely when you're away, through apps and through Siri, Apple's virtual personal assistant. HomeKit is doing all this seamlessly, but also securely and privately. So, how does HomeKit work?
Managing your HomeKit
HomeKit is based on a "Home Manager" and a common database, stored in iOS, that contains all the information about the home, its rooms, the accessories inside them, and the services and characteristics of those accessories. Having everything stored all in one place makes for a more consistent experience across apps. so, for example, whatever you have set up in the Home app, will be the same in a third-party or manufacturer's control app. Same home name. Same room names. Same accessory names.
Homes and rooms
Home Manager, as the name implies, lets you manage "Homes", including designating a primary home if you have more than one. Each home has to have a unique name so you can specify which one you're referring to, including via Siri. For example, you can have "Main" and "Vacation" as home names.
Home are made up of "Rooms". Rooms also have to have unique names, but only within their Homes. So, for example, you can have "Main Bedroom" and "Vacation Bedroom". Again, that's so you can refer to them specifically, and so can Siri.
Rooms can be grouped into "Zones". These could include, for example, "Upstairs" and "Downstairs". Any number of rooms can be grouped in a zone, and the same room can exist in multiple zones. However, zones also need unique names within the home, for you and for Siri.
Rooms are what contain your "Accessories". Accessories are the specific physical devices connected to your iPhone or iPad — the sensors, thermostats, locks, etc. Accessories also need unique names within a home, so they can be specifically accessed by you or Siri. So, "Main Bedroom Lights" and "Main Bedroom Speakers" are fine. "Main Bedroom Lights" and "Main Kitchen Lights" are not. (If you have multiple similar accessories in different rooms, you'll have to get more specific or creative with their names.)
Services and characteristics
Accessories have "Services". These represent what an accessory can do. Services may or may not have names. If they're meant to be commonly used or accessed via Siri, they'll need a unique name to the home, just like the accessory itself. For example, a light bulb that lights up is a service that needs a name. Other services include garage door openers, door locks, thermostats, cameras, switches, and custom services.
If a service is not meant to be commonly used, and would be better accessed via an app interface, they shouldn't have a name. For example, a maintenance function that updates firmware shouldn't have a names. Apple also defines some default service types, which Siri recognizes through natural language as well.
Services can be grouped into "Service Groups." These could include, for example, "Night lights" that includes room lights, garage door opener lights, outside lights, and appliance lights, or "Party speakers" that pipes audio around the house. Service groups can include any number of services from any number of different accessories, and are intended to make it easier to control specific services across a range of accessories. The same service can be included in any number of different groups, so the same light can be in "Night Lights" and "Game time", but each service group needs a unique name per home for you and Siri.
Services have "Characteristics". Characteristics are the interactive part of services. For example, whether a light bulb is on or off (the power state) is a characteristic. They're not named but they're recognized by Siri because Apple has defined certain types, like power state, lock state, target state, brightness, model number, current temperature, and custom characteristics.
Some characteristics are read-only, like current temperature. Some are read-write, like asking for and re-setting the temperature. Some are write-only, like commands. So, for example, you can command any accessory to "identify" and it'll flash, beep, or otherwise show or tell you what and where it is.
To help developers and manufacturers think outside the presets, HomeKit allows for custom services and characteristics to be defined. They're not understood natively by Siri the way Apple-defined services and characteristics are, but they allow for potentially much greater and more diverse functionality.
Actions and triggers
Actions write to characteristics. For example, close the garage, lock the doors, turn off the lights, turn down the temperature, etc.
Actions Sets (referred to as Scenes) are collections of actions that are executed together. For example, "Goodnight" could make sure your garage door is closed, the front door is locked, night lights are on, day lights are off, TV is off, and coffee maker is set to help wake you up in the morning. "Game time" could make sure the lights are set to red, the sound system is on max, and everything else in the house is off or muted. Action sets aren't executed in a specific order. They all just happen as soon as they can, all at once if possible. Again, an action set needs a unique name per home for you and Siri.
Triggers (referred to as Automations) execute action sets at predefined dates and times. They can be single-use or can be set to repeat. They can have delays built-in. Triggers can't be used through Siri, but they can be run by iOS in the background, unlike the rest of HomeKit, and also require unique names per home.
Taken together, action sets and triggers let you create "scripts" to automate the control of any and all of your HomeKit compatible accessories.
Adding accessories to HomeKit
Because HomeKit is a framework for developers, any app that ties into HomeKit has to be ready and able to help the user manage their accessories.
That means, if a HomeKit app is launched and no "Home" is detected, the app has to walk the user through creating and naming it, then creating and naming the rooms in it, then providing the accessory browser so the user can find and add accessories to the home, name them, and assign them to the proper room. HomeKit can also report back to any app whether or not an accessory is accessible or not accessible, for example out of range, offline, turned off, etc.
There's a special kind of accessory called a bridge. It's used when an accessory has several parts but only the main part can connect to Home Kit. For example, if an amp can connect to HomeKit but the speakers use an incompatible format, the amp would serve as a bridge to the speakers. Once a bridge is added, you can add the satellite accessories as well, and the bridge will handle the heavy lifting of translating between HomeKit and whatever format they use. So, add the amp, control the speakers through the amp.
Thanks to the integration with Siri, HomeKit also is a huge win for accessibility. Voice control plus a consistent experience across apps will hopefully lead to more apps and accessories being more accessible to more people with visual impairments.
HomeKit for developers
Apple has made it easier for developers to work with HomeKit by building a Home Kit Accessory Simulator right into Xcode. It acts just like a real accessory and allows developers to test apps as though they were connected to a real accessory.
Apple also cautions developers that there are a lot of delegates to be implemented for HomeKit. Because there's a shared database, and multiple apps can make changes, and accessories can be added and removed, and have their states changed, there's an equal and opposite price to be paid for the convenience and consistency. That price is paid through the delegate methods. It's how HomeKit tells an app what's going on beyond that app so it can always be up to date.
HomeKit, like HealthKit, and like PassKit before them, depends on the quantity and quality of manufacturers and developers that support it. If past history is any indication, that means we'll get some amazing apps and accessories, some okay apps and accessories, and some barely thrown together web views meant to control gizmos of dubious construction and utility. As much as we complain about the level of control Apple exerts, we often complain even harder about those things outside Apple's control.
Traditionally, though, Apple has paid even closer attention to the quality of hardware partners than to the App Store. This can be seen through the smaller number of HomeKit accessories that are available when compared to other smart home platforms. However leading accessory manufacturers such as, iDevices, iHome, Sylvania, Chamberlain, August, Honeywell, Wemo, Schlage, Philips, Kwikset, Netamo, Eve, Lifx, G.E., Logitech, Arlo, and Ecobee have all already released HomeKit compatible devices. More, no doubt, are to come.
Security and privacy
Not surprisingly, Apple takes HomeKit security and privacy very seriously. They've built it, reviewed it, and then reviewed it again. There's end-to-end encryption between connected devices and accessories, and adding a new accessory requires a setup code that comes from the accessory, typically on the packaging or a label. Likewise, Apple stresses that they don't believe privacy includes storing information about your home and your accessories on their servers.
Locally, HomeKit apps can only be used while in the foreground. That makes sure people can see just exactly what's going on and when, and never have to worry about something happening secretly in the background. The only exception to this is triggers, which give iOS the ability to set off an action set. However, they need to be expressly set up by the user to do so.
HomeKit tackles a big, complex problem and tries to make it small and simple enough to fit onto your devices and into your daily life. It's important to remember that HomeKit, like the other "Internet of Things" ecosystems, is still young, and there are always kinks to work out and updates to come. As HomeKit comes into its own, we're finding ourselves at the early stages of something truly remarkable, for our iPhones, iPads, Macs, and for whatever comes next.