How to switch on your PC and PS4 with Logitech Harmony for the smart home dream

How to switch on your PC and PS4 with Logitech Harmony for the smart home dream

Logitech Harmony, especially the Elite, is probably the best universal AV remote out there. It’s compatible with thousands of devices, including yours. Chances are, if you have it, Harmony works with it. And if Harmony doesn’t work with it, you can almost certainly train it to work with it.

That is unless you have a PS4 or a PC. Yes, there’s limited functionality. You can control your PS4 or your PC once the devices are switched on, and in the case of PS4 Harmony will turn the PS4 off when you’re done with it. But part of the convenience of the Logitech Harmony kit is that you press a button to launch an activity, and all your devices spring to life immediately. And when you’re done it handles turning everything off with the press of one button.

For PS4 owners and comfy couch PC gamers, we’ve had to get up and manually turn these devices on by either pressing the power button or picking up the controller and turning it on. This is notably not the case for the Xbox One, which powers on or off via Logitech Harmony fine. For people who want this simplicity that Harmony promises, having a PC or PS4 in your kit really devalues the whole setup.

But why should I care?

If you’re lazy like I am, then getting up off the couch to switch the PC on is a nuisance. Even more so if you’re a Steam Link user and your computer is in another room. And with the PS4, maybe you don’t want to use the controller right now. Maybe all you want to do is watch a Blu-ray or use one of your streaming apps like Netflix or Plex.

In short, having this functionality simplifies accessing your setup so that you or anyone else in the house can access any device without issue.

In this guide I will walk you through the steps to getting all of this working.

Note: If you’re just using a PS4, there is a simple solution which I’ve not tested, but seems to work. It’s called the PDP IR Receiver for PS4. It can receive IR commands from Logitech Harmony and also allows the PS4 to be turned on via IR command. You can see the howto on Logitech Harmony’s website, and buy it in the US on Amazon. For those of you unable to use this equipment for whatever reason, or wish to have turn on and shutdown functionality with your PC, please read on.

Things You’ll Need

  • A computer with the following
    • Windows, macOS or Linux operating system
    • An SD Card reader (built-in or USB-based is fine)
  • A device compatible with Home Assistant
    • I’m using a Raspberry Pi 3B+, but these have since been superseded by the Raspberry Pi 4 (also compatible)
    • See which devices are compatible with Home Assistant here
    • You can also install Home Assistant on hardware you already own, but this is a bit more advanced
  • An Android or iOS smartphone or tablet (PS4 Only)
    • PS4 Second Screen App
  • A motherboard compatible with Wake on LAN on your gaming PC
  • An hour or two spare to get this all setup

Step 1: Install Home Assistant

Home Assistant is an open source home automation platform that connects to pretty much all your home automation devices. In my home I use Philips Hue, Logitech Harmony, Tado Thermostats and TP Link Kasa smart plugs, and I’ve never had a problem with connecting any of these devices to it. It’s a bit more hands-on than other Smart Home platforms like Samsung Smartthings, Apple HomeKit or Homey, but it’s also a lot more powerful and flexible.

You may already have a setup with one of these automation platforms or another, and Home Assistant won’t interfere with them at all. In reality, for the purposes of this tutorial, the only devices we’re adding to Home Assistant will be the devices you wish to control with your Logitech Harmony setup: PS4, PC and maybe your Philips Hue Hub if you’d like to continue using that with Logitech Harmony.

Once you’ve completed this tutorial you may wish to configure Home Assistant to be the central pillar of your smart home. I won’t be going into that here.

The best tutorial to follow to install Home Assistant is the one on their website. They have a number of tutorials depending on your circumstances. I’ll list them here.

Despite Home Assistant offering all these tutorials, I strongly recommend installing the software on a Raspberry Pi or similar device, as mentioned in the Beginner’s Guide. This is the setup I use, and my instructions will be specific to it. As a secondary recommendation, I have previously installed Home Assistant on a 2012 Mac Mini running macOS and got this setup working. However, it takes more work which I won’t be going into here.

Once you’ve installed Home Assistant, move on to the next step.

Step 2: Install Home Assistant Addons

If you’ve used the Beginner’s Guide to install Home Assistant, you should be able to install the following Add-Ons from the Add-On Store.

On the sidebar of your Home Assistant, click Supervisor. Then click Add-On Store on the top bar.

You should find yourself here

The first addon you need to install is Configurator. This is a browser-based file editor. We’ll need this later when we’re pasting some code into the configuration.yaml file. Once Configurator is installed, make sure the three toggles (Start on boot, Auto update, and Show in sidebar) are switched on, then click to start the plugin.

