---
title: "#297: Simulating HomeKit Accessories 💡🤖"
url: https://littlebitesofcocoa.com/297-simulating-homekit-accessories
author: Jake Marsh
date: 2017-02-15
published: 2017-02-15
topics: ["HomeKit","Tools"]
description: "\"Home automation\" is perhaps one of the hottest topics in technology these days. While still an emerging market, many iOS device owners now also own at..."
---

# #297: Simulating HomeKit Accessories 💡🤖

By Jake Marsh, February 15, 2017. HTML: https://littlebitesofcocoa.com/297-simulating-homekit-accessories

"Home automation" is perhaps one of the hottest topics in technology these days.

While still an emerging market, many iOS device owners now <i>also</i> own at least one or two "smart home" devices.

Today we'll begin looking at [HomeKit](http://www.apple.com/ios/home/), Apple's framework for communicating with and controllling these devices from inside our apps.

Before we can dive in though, there's a bit of tooling we need to learn about first. Specifically, we need to learn how to <i>simulate</i> _HomeKit_ devices.

For example, we might not own any _HomeKit_ devices ourselves. Even if we do though, we'd rather not need to phsyically change things about our home to test our app.

Not to worry, Apple provides a great solution to this challenge in the form of a **HomeKit Accessory Simulator** app for **macOS**.

In it, we can setup and configure a "simulated" set of devices in any kind of Home setup we'd like.

Sadly though, it doesn't ship with **Xcode**.

We'll need to head over to [Apple's "More Developer Downloads" page here](https://developer.apple.com/download/more/) and search for <i>"Hardware IO Tools for Xcode"</i>. We'll download the latest release, then install the **HomeKit Accessory Simulator** app.

Now, let's open it up and simulate our first accessory.

<img src="https://media.littlebitesofcocoa.com/297-1.png" style="max-width: 480px;" />

We'll click the **+** button in the bottom left and select **New Accessory...**

<img src="https://media.littlebitesofcocoa.com/297-2.png" style="max-width: 480px;" />

We'll fill out the fields with some example information. The values aren't <i>super</i> important, they merely need to be unique and somewhat realistic.

<img src="https://media.littlebitesofcocoa.com/297-3.png" style="max-width: 480px;" />

Neat. We've now got a (pretend) lamp. 💡

Well, sort of. There's actually one more important step, and it's speaks to the heart of how _HomeKit_ works.

So far, _HomeKit_ doesn't know <i>anything</i> about our new lamp. <i>"Lamp"</i> is just the name we gave it. 

For _HomeKit_ to do something useful with our device, we'll need to add a _HomeKit Service_ to it. _HomeKit Services_ describe the <i>capabilities</i> and <i>functionality</i> of a device

We'll click the <i>Add Service...</i> button on our new device, and choose <i>Lightbulb</i> from the dropdown menu.

<img src="https://media.littlebitesofcocoa.com/297-6.png" style="max-width: 266px;" />


We can leave the rest of the fields alone.

<img src="https://media.littlebitesofcocoa.com/297-4.png" style="max-width: 480px;" />

Neat! Not only do we now have a fully-simluted, color changing light bulb, we're also provided with some nice sliders and controls to read from, and write to, the current state of the device.

<img src="https://media.littlebitesofcocoa.com/297-5.png" style="max-width: 480px;" />

That's all for today. We'll learn more about the **HomeKit Accessory Simulator** as we continue to explore _HomeKit_. Next time we'll learn how to change this light's color in code! 🌈💡

<p></p>
