HomeAlexaHow to wake on LAN computers and put it to sleep with...

How to wake on LAN computers and put it to sleep with Power Menu, Alexa and Google Assistant

Best way to wake on LAN to date

One of my Power Menu actions on my Android 11 phone is Wake on LAN (WOL). It’s a custom tile that sends the Magic Packet to my computer AND keeps taps on the computer’s status. It’s not just a blind shortcut to wake up the computer from sleep, but a dynamically updated Smart Menu, that supports remote sleep and wake-up actions. I will show you how to successfully pull it off on your mobile phone, and even add smart assistant integration like Alexa or Google Assistant.

Simple WOL vs AWESOME Wake on LAN

It’s not the first time I wrote about the WOL, but this is going to be the most definitive guide to Wake On LAN. There is more than one way to skin this WOL cat so I’m going to split this tutorial into 2 sections: Simple and minimalistic, that shows you the bare minimum to wake your computer (and put it to sleep) and the proper way, which has all the bells and whistles.

Features of the full Wake on LAN server:

  • Client-Server structure
  • Web interface
  • Android Power Menu for multiple devices
  • Alexa and Google Assistant integration
  • REST endpoints
  • Wake up|State Monitor|Sleep functions
  • Integration with other projects

Setting up computers for Wake on LAN

Before we start, please make sure that your internet adapter is configured correctly. Not all adapters support WOL, and you will have to research if the adapter that you have installed is Wake on LAN capable.

Your first step is to visit BIOS settings, as WOL settings can be hidden there, especially for laptops with WiFi cards that support Wake on LAN. As BIOS menus vary check all the options, especially the ones responsible for power management and networking.

Your second step is to enable the Wake on LAN in Windows, (or OS of your choice). Access the properties of your internet adapter, head to configure section and Power Managment tab. You should enable options:

  • Allow this device to wake up the computer
  • Only allow a magic packet to wake the computer

It’s a smart idea to check the Advance tab too, as advanced network cards have extra features that can override the Windows settings. In general, if you can’t wake up the device, your adapter isn’t allowed to wake up the computer, and if your computer keeps waking up itself every few minutes, the magic packet option isn’t configured properly.

Simple & minimalistic WOL

I will strongly advise considering a proper Wake on LAN server, as it will enable you to do so much more. You can host a NodeRED server on a Raspberry Pi Zero which is only $5, in case the cost is your primary concern. NodeRED powered by a Raspberry Pi Zero will be still completely functional even as an automation server (although the web interface will be less snappy).

Requirements:

The WOL app can be used in a stand-alone mode, so if you are looking for a handy home screen shortcut – you don’t even need Tasker. The app will send WOL packages and confirm that the target is online using ping. You will need the IP and the MAC of the desired network card and you are all set.

Be advised that to use this remotely, you will need to forward port 9 and map it to your PC and provide your WAN IP or DNS to reach back your home network. The app will even scan the local network for you to find your WOL target. This could be enough for you, but if you want schedules, or automatic wake on LAN when you walk back home, you will need to use it with Tasker.

Tasker Wake On LAN

The advantage of using the WOL app as a plugin in Tasker is that you can change when and how WOL is executed. Tasker can monitor your WiFi SSID and issue commands locally when you are at home, or send the request via DNS while you are away. Tasker can also put the computer to sleep, something that the WOL app can’t do on its own.

I composed the Tasker-only version that apart from utilising the WOL app as a plugin, uses EventGhost and Join to send computers to sleep. Just like the WOL app, you will be able to see the current device status thanks to the IP option.

Features

  • Wake on LAN
  • Remote WOL
  • One tap wake/sleep
  • Sleep commands
  • Other triggers

This profile will send the wake on LAN packet directly to your computer, so you won’t be able to add Alexa or Google Home controls. If installed on multiple devices, Power Tiles will update their state thanks to the ping option. This project leans heavily on my initial Power Menu project.

You will be asked to customise the following options:

VariableFunction
%targetnamename of the target device in Join app (sleep purposes)
%dnsDNS or external IP (must have port 9 forwarded)
%targetiplocal IP of the target device

You will be asked these on import so it’s a good idea to have it handy. To enable remote sleep, you will need the Join app installed and the EventGhost with Join/AutoRemote plugin installed on your Windows machine.

The EG profile is very simple: when a command is received, the computer enters sleep and no longer responds to ping. This information is then displayed on the Power Menu card. If you don’t have an Android 11 device, you can replace the power menu with Autonotification Tile.

Full Metal Wake on LAN

To create a proper wake on the LAN server the requirement list is longer, but you will gain more functionality and support for multiple clients/targets and more. This project is easily scalable on both sides with the framework supporting multiple tiles, target devices and Android phones. This is the part that supports all the functions listed at the beginning of the article. While the requirement list is longer, the deployment process isn’t tasking (oh the pun).

To make it work you will need the following:

