Saturday 29 September 2012

Remote Tribulations

Following on from the reconfiguration of MediaServer8, I needed to build an HTPC to drive my home theatre.

The theatre comprises a Pioneer VSX-2011 receiver driving a 7.1 speaker array consisting of 2x B&W CDM-1NTs, a CDM-CNT, 2x B&W DS6 diploes as surrounds and a pair of B&W DM601 S3s as rear surrounds. Sub is a Velodyne CHT12. Sources are a Pioneer DV565A CD/DVD/SACD/DVD-A player and a SqueezeBox. A Sony VPH-1271QM CRT throws a picture onto a 110" screen.

All of this looks and sounds great despite being particulalry old school (not an HDMI socket in sight!!). The only thing missing is a way to playback video material from the Plex Media Server running on MediaServer8. I had previously connected the server directly to the projector but that was problematic in the the same computer was driving the living room TV and we couldn't use both simultaneously.

Time for a new HTPC build!

The sometimes cumbersome Harmony software
Having upgraded the server hardware, I had my Q6600 Core2 based system free. I was happy to use this as playback device but needed to address power issues as I didn't want it running 24/7. I needed a way of powering up the machine when needed and shutting off when not in use. I remembered I had a Logitech Harmony 786 universal remote lying around unused so expaned the project to aim towards full remote control of all theatre devices, including the HTPC.

Things went well initially. I set up the PC with Windows 8 RTM, installed Plex and got everything talking to the MediaServer. There were a couple of hiccups. Firstly, I noticed the network card on the motherboard would intemittently lose connection, requiring a restart. This had been a problem with the same MB running Server 8 Beta so obviously the MS drivers were problematic. I happened to have a spare 10/100/1000 PCI card so popped that in and the problem went away. Secondly, I have a fanless ATI 45xx series PCIe graphics card in the machine but AMD have not yet released drivers for this series under Windows 8 (will they ever?) so I needed to make do with the stock MS drivers.

With the HTPC working, it was time to work on the remote control.

I configured activities on the remote for CD listening, SqueezeBox listening and Plex. In general, this all worked really well. Clicking on the CD activity will switch on player & reciever, switch inputs correctly and switch off other devices. Click on the Squeezebox activity, the DVD player goes to standby, receiver switches to the correct digital input and Squeezebox springs to life.
X10 LDMs allowing wireless lighting control


I even got the remote to control the theatre lighting! I have a lot of the house lighting wired with X-10 controllers so now, if I start the Plex activity, the theater lights fade out. Hit pause, the come back up. Hit play, they go down again. Nirvana!. (I use an Intellihome IR/X10 convertor to enable light control from the harmony remote)

However, acurate control of the HTPC was proving elsuive. There are detailed and simple instructions on the Plex forums regarding set up of Plex control with Harmony remotes. However, this requires a WMC compatible remote sensor which I didn't have.

I remebered I had a Creative Audigy2 ZS Platinum Pro sound card that had a remote sensor. In installed that in the PC and while there are no Win 8 Creative drivers for this legacy device, Windows did provide enough default control to recognise it, use it as a sound card and access the remote sensor.

An earlier configurationof my Home Theatre

I tested and eventually purchased IntelliRemote which recognised the remote sensor on the breakout box and allowed me map commands from the Harmony remote to shortcuts in Plex. I downloaded the creative remote device into the harmony so the signals worked great with the creative receiver.

By the way, I'm impressed with IntelliRemote. It's very very flexible, really configurable and the support on forums from Melloware is very impressive. There are other similar solutions such as Girder & EventGhost available and I'm sure they work just as well. I like IntelliRemote though.

So, I was now able to control the HTPC from my Harmony. I wrote a PowerShell script to put the PC to sleep. The simple code is as follows;

Add-Type -Assembly System.Windows.Forms
[System.Windows.Forms.Application]::SetSuspendState("Suspend", $false, $true)


(The above assumes that the PC supports S3 suspend state and bios is correctly configured.)

So, mapping a soft SLEEP command from the Harmony to call that script in IntelliRemote, the PC would go to sleep. Note: it's necessary to run the following command from PowerShell before .ps1 scripts will execute (see here for details);

set-executionpolicy unrestricted

However, I couldn't get it to wake up again! The sleep state put the PCI devices to sleep as well. The only way I could wake it up was to hit a key or the mouse. Not ideal - I'd need to get out of my chair to wake the PC up. Oh dear.

Having being building HTPCs and associated gadgetsfor almost 10 years now, I have a good bit of stuff just lying around. I remebered that I had USB-UIRT and  IRman receivers. The IRman is quite old and has a serial connectuion. However, the USB-UIRT has PC wake capibilities and is supported by IntelliRemote. Happy days.

I removed the Creative card and plugged in the USB-UIRT and remapped all the Plex controls. It worked really well and I eventually managed to get it to wake the PC. I had to use a specific version of the USB-UIRT driver software for this to work (Win7_Win8_Vista_v20601_signed). I also had to download the lrnhelper.exe utility (v0.0.5) which allows specific IR commands to be learned to the UIRT firmware and thereby wake the pc.

So now I have full wake/sleep control over the PC, full integration with all remote activities and even lighting control at the touch of a button. What more couldI want?

Well, for it all to work properly would be a start.

It turns out that the delicate balance of USB-UIRT and IntelliRemote was problematic. The PC would wake up OK, but often it seemed that Intelliremote would lose communication with USB-UIRT on wake. After much head scratching and reading of both forms where similar problems were raised but always directed as an issue with the others software, I discovered that the fix would be a stop and restart of the USB-UIRT device in windows hardware control panel.

So it seems that for some reason, either USB-UIRT drivers or Intelliremote code was failing on wake from sleep correctly. AAAAGGGGHHHH!

In a fit of pique, I wiped the machine clean and installed Windows 7. Now, the setup works perfectly. There must have been some issue with Windows 8 and USB-UIRT drivers.

The final edit was to add a line to my sleep.ps1 script to close Plex on sleep as I was finding that even though remote commands were being received on wake, Plex would just get stuck. My sleep.ps1 script called from intelliRemote now looks like this;

Get-Process plex | % { $_.CloseMainWindow() }
Add-Type -Assembly System.Windows.Forms
[System.Windows.Forms.Application]::SetSuspendState("Suspend", $false, $true)


And the IntelliRemote configuration that calls it is this;



On wake, I have a scheduled task that re-launches Plex. Here's the trigger;



So far, this is all working well. I don't really mind using Windows 7 for the HTPC OS. It's playback only and as a bonus, there are ATI drivers for the graphics card so I have access to screen tweaks in Catalyst Control Center that allow me optimise the picture on my antiquated projector.

While it's taken some time to work this all out, I'm pretty happy with the setup. Moreso, the kids can now understand how to switch on and switch off the home theatre; something that was a mystery to them before as it required a specific sequence of power ups, input selections and general vodoo.

Next stops: finishing the Whole House Audio system and getting centralised TV serving up and running....

(in writing this, I figured out how to do a partial screen capture in Windows, something that's second nature to me on OSX.)

No comments: