All Blog Posts

Building a Smart office with Apple's HomeKit

Offices can be extremely boring places to spend your time. Thats why we decided to integrate Apple’s HomeKit into CUBE HQ. Giving us control of the CUBE Lights and remote access to our Lego schedule board via camera. This is how we did it...

Development

Cube office lights

As Head of iOS, I get quite inquisitive about how Apple products work and how I can make use of them in my everyday life. Apple’s HomeKit is their proprietary software and hardware smart-home platform that enables you to control your environment. When I had a bit of spare innovation time I wanted to see how I could use it to control the environment of the place I spend most of my day, CUBE HQ.

CUBE lights:

The existing setup consisted of the lights being connected to one of those cheap timer plugs that cut the power based on time of day. The office is active from 8 am to 6 pm every day so the light should be off outside of those hours. The problem with the cheap timer is that it had a habit of drifting by a few minutes every day so eventually the lights would be coming on at 6 am and turning off at 4 pm which isn’t ideal.

To kick off the HomeKit setup I picked up an Elgato Eve Energy, which is just a plug extension that has Bluetooth. This was super easy to set up. We have a lot of test devices in the office, so I set the plug up on one of those so that the office devices were the admin of the “Home” we were building. All I had to do was plug it in, scan the HomeKit code that came in the box and it was all set up. Just a few minutes later I had it up and running.

Apple’s Home app supports setting automation, so I was able to quickly set up the lights to turn on and off at the same time every day. It’s worth noting that this is only possible because we have a 4th Gen Apple TV in the office which automatically acts as a “HomeKit Hub” to send out commands to these devices while we are out of the office.

The schedule:

We love our Lego schedule but how does that work when you are out of the office and need to check something? What if you are working remotely? HomeKit can help us with that too.

A quick search for HomeKit cameras yields limited results, and of the ones that are actually for sale right now, they’re kind of expensive. I needed something a little more ‘budget’ to prove the concept.

After some Googling, it turned out all we needed was an IP camera that gave raw access to it’s RTSP stream. This little guy from Amazon would do the trick so we ordered it and I got to work on the bit that would power it.

Lego schedule

Homebridge and a Mac Mini:

Apple advises you that you need a HomeKit compatible product to use it with HomeKit, but that isn’t strictly true. For the impatient (like myself) you can trick HomeKit into working with other devices.

Firstly I set up homebridge on our office Mac Mini. I won’t go into detail of how as their GitHub details how to go about that. After you set that up, the Mac Mini shows up as a HomeKit Bridge. A bridge is just a device that handles HomeKit communication on behalf of non-compatible devices. Phillips do this with their Hue Bulbs, opting only to make the Hue Bridge compatible with HomeKit.

I then connected up our IP camera and mounted it on the roof, making sure you could access it over our wifi (through VLC).

Homebridge does not contain functionality for cameras on its own but I knew about a nice little plugin to add support. Once that was installed I set up the homebridge app JSON to include an entry for the camera using it’s IP address.

The result:

Et voila! The camera is accessible in the Home app just like it was a native HomeKit camera. The quality isn’t so good as it’s not an excellent camera, and it is running through FFmpeg, but I think with a bit of tweaking on the compression and contrast I could improve the quality. It works well enough to check the colour of the Lego bricks and to see space on the schedule, so overall it’s a success.

I’ve also added everyone’s personal iCloud email address to the Home app as guest users so anyone in the office with an iPhone can control the lights and access the camera.

home app on iOS

What's next?

We’re still discussing what we could connect up next. We would love to have a HomeKit doorbell and entry system but we can’t go messing around with the entry system in our current place as it doesn’t belong to us. We’re open to suggestions. What would you hook up?

Published on May 17, 2017, last updated on April 9, 2019

Give us the seal of approval!

Like what you read? Let us know.

7

Tags