Saturday, August 23, 2014

Plex + FLIRC + harmony

Here's my account on how I went about configuring the Plex Home Theater with FLIRC and a harmony ultimate.

I decided to have a look at PLEX since i'm going to be moving to an apartment where the PC will be connected directly to the TV. Since it will be directly connected, I won't be using my streamer, and I thought I should look into using a nice looking media player/server.

Already having a harmony ultimate remote, I looked around for various ways to get it to control the PLEX Home Theater, and i decided on FLIRC.

FLIRC is a cool piece of USB driven hardware that translates IR (Infra-Red) signals to keyboard clicks. Since it does the translating for you, it means the PC/Streamer or whatever you're using it on doesn't need to know anything about IR translation, It gets normal keyboard inputs as if from a regular keyboard.

In order to configure the harmony remote to control PLEX I used the old approach that doesn't include the FLIRC-PLEX profile in the harmony remote. Using this approach, we configure the harmony with a device that has a lot of IR codes that are different from one another. This approach lets me do all sorts of things with keyboard shortcuts, namely using AutoHotKey (AHK) to configure commands not in the PLEX command list.
Here's a word document with my mappings using the Panasonic TC-P65VT30 device in the harmony remote:

About the AHK scripts:
The script that directly affects PLEX, and is aptly named StartPlex.ahk, always runs on the PC (it is in my startup folder) and the extra keyboard shortcuts in it do this:
Alt-Shift-F10 - opens the plex client (theater)
It expects the PLEX Home Theater to be in:
“C:\Program Files (x86)\Plex Home Theater\Plex Home Theater.exe”. if it is not in the same location on your PC, change the ahk file and recompile it to create the executable (literally 2 clicks once you have AHK installed).

other than this one script, i urge you to have a look at my other scripts since they may fit your particular case as they did mine (posted here: http://programming-headbanging.blogspot.co.il/2015/06/awhile-ago-i-wanted-to-find-way-to.html)
. Things such as changing the PC volume automatically when starting PLEX, or changing the PC resolution with a keyboard click.
All my scripts are updated in this post:
 Now, all that's left is to sit back, click the PLEX activity on the remote and watch TV till we drop.


16 comments:

  1. In your startup script it references the keypad-letters as an .exe and not a script .ahk.

    What should actually be in this folder and how is it produced?

    ReplyDelete
    Replies
    1. you're right. i uploaded the relevant executables as well to OneDrive.

      in general, if you want to create executables out of AutoHotKey scripts all that is needed is to install AutoHotKey, right-click the script you want to use, and choose "Compile Script". it's as easy as that.

      AHK has a lot of great shortcuts that may be added to the computer, i for one use WIN-Q to immediately close my PC screen for instance without having the PC go to sleep.

      so, you can either compile the scripts or give the executables a go and let me know how it goes.

      Delete
    2. Thanks for replying. But even after compiling to an .exe, I'm still getting the following error:

      https://www.dropbox.com/s/jcibqapgcgoaamp/keypad-error.png?dl=0

      Delete
    3. and did you put the Keypad-Letters.exe in the folder specified in that error? that's the location that's on my pc. you could either create that same folder structure and put it there or compile the script with the path that's on your pc.

      Delete
    4. Ahhh, I think I see the error... Your file is in Programs/AutoHotkey, mine is in Program Files\AutoHotkey.

      Silly me!! :)

      Delete
    5. great! yeah, i have a weird folder structure :) so it works?

      Delete
    6. Sorry to resurrect. I have this same problem. I tried altering the startplex AHK and change the path to the right folder, but that error is still popping up and shows the old location. Any ideas?

      Delete
    7. did you compile the script after the change?

      Delete
    8. btw, i updated the post with the new location of the scriptsin my onedrive folder. and removed the reference to the Keypad-Letters script since it doesn't seem like it's necessary in the latest Plex.

      Delete
  2. Hey cool post. Pretty new to this stuff just having installed a new HTPC this week. Did you use the MyHarmony software to assign the hotkeys ? If so which device did you set up and then modify to run the hotkeys ? and how did you manage to customize the keys with the hotkeys commands ? Hope I am not missing the point and being totally vague.

    ReplyDelete
    Replies
    1. i hope i got what you're asking right, but the autohotkey scripts (which assign a keyboard combination to let's say start Plex) are being triggered by keyboard strokes.
      the strokes are sent to the PC (or your HTPC) through the FLIRC device. you can get one through ebay for instance:
      http://www.ebay.com/itm/NEW-Flirc-USB-Dongle-for-Media-Centre-Raspberry-Pi-XBMC-Computer-Remote-Control-/151578361629?pt=LH_DefaultDomain_0&hash=item234ac63f1d

      or amazon:
      http://www.amazon.com/FLIRC-Dongle-Media-Centre-Raspberry/dp/B00BB0ETW8/ref=sr_1_1?ie=UTF8&qid=1409561699&sr=8-1&keywords=flirc

      what this small USB device does, is receive infra-red codes (from the harmony remote) and convert them to pre-configured keyboard combinations (through the FLIRC software). if you want, i could probably share my FLIRC configuration file with you when you get your device. it is pretty easy to configure.

      the last thing is setting up your harmony remote with the infra-red commands to send to FLIRC, which is configured to send them as keystrokes to the HTPC.

      the process of normally "teaching" the FLIRC which infra-red code does what is pretty easy, you just click the keyboard combination from FLIRC's software, and then press the remote's button to send the infra-red code. FLIRC will save the code as one that should be converted to that specific keystroke combination.

      hope i answered your questions :) if you have any others, feel free to ask.

      one small thing though, lately i've seen that Plex already does what i did in my autohotkey first script, so that one isn't really necessary.

      Delete
    2. Thanks for the reply. Actually already got the flirc adapter just completely lost on how exactly to use it. I'm starting to understand that it kind of complements what is able to be done using the Harmony software. A copy of your flirc config file to get me going would be great!

      Delete
    3. Hi David,
      you can give this a try:
      https://onedrive.live.com/redir?resid=de479d93705aaef!177&authkey=!AEZIzQXiTGL-2sk&ithint=file%2cfcfg

      i just remind you that you need to use the Panasonic TC-P65VT30 in your harmony remote as the PLEX device since its codes are the ones configured in this FLIRC configuration file (so you'll actually have 2 TVs in your harmony activity probably).

      Delete
    4. oh, and in the FLIRC configuration i gave you, aside from the commands described in the WORD document i gave the link to in the post, there are a few other commands used (hope i got them all):

      Harmony Panasonic TV signal - FLIRC key combination
      Display - Alt-F7
      SubMenu - Alt-Tab
      InputAnt/CableIn - Alt-Enter (maximize a media player such as Media Player Classic)
      VieraCast - Shift-Alt-F10 (i used this key sequence to tell auto hot key to start the Plex Home Theater executable)

      Delete
    5. Thanks you are a star. I will try and give it ago this weekend.

      Delete
    6. my pleasure :) let me know how it goes

      Delete