Infrared Remotes in Apple Home
Over the last few months our house has slowly been getting on the Apple Home bandwagon. This started when we replaced our front door lock, then expanded with smart light switches in my room for my birthday. Ever since that early dive, I’ve been thinking about how else to leverage Apple’s Homekit in our daily life. The aweasome idea I had a month or more back was the one other realm of (fairly dumb) digital tech we have in various ways at home, devices controlled by infrared (IR) remote controls. Could these be made into Homekit accessories, and hence also erradicate their few annoynances of both reaching for a single remote and pointing it in just the right angle to work? The answer was yes, and now that I have gotten this going, I figured I’d document how I set this up for anyone else interested.
Homebridge
At the core of setting up IR accessories is Homebridge, an open-source Homekit bridge server that can be installed on almost any computer. Since we have a Mac Mini operating as a server at home already, I just put it there. But Rasbery Pis would do as well. On the Mac I used the following launchd plist in /Library/LaunchDaemons
to make sure the server runs alongside macOS:
Once the server is running its log, homebridge.log
in the Homebridge data dir, will tell you where to find the config UI (port number). Go there and make sure you log in, and change the admin password (you can even add 2FA if you’d like). Once logged in you will see a Homekit QR code that you can use to add the bridge to your Apple Home.
Broadlink RM Mini
To send IR commands you need hardware that can listen for instructions sent over your network and blast the IR commands in the room. I found the Broadlink RM Mini series the best reviewed, and importantly, that had a plugin for Homebridge. I got the slightly cheaper Mini 3, but the Mini 4 should work too. You’ll need one of these for each room in which you have IR devices you want to control from Home.
Homebridge Broadlink Rm Pro
In order to have the Broadlink RM Mini connect to Homebridge you need to install its plugin. There is a whole lineage of forks of an original plugin. I setteled on the Homebridge Broadlink Rm Pro fork, mostly because it said that it had support for the newer versions of RM Minis, but also because it had better support for some of the device types I may be adding. To install the plugin go to the Plugins section in the Homebridge web interface and search for something like Homebridge Broadlink and select the Homebridge Broadlink Rm Pro plugin.
RM Mini Setup
The real trick in setting up the RM Mini is that even though the plan is to use it exclusively with Homebridge, to get it on your network you’ll still need the official Broadlink app temporarily. However, I found that I had to cancel out of the setup just before adding the Mini to a room, otherwise Homebridge would not find the device. So go as far as giving it your WiFi info, but then cancel out. Otherwise you’ll need to reset the Mini and start again. You may need to restart Homebridge (either in the website, which usually works, or using launchctl
) to get it to pick up the RM Mini. You’ll know that the Mini is seen if you see a line like this in the log:
[7/15/2020, 1:52:02 PM] [Broadlink RM] [INFO] Discovered Broadlink RM Mini 3 D (5f36) at 192.168.1.213 (a7:df:24:df:ff:93)
Homebridge Config
To get the RM Minis to do anything you will need to add a platforms entry to the Homebridge config under the Config section in the Homebridge web interface. It is possible that you must do this and restart Homebridge before it will even look for devices, I had this done first with placeholders, and then edited it when the devices were delivered to me. My current platform config is below as an example:
I had to add the host
items since there are more than one RM Minis in the house, and this is how Homebridge knows which device to send what commands to. Similarly, that is why I disabled the built-in Learn command, so that it used a specific device.
Homekit has many different accessory types, but I started with the simple auto-off switch approach since this most closely mimics a physical IR remote. I may figure out how to wrap commands up together into more “smart” types later on.
Learning IR Commands
The point of the Learn (or in my case Learn IR) accessory is to help you find out what commands a given remote can send. To use it simply turn it on, and then press a button on a remote pointed near the RM Mini. You will find the learned IR hex code in the Homebridge log. This is the data
for a given accessory.
You only really need to learn the commands that you will use. But I’ve gone and started recording all the IR commands from remotes in our house. I make that Google Sheet freely available in case it comes in handy to anyone else who has the same devices and could use it.
Conclusions
A bit to my surprise, once I had this set up, using my phone as a remote felt just as instantaneous as the actual IR remotes. Tap a button, and the device it is meant to control immediately responds. Effectively this removes any real need for such remotes, especiallly if you’ve recorded their full command repertoire if needed later. Remember that if you’ll be storing remotes away longterm to take out their batteries.
At least with the “quick and dirty” implementation shown in the sample config, this can add dozens of accesories. So you’ll want to make sure most are not favorites (why those favorites are per-home and not per-user anyway I won’t ever understand…). If you really replicate full remotes it may be sensible to create Rooms that are for the specific remotes, or dig into the more complex accessory types.
Is this whole idea overkill? Maybe. But it was a fun exercise in how to extend Homekit to “dumb” IR-controlled devices. Plus, in our house we have had the challenge of not being near the remote to mute or umute always, and more likely not in a good position for said remote to reach the reciever (plus, who makes Mute buttons the smallest button on a remote…), so this is a convenient upgrade in our house.