Apartment Automation Part 1: Controlling an IR Air Conditioner

Evan Coleman
3 min readSep 22, 2017

--

Ahem…is this thing on?

If you’ve followed me on Twitter at some point over the last five years, you know that I’m obsessed with home automation. And since I’ve recently moved into a new apartment, I figured it’d be fun to reboot my blog with a series on automating said new apartment. First up, controlling the non-smart air conditioners that came with the apartment.

Back in 2012, my first foray into home automation was back in college when I bought my first Arduino, a strip of WS2801 RGB LEDs, and wrote an iOS app to control them. These days I don’t like the idea of having to maintain and use multiple apps to control my devices, so I want everything to be controllable via HomeKit. Fortunately for me, homebridge exists and is an easy way to make non-HomeKit devices HomeKit compatible.

So back to the air conditioner. My apartment came with two GE AJCQ06LCG units. I did some research to see if there were any existing products to make IR air conditioners smart. There is one, but it sadly only supports air conditioners that have a screen on the remote (and thus, two-way IR communication to maintain state).

Okay, time for plan B. I happen to have a Logitech Harmony Hub in both rooms. For those not familiar with the Harmony Hub, it’s essentially an IR blaster that sits by your TV and receives commands over RF from a Logitech remote or over WiFi from their smartphone app. The Harmony Hub, while having a massive database of IR controlled devices, also has the ability to learn new devices. So using the air conditioner remote, I taught the Harmony Hub each command. Great! Now I can control my air conditioner with my TV remote, we’re halfway there. Well, more like 10% there. This was the easy part.

The hard part is getting HomeKit to control a Harmony device. There is an existing homebridge plugin for interacting with a Harmony Hub, but it uses the Harmony API which, unfortunately, only supports toggling activities on and off (activities are sequences of commands, for example I have activites for “Watch TV”, “Watch Apple TV”, “Listen to Music”, etc). This is great, but it’s not what we’re looking for right now.

Luckily, after some more research, I stumbled upon the harmony-api project which creates a RESTful interface for interacting with nearly every aspect of the Harmony Hub. It even has a handy web interface that displays all of the available devices and endpoints. I quickly spun this up on my docker server, and within a few minutes I was controlling my air conditioner with curl. This is really cool, but we’re still not finished.

The final step is to build a homebridge plugin to bridge HomeKit to the harmony-api REST API. The end result is available on my Github and via npm as homebridge-harmony-api. Right now, it supports three device types: switch, fan, and speaker. For speakers, only mute is currently supported. Configuration is very simple. For example, here’s my configuration:

The “slug” values can easily be found by viewing the harmony-api web interface. See the example config in the Github repository for examples of other device types.

Sadly, this setup does come with some caveats. Since the air conditioners can still be controlled via the remote and the buttons on the unit itself, the power state in HomeKit won’t always be accurate. This isn’t a huge deal for me but I have been investigating potential solutions. One that I’ve considered trying is getting a couple internet connected energy monitors to connect to the ACs. This way I can modify the homebridge plugin to infer the state from how much power the unit is drawing, but that’s a topic for another day.

If you run into any issues with the setup process, feel free to make use of the Github issues page. Stay tuned for part 2!

--

--

Evan Coleman

iOS Developer, Formerly @timehop, Student Pilot, Skier, Cyclist, Guitarist, Yankee Fan. https://edc.me