If you’re just setting up PS4, you can move to the next step. If you’re also setting up PC then you need to install RPC Shutdown. Just install it for now and we’ll get to configuring it later.

Next we’re moving on to device specific instructions.

If you’re configuring for PS4 or both devices, move to Step 3a.

If you’re configuring for just PC, move to Step 3b.

Step 3a: Configure PS4

Adding PS4 to Home Assistant is easy, but requires some tinkering.

In Home Assistant, click Configuration on the sidebar and then click Integrations.

Next, press the orange + icon in the bottom right corner of the page.

In the search box type PlayStation 4.

Open the PS4 2nd Screen app on your phone, then click Submit on the dialogue box in Home Assistant.

Refresh devices on your 2nd Screen app and select the Home-Assistant device. You may need to remove your PS4 from your 2nd Screen app temporarily to do this. You can re-add it once the PS4 has been added to Home Assistant.

Now turn on your PS4 and in the settings navigate to add a 2nd Screen device. It should give you a code. Write this down, and enter the code on the screen in Home Assistant.

And you’re done! Your PS4 is now added to Home Assistant and can be remotely turned on and shut down using the app. If you want to test it, go to the Overview page on Home Assistant and you should see your PS4 there.

If you’re also adding a PC to Home Assistant, please proceed to Step 3b.

If you’re ready to move on to adding Home Assistant to Logitech Harmony, proceed to Step 4.

Step 3b: Configure PC

Adding your PC to Home Assistant is a lot more difficult than PS4 as it requires adding code to Home Assistant’s configuration, creating a static IP on your home network and tweaking Registry settings in Windows. I recommend that you be confident with the following:

  • Tinkering with code
  • Backing up your files
  • Using the Windows 10 Registry Editor
  • Re-installing Windows in case something goes wrong (hopefully you won’t have to do this!)
  • Loading into and changing settings with your PC’s BIOS or researching how to do it
  • Changing settings on your router or researching how to do it
  • Following instructions to the letter without getting impatient or trying to take shortcuts

Note: These instructions are only applicable for Windows 10 PCs only. The Wake On LAN side should work on a Linux PC, but the RPC Shutdown functionality won’t. And as for macOS, good luck! If anyone has had success doing this on a Mac or Linux gaming PC then let me know and I can add your instructions to the tutorial, but for the time being these are strictly Windows 10 only. You may be able to find information on other OS configuration in the Wake On LAN plugin page for Home Assistant.

First thing’s first, you will need to give your gaming PC a static IP on your router. As there are many different brands and operating systems for routers out there, you’ll need to work this bit out yourself. Check your router’s settings and online tutorials for your make/model/firmware to find out how to do this.

Having a static IP is important as Home Assistant uses the fixed IP to poll the computer’s On/Off status on the network. If your PC gets assigned a random IP each time it turns on, Home Assistant won’t be able to find it on the network and will think it is turned off. In addition, the RPC shutdown functionality, which we are configuring next, will not be able to send the shutdown command to Windows.

Once you’ve given your PC a static IP, make a note of it for later.

Before, we proceed to the next step, backup any valuable data on your gaming PC or create a system restore point that you can restore from in case something goes wrong. Do it.

Next, we need to configure your PC’s BIOS to work with Wake On LAN. Check your PC manufacturer or motherboard manufacturer’s instructions on how to enable this functionality. As I said before, backup your PC before doing this as if you mess up your BIOS you may not be able to get back into your PC. Just follow their instructions carefully and you should be fine. If the instructions don’t match what you are seeing and you are unsure about proceeding, don’t risk changing a setting here as it can mess with how your PC functions. Consult someone who knows what they are doing first.

Once that’s done we need to configure the Windows 10 registry on your gaming PC to accept RPC shutdown commands.

Open the Registry Editor by clicking the Search Icon on your taskbar and typing RegEdit. Click the Registry Editor icon.

WARNING: The Registry Editor is a powerful Windows tool. It’s also really easy to screw up your Windows install. You need to follow these instructions to the letter. These instructions are correct for Windows 10 only as of February 2020. I will not take any responsibility if something goes wrong as a result of you using the Registry Editor. You’ve been warned.

Note: Backup your valuable data. I can’t stress this enough! Recovering lost data from a busted Windows install is more work than retrieving it from an online drive or external storage. Even better, create a system restore point so if you do mess it up you can just roll back.

In Registry Editor you need to navigate to the following path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

If you’re unsure how to do that, follow these steps:

On the navigation pane (left side) of the Registry Editor, click the following:

