Fun With Computers

March 1, 2008

Using the Harmony 880 remote with your mac’s built-in IR port.

Filed under: OS X — Tags: , , , — jkm9000 @ 9:45 pm
Recently I discovered a wonderful application called XBMC for Mac OS X. This application is a port of the popular media center developed for the original Xbox and despite being very new to the scene, is quite stable and full of features. After a few hours playing around I decided to ditch my previous setup (HTPC software running under XP) and use OS X XBMC for my home theater.
 
The biggest challenge I faced was using my Harmony 880. While I appreciate the simplicity of Apple’s remote, when it comes to a truly rich experience, 6 buttons simply are not enough. This meant that having my 880 mimic the Apple remote was not an option. After playing around with another wonderful piece of software called Remote Buddy, and finding a couple of posts on the possibilities, I have things working exactly as I had hoped. Since this does take quite a bit of time to get going, I felt that a guide would be useful to others.
 
Note this is written for XBMC, but pertains to any application you wish to control with your remote. I put this page together after I had everything working so hopefully it contains every step. If you notice anything missing, leave a comment and I will update the info here.
 

Requirements
  • Harmony 880 remote (other learning remotes can also be used)
  • Mac with built-in IR port
  • Apple Remote
  • Remote Buddy
  • OS X XBMC (Intel leopard systems only)
Background
The IR port on your mac will only process input from an Apple remote (or a universal that can send the same signals). While someone may develop a driver that expands the functionality, I have not been able to locate anything of this nature. Each button press on your Apple remote also passes along an ID number for that particular remote. In unpaired mode, your mac treats all remotes the same, so you can use the remote from your iMac to control your mini and vice-versa.
 
If you hold menu+play/pause for a few seconds this ID is incremented with possible integer values between 1 and 252. This allows your remote to send 1,512 (252 * 6) distinct signals (ignoring any differences sent when you hold down a button vs a press).
 
Fortunately, Remote Buddy takes advantage of this fact and allows you to create several logical remotes. While it does take some effort to get everything setup, the result is pretty seamless.
 

Step 1: Identify the keys
Behind the scenes Remote Buddy will be sending keystrokes to XBMC so your first step is to take a look at the keymap file and determine which keys you will be using. This file is located at ~/Library/Application\ Support/XBMC/UserData/Keymap.xml. After inspecting this file, I put together a spreadsheet to start mapping these keys to buttons on my 880. Please forgive the organization of this spreadsheet as I was learning as I went!
 
You can download my spreadsheet as a pdf here.
 

Step 2: Create the logical remotes and teach codes to your 880
After a bit of planning, I decided to use 8 logical remotes with remote buddy. To set this up, load Remote Buddy’s preferences, click on hardware, ensure that you have checked both “Enable support for multiple remote controls” and “Automatically authorize newly found remotes to control this computer.” Your screen should look something like the image below (ignore “ID” and “Mapped to logical remote” columns for now). Be sure not to click “Pair with selected remote.”
 
Now that the logical remotes have been created, you’ll teach your 880 the various signals from your Apple remote. The basic workflow is:
  1. Teach the harmony IR signals for each button on the Apple remote.
  2. Point the Apple remote to your mac running Remote Buddy and press MENU twice to register the remote id.
  3. Hold MENU+PLAY/PAUSE for a few seconds to increment the remote’s ID.
  4. Repeat 1-3 for each logical remote you have created.
To do this, connect your 880 to your mac using the supplied USB cable and launch the Logitech Harmony Remote Software. My approach was to create a new device called Mac Mini and then click “Learn IR.” Referring to my spreadsheet I knew that for the first logical remote I would be using 3 buttons:
 
Harmony Button Apple Remote Button
Channel + Up
Channel – Down
Prev Play/Pause
 
Some of the buttons on your 880 will already be listed, others you will need to create. To do this, just scroll to the bottom of page and find the section called “Learn a New Command”. Enter the name of the key on your 880, and click “Learn New Command.” This will present you with a new screen where you teach the 880 a command from the Apple Remote. It looks something like what you see below:
 
Teaching your Harmony a new IR command.
Point your Apple Remote towards the bottom of your 880 and press the button you are teaching. In my case for Channel Up, I pressed the Up (or +) button on my Apple Remote. Once the remote has learned the new command, it will take you back to the previous screen or learn the next one if you have selected to learn many at once.
 
After repeating this for each of the first 3 buttons, point your Apple remote to your mac, press MENU 2x and you should see the Remote Buddy software recognize the ID currently assigned to your Apple Remote. In my case, this was 75. I then mapped ID 75 to the logical remote named “Apple Remote.”
 
The next step in our workflow is to increment the ID of the Apple Remote by pressing both MENU+Play/Pause and holding for about 5 seconds. You won’t get any feedback here, but if you count to 5 you’ll be fine.
 
Lather, rinse, repeat. At the end of the process you will have taught your 880 all of the commands from your spreadsheet, and your Remote Buddy hardware preferences will look very much like the screenshot above. You will also need to update your remote using the Logitech software in order to transmit all of the learned commands.
 

Step 3: Create a new activity for your 880.
Using the Logitech software, create a new activity using the devices hooked up to your mac and name it XBMC. I won’t go through all the steps here, but you’ll need to customize the buttons on the 880 to match your hardware and to communicate with your mac. The below screenshot shows some of my custom button setup. Once the activity is complete, update the remote once more.
 
Harmony Custom Button Setup for XBMC
 
Step 4: Use Remote Buddy’s Behaviour Construction Kit to define keystrokes for XBMC.
Remote Buddy has a very useful feature called the Behaviour Constrution Kit which really allows the software to be customized for any application. The author of Remote Buddy has been kind enough to make a screencast that goes through every step in creating behaviors. Take a few moments and check it out here, but do come back as we still have some work to do!
 
Now that you understand how to use the Behaviour Construction Kit, go ahead and create actions for each keystroke in your spreadsheet. Once you’ve done this, it should look something like this:
 
Remote Buddy Behaviour Construction Kit Action Factory
At this point we depart slightly from the methods used in the screencast. You will still need to setup behaviours but we won’t do any mapping via the BCK, that is done elsewhere. So follow the screencast instructions, but skip over any mapping. Once you have selected all actions to be used in this behavior (screenshot below), click the little gear icon and select “Compile, testdrive and permanently install Scripted Behaviour.”
 
Remote Buddy Behaviour Construction Kit Behaviour Factory
Step 5: Use Remote Buddy’s Mapping Preferences to tie it all together.
We’re almost there! The last step is to map the all of the actions to the various logical remotes. Open up Remote Buddy’s preferences and click on “Mapping.” Select the XBMC behavior and one by one map actions to the buttons on the different Apple Remote entries you see on the left side. The screenshot below is how yours should be looking at this point.
 
Note: You will need to disable any conflicting actions under the Global mapping section. Otherwise the global mapping actions will compete with those of the various Apple Remotes you have setup.
 
Remote Buddy Mapping Preference
Once all of the information from your spreadsheet has been mapped you’re all done. Fire up XBMC and take control with your 880!
 
To save yourself a bit of time, you may also download my XBMC behavior.

Blog at WordPress.com.