Home Tasker Projects Turn a computer on and off using Android and Google Home

Turn a computer on and off using Android and Google Home

-

If you’re looking for a way to turn a computer on and off using an Android smartphone or a Google assistant enabled speaker, You have found the right tutorial. Today I’m going to show you how to do just that with the help of a few applications.

 

To accomplish this, we are going to use the following:

Before you get started the first thing that you want to check is that your computer’s motherboard supports Wake on LAN (WOL) and that is enabled in the BIOS. All motherboards are different, so this part will not be cover on this tutorial. You can refer to your motherboard manual or your computer’s manufacturer.

 

Step 1: Create 2 IFTTT applets.

We need to create 2 IFTTT Applets. One to turn on the computer and the other one to turn it off. We will be using the Google Assistant service and Webhooks from IFTTT. We are also going to need the Join API for the Webhooks service so we can send the commands to Tasker on an Android device and EventGhost in a computer.

 

IFTTT (If This Then That)
IFTTT –If This Then That– Beginner’s guide

Go to IFTTT, click your Username and then click on New Applet. Select This and then look for Google Assistant. Choose the trigger, Say a simple phrase. Then, on the first field, type turn computer on. For the second, enter turn on computer. And, for the third one, type turn pc on. Now, for the Google Assistant response enter, Turning computer on and then click Create Trigger.

This setup - Turn on PC

Join by joaoapps – Ultimate beginner’s guide
Join by joaoapps – Ultimate beginner’s guide

Now select That, search and select Webhooks and choose the action Make a web request. On a separate tab, go to https://joinjoaomgcd.appspot.com/ which is the Join web interface. Select your Android device and then click on Join API. Under the API Key, click on Show so the key gets displayed and the URL gets populated. Under the Text field, type pc_on. Then, copy the URL and go back to the IFTTT website and paste the link under the URL field.

Join api - Turn on PC

 

The whole URL will look like this now:

https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush?text=pc_on&deviceId=Your_device_ID&apikey=Your_api_key
Now, change the Method to Post and then click on Create action. Last but not least, click on Finish.

Webhooks - Turn on PC
For the second Applet to turn the computer off, follow the same steps as above but change turn computer on to turn computer off. Also, for the Join API, select the computer that you would like to turn off and then for the Text field type pc_off. Copy the URL and go back to the IFTTT website and paste the link under the URL field. The URL should look like this:

https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush?text=pc_off&deviceId=Your_device_ID&apikey=Your_api_key

 

Step 2: Setup EventGhost

OK, so we have the 2 IFTTT Applets created. Now, let’s create the Macro in EventGhost that will turn off the computer.

Note: setting up Join in EvenGhost won’t be cover in this tutorial, but you can find the steps on how to do it in this tutorial here.

Open EventGhost and click on Add Macro. Then go into System, Power and select Shut Down. Select Force close of all programs and then click OK. Now, we need to add the event that will trigger the action to turn off the computer so open the Join Chrome extension, select Send an EventGhost command, then enter pc_off and press Ok.

Join extension - EG command pc_off

Now, on the EventGhost Log tab, you will see the shutdown command like this: AutoRemote.Message. u’=:=pc_off’. Drag it to the Configuration tab and drop it between the Forced: Shut Down Macro and the Forced: Shut Down Action. Last but not least, click on Save, so the changes take effect.

EG - Event pc_off

 

Step 3: Set up the Wake on LAN app

Now let’s head over to the Android device to set up the WOL app. We are going to use the Wake on LAN app by Mike Webb because it also works as a plugin for Tasker allowing us to automate the whole process. Once downloaded, open the app and tap on the Plus+” icon to add a new device. From the list, select the computer that you would like to turn on remotely and then tap Add Device.

WOL - Add devices Setup

 

Step 4: Create a Tasker Profile

After the WOL is setup, we have one last step to do and is to create a profile that will trigger the command to wake up the computer when we ask the Google Assistant.
Open Tasker, tab on the Plus+” to create a new profile. Tap on Event, Plugin, Join, Text and Text Filter. Type pc_on and then tap OK. Now, go to Variable Names and type pcpower. This will create a variable name %pcpower.

Tasker - Join Profile setup

 

Back out and create a new Task named PC Power. Now, tap on the Plus +” to add a new Action. Then go to Plugin, Wake on Lan and select the computer that you would like to turn on remotely. Back out completely from Tasker to save the changes or You can also press the checkmark icon at the top right corner.
Ok, so we are done with all the steps. Whenever you ask the Google Assistant on your smartphone or smart speaker, IFTTT will be listening and will send the command to Tasker on your Android device to turn on the computer or to EvenGhost on your computer to turn it off.

 

Troubleshooting steps

If you have issues where WOL is not turning the computer, check if it’s enabled in Windows by going to Start, Search and select Device Manager, expand Network adapters, select your Ethernet controller and then go to Power Management. In there, make sure that “Allow this device to wake the computer” and “Only allow a magic packet to wake the computer” are selected.

Device Manager WOL Enabled

 

If the computer is restarting on it own after you shut it down, then check that Fast Startup is disabled. Click on Start Search and select Control Panel, Select Power Options and at the top left corner select Choose what the power buttons do. If the Shutdown settings are grayed out, click on Change settings that are currently unavailable and then uncheck Turn on fast startup.

Power options - Fast Boot

 

If you guys have any questions or suggestions for future tutorials, definitely let me know. I’m usually most active on Twitter, but you can also reach me via Facebook and Google+. Also, don’t forget to subscribe to my YouTube channel for more awesome videos.

 

Related articles

WANT TO SUPPORT JUANMTECH?

You can do so now on Patreon and Buy Me A Coffee