Click the arrow next to: HKEY_LOCAL_MACHINE
Click the arrow next to: SOFTWARE
Click the arrow next to: Microsoft
Click the arrow next to: Windows
Click the arrow next to: CurrentVersion
Click the arrow next to: Policies
Click the folder once on: System

Then on the right side of the registry editor you should now see a list of items in the System folder of the Registry. In any blank space on the right side, right click, select New, then click DWORD (32-bit) Value.

Enter the following label: LocalAccountTokenFilterPolicy

Once this is created, double click on it and change the Value data to 1.

It should look like this

Now close the Registry Editor. Backup your important files if you haven’t yet done so (and at this point you’re just being outright reckless if you haven’t) and restart your PC.

If your PC boots back into Windows without issue, at the very least you haven’t screwed up your registry. But there’s no quick way to test whether you’ve done it right yet. We’ll do that at the end. Breathe a sigh of relief because the risky stuff is all out of the way now.

Next, we’ll be configuring the RPC Shutdown Add-On in Home Assistant that you installed earlier. If you haven’t installed it yet, do so now.

In Home Assistant click Supervisor on the left menu, then click on the RPC Shutdown plugin you installed earlier. Make sure you click to Start on boot and Auto update at the top, then scroll to Config the bottom of the page.

Paste the following code into the box.

computers:
  - alias: GamingPC
    address: 0.0.0.0
    credentials: user%pass
    delay: 0
    message: Shutting down!

You need to alter this code to accommodate for your own information. I’ll give you a breakdown of what each line means.

Alias: This is the name of your computer. Give it a familiar but simple name. I use GamingPC in my setup. Make a note of the name you’ve given for later.

Address: This is the static IP address you gave your computer earlier.

Credentials: This is your username and password, separated by a %.

If you don’t know your username, here’s a simple tutorial to find it:
Click the search icon on your task bar and type cmd.
Open the Command Prompt.
Type echo %username% and hit Enter.
Your username will now be displayed on a new line.

Delay: This is the delay in seconds before the command to shutdown is sent to the PC. Set this to whatever you want it to be.

Message: When your PC is shutting down a little message will pop-up warning you. You can put whatever you want in here.

Once you’ve put your own information into the Config, click Save. Then scroll to the top and Start the Add-On.

If you’ve done this right, when run this code will send a message to Windows telling it to shutdown. This won’t work if you didn’t make the changes in the Registry Editor above, or if you didn’t save the Config, or if you haven’t started the RPC Shutdown Add-On.

Next, we need to create a Switch in Home Assistant to control your PC.

On the left side, click Configurator. Once the Configurator has loaded, open the configuration.yaml file.

Paste the following code as it is. Do not remove the spaces or change the ordering as this is important to how YAML code works.

# PC Switch
wake_on_lan:
switch:
  - platform: wake_on_lan
    mac: 00:00:00:00:00:00
    name: Name of your PC
    host: 0.0.0.0
    turn_off:
        service: hassio.addon_stdin
        data:
            addon: core_rpc_shutdown
            input: GamingPC

I will give a brief rundown of what each line means.

# PC Switch: This isn’t a line that will be run when code is executed. It is just a comment in the code so you can find the right section easier. Don’t remove the # as this indicates it’s a comment and not code to run. If you remove it your Configuration might break.

wake_on_lan: This tells Home Assistant to load the built-in Wake On Lan plugin. Don’t alter this.

switch: This tells Home Assistant that you are creating a Switch. Don’t alter this.

platform: wake_on_lan: This tells Home Assistant that the Switch will be hooking into the Wake On Lan plugin. Don’t alter this.

mac: This is your gaming PC’s MAC address. You need to put your gaming PC’s mac address here in the following format: 00:00:00:00:00:00

If you don’t know your PC’s MAC address, here’s a simple tutorial on how to find it:
Click the search icon on your task bar and type cmd.
Open the Command Prompt.
Type ipconfig /all and hit Enter.
Look for the line that says Physical Address. It will be displayed in the format 00-00-00-00-00-00
You need to replace the – with : and put that MAC address into your Home Assistant configuration. MAC addresses with the – rather than : will not work.

Name: This is a friendly name for the Switch. Call it whatever you want, and this is the name that will appear in Home Assistant and Logitech Harmony later on.

Host: In here, put the static IP you gave your gaming PC earlier. Home Assistant will ping this IP to see if the PC is turned on or not.

turn_off: Up until now, we’ve been configuring Home Assistant to turn on your PC. This tells the Home Assistant configuration that we’re now adding a command to the Switch to turn the PC off. Don’t alter this.

service: hassio.addon_stdin: This tells Home Assistant we’re going to load an Add-On. Don’t alter this.