In addition to the above following nodes have to be installed in NodeRED:

  • node-red-contrib-alexa-home-skill (enable Alexa integration)
  • node-red-contrib-smartnora (enable Google Assistant integration)
  • node-red-dashboard (enable Dashboard)
  • node-red-node-ping (device status monitoring)
  • node-red-node-wol (enables WOL, sends Magic Packet)

Then simply import separate profiles for Tasker, NodeRED and EventGhost set properties listed below and you are ready to rock. This project utilises my previous project – Power Menu in Tasker, which laid down the foundations for individual scenarios like this.

EventGhost

EventGhost is responsible for putting the computer to sleep. It uses the Join command system to intercept the commands sent to Chromium Join Extension and sends the computer to sleep when the “Sleep” (very creative right?) command is received.

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-rc6">
    <Macro Name="Sleep" XML_Guid="{DFB5D34C-090F-4011-93EB-86C527C154D5}" Expanded="True">
        <Event Name="AutoRemote.Message.Sleep" XML_Guid="{5F107B17-2772-4A02-A932-0BFD94D62676}" />
        <Action XML_Guid="{F144E4E0-C62F-418B-93FA-E3D7E75574AB}">
            System.Standby(True)
        </Action>
    </Macro>
</EventGhost>

Import the project (copy and paste the text) in EventGhost. To make the sleep command work, you need to add AutoRemote/Join plugin to available plug-ins in EG. More about how EventGhost works are outlined in this post. Other than accepting commands (you must forward port 1820 if you are using WOL remotely), this stage requires no further configuration. Your computer will hit sleep as soon as the command is received.

Tasker

Tasker is responsible for displaying the correct state of the Power Menu tile and issuing correct commands on touch. The original project was made to be reusable, so all you need to make it work with WOL is to assign the correct command:

PowerMenu=:=wol=:={"tileType":"button","title":"PC","subtitle":"Updating","icon":{"on":"Tasker/icons/PowerMenu/pc-on.png","off":"Tasker/icons/PowerMenu/pc-off.png"},"range":{"min":0,"max":100,"step":1,"format":" "}}

Import the Tasker profile, and place the included icons (provided by icons8.com) in Tasker/icons/PowerMenu folder. Assuming that you already set up the Join app, provide the name of the NodeRED join server. The imported task will take care of the rest and run the init task for you.

As Tasker cannot add the Power Menus automatically, add the new Wake on LAN card in your Power Menu (or Smart Home menu) to your active roster. The profile will take care of the rest for you. Bear in mind that each tile has to have a unique ID – if you going to create a wake on LAN for multiple devices, you will need to edit the start-up task to include that.

NodeRED

NodeRED will take care of issuing Wake on LAN packets, pinging targets and relaying the information between all Android devices and smart assistants. The flow I had created is modular, so if you don’t need specific parts of it (like the dashboard or smart assistants) you can simply remove it from the flow without impacting its processes.

Import and deploy the NodeRED file. In settings, you will find everything that you need to modify to make it work. It will ask you for your Join devices names, Target PC IP and MAC etc. Once the settings are set, deploy the project and run the Power Menu tile once. It will complete the setup process.

Final Thoughts

I’m really pleased with the result. Cluttering the home screen on my phone is not for me, and with existing Power Menu tiles, it’s the most accessible way. It’s not the last Power Menu tile in my rooster. In my upcoming articles, I will show you how to get sensor data displayed in a single tile (from multiple locations) and reassign the tiles to different rooms with a button click. If you want to see more Power Menu experiments, you know how to find me. If you have other (and probably better than mine) ideas, feel free to let me know in this Reddit thread.

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

New to Tasker?

Tasker Quick Start – Getting started with Tasker

0
From newb to not so newbie in 10 min

Best Tasker Projects

How to use Raspberry PI as WOL (wake on lan) server

0
While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

7 awesome Bluetooth keyboard shortcuts for Android

0
7 unique Android shortcuts that you can add to any Bluetooth keyboard.

Smart overnight charging with Tasker

0
Still keeping your phone plugged in overnight? Try smarter overnight charging with this profile

One thing that Join app can’t do and how to fix it with Tasker

0
It's not possible to share the clipboard automatically between join accounts registered to 2 different emails. But you can fix this with tasker.

Tasker: Set USB for file transfer automatically

0
One of the most annoying things in new Android is the inability to trust USB devices permamently

Essential Guides

Tasker: Seconds into DD:HH:MM:SS (dynamic)

0
It's time to.... ok it's a pun, but I will show you how to master time and convert seconds to DD:HH:MM:SS dynamically

4 ways to organise Tasker projects

0
Keep your Tasker tidy!

A better way to store Tasker credentials

0
The more clever way of managing credentials

Annoyed with dozens of AutoApps populating your app drawer? Here is a fix!

0
Clear your app drawer from the clutter in seconds

Putting AutoTools pie chart to a good use – SSID logger

0
Who wants a piece of the pie (chart)?