User:Openam/Plex

Most of this information comes from funwithcomputers.wordpress.com. There have been some slight modifications to fit my needs. Please visit funwithcomputers.wordpress.com if you would like to see the screen shots of this process.

Requirements

 * Harmony 880 remote (other learning remotes can also be used)
 * Mac with built-in IR port
 * Apple Remote
 * Remote Buddy
 * Plex for OSX (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.

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 chart to start mapping these keys to buttons on my 880. Please forgive the organization of this chart as I was learning as I went!

Create the logical remotes and teach codes to your remote
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 remote 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 remote 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 chart 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 remote 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 remote, and click “Learn New Command.” This will present you with a new screen where you teach the remote a command from the Apple Remote. It looks something like what you see below:

Point your Apple Remote towards the bottom of your remote 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 remote all of the commands from your chart, 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.

Create a new activity for your remote
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.

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:

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.”

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.

Once all of the information from your chart has been mapped you’re all done. Fire up XBMC and take control with your remote!