data: This tells Home Assistant that we’ve got data from an Add-On to insert. Don’t alter this.

addon: core_rpc_shutdown: This tells Home Assistant we’re going to use the RPC Shutdown Add-On we installed earlier. Don’t alter this.

Input: This is the Alias we used when configuring the RPC Shutdown plugin. If you remember, I used GamingPC. You need to replace GamingPC with the alias you used in the RPC Shutdown Add-On here.

Once you’ve set this up for your own system, don’t forget to save the file!

It should look like this

If all of that is correct, this code will create a Switch in Home Assistant. When turned on, this Switch will turn on your PC using Wake On LAN (this won’t work if you haven’t configured Wake on LAN in your PC’s BIOS). When turned off, the Switch will run the RPC Shutdown plugin and shut Windows down. However, you won’t be able to see it yet.

First, you need to reboot Home Assistant. To do this click on Supervisor in the left menu, then click System, and click Reboot. Once you’ve Rebooted you should then see the Gaming PC Switch in your Overview section of Home Assistant. Test to see if it works by turning on the PC, waiting for Windows to load, then turning it off.

Step 4: Configuring Emulated Hue

Once you’ve added your PC and/or PS4 to Home Assistant, the last step is to configure Home Assistant to masquerade itself as a Philips Hue bridge, which you then add to your Logitech Harmony. The PC and PS4 on/off Switch will appear as a light bulb in this Emulated Hue, which can then be controlled by Harmony and added to any of your Activities without using up one of your device slots.

Note: If you already have a Philips Hue bridge added to Logitech Harmony, you will need to remove the Hue bridge from Harmony. Sometimes when adding Emulated Hue to a Harmony that previously had an authentic Philips Hue bridge, an error occurs. In these instances, the only way to get around it is to factory reset your Harmony Hub and do everything from scratch.

If you want to carry on using your Philips Hue lights with Logitech Harmony you can add the Hue bridge to your Home Assistant (information here), and it will pass all your Hue bulbs through to Harmony once Emulated Hue is added. You will also be able to add other smart home appliances not normally compatible with Logitech Harmony via this method. Examples include non-Harmony bulbs, smart blinds, air conditioning, anything hooked up to a smart plug, or any other kind of smart home appliance compatible with Home Assistant. To see what’s compatible check out Home Assistant Devices.

The first thing we need to do is enable Emulated Hue. This is really easy.

Open Configurator in Home Assistant on the left menu. Navigate to configuration.yaml and insert the following code:

emulated_hue:

That’s it! Now save the file. Next, reboot Home Assistant. To do this click on Supervisor in the left menu, then click System, and click Reboot.

Once your Home Assistant has rebooted we need to add Emulated Hue to Harmony. You add Hue like you would any other Harmony smart home device. Just go through the Harmony app to Add Device, then select Home Control, and select Philips Hue. Harmony will tell you to press the pairing button on your Philips Hue. You don’t need to worry about this step – Home Assistant handles all of that. Your Harmony will begin scanning your network for a Philips Hue bridge. Once it finds Emulated Hue it will automatically add it.

Note: If you already have a Philips Hue bridge on your network, you’ll need to unplug it until Harmony has found your Emulated Hue, or it may detect your real Hue bridge first and not attempt to connect to Emulated Hue.

Once added, you should be able to see all your Home Assistant smart devices as bulbs in your Emulated Hue bridge on Harmony. This should include your PS4 and/or PC. Give them a test and enjoy the moment as both devices turn on and off via the Harmony Hub.

The final step is to add them as Home Control devices to your PS4 and PC activities. Be sure to put them in both the Start Sequence (Always Turn On) and End Sequence. Once this is done, the devices will switch on and off as intended when the activities are run.

As a cool extra, if you add Logitech Harmony to Amazon Alexa or Google Home, you’ll be able to use voice commands.

There are also apps and tools that can add your Logitech Harmony to HomeKit so you can use Siri commands too. There’s a DIY solution that runs on a Raspberry Pi, macOS, Windows or Linux called HomeBridge with the Harmony plugin that adds a “Smart TV” to your HomeKit, with each of your Harmony activities as inputs. If you’re feeling lazy having done all the Home Assistant setup already, there’s a paid turnkey solution on the Mac App Store for those of you with an always-on Mac.

You can also try adding your Harmony Hub to Home Assistant and then using the HomeKit feature that outputs Home Assistant devices to your Apple smart home setup, though I never managed to get it working this way so your mileage may vary.

Now sit back, relax, and never have to get off the sofa to turn on your PC or PS4 again.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.