Is there a way to switch PC ON Wake On LAN using Smarthub?

this guy is doing some type of wol but i cant read the code
$:.push File.expand_path(’…/lib’, FILE)

require “bravtroller/version” do |gem| = 'bravtroller’
gem.version = Bravtroller::VERSION

gem.summary = "Controller for the Bravia KDL-50W700B"
gem.description = “Controller for the Bravia KDL-50W700B supporting WOL and IRCC (Remote Control emulation). Likely supports other Sony devivces that expose the same services”

gem.authors = [‘Christopher Mullins’] = '’
gem.homepage = '
gem.license = ‘MIT’

gem.add_dependency(‘easy_upnp’, ‘>= 0.1.8’)

gem.add_development_dependency(‘rake’, ‘~> 10.4’)

ignores = File.readlines(".gitignore").grep(/\S+/).map(&:chomp)
dotfiles = %w[.gitignore]

all_files_without_ignores = Dir["**/*"].reject { |f| || ignores.any? { |i| File.fnmatch(i, f) }

gem.files = (all_files_without_ignores + dotfiles).sort

gem.require_path = "lib"

Hi Tyler,

Just wondered if any update since your posting in January.

Still hoping for a WOL feature!!

I’m SO close… OK, I used the device handler from this post and with a minor edit I was able to get that working to at least hibernate my PC from smartthings, but implementing the script file he posted is proving very difficult. I’m using Tomato firmware and I’m coming to the conclusion that it won’t work… In the meantime I’m using a different app that will WOL my PC from anywhere and the device handler above to shutdown my PC (at least I was able to automate the shutdown when I leave my house…)

If anybody has advice on how to get it working on Tomato that’d be swell.

1 Like

Well, I’m one step closer… I found a website/service that will send the WOL packet if you enter the URL with your connection info,. ADDRESS HERE&i=IP OR HOSTNAME HERE&s= HERE

If someone would be willing to modify a smart app (such as the one I posted above) to facilitate this plus a way to “ping” the PC status I’d be stoked… and willing to offer some compensation.

I have a Plex media server and would love to be able to put it into sleep and wake it at certain times of the day (e.g. at night) to save power. Here’s hoping a WOL capability is coming for half of the solution.

1 Like

OK, we can turn the PC on and off but what about something that can ping the PC to keep the status buttons in sync?

Only way I have figured out so far is by using an Iris Power Plug to monitor Power Use. I created a piston in CoRE to keep the Virtual Switch and physical on/off in sync.

Did you get anywhere with this? Is there a way to ping the PC so the button stays in sync? I’d be interested to know.

Hi, below you will find a very simple code for a smart app that you can create on your own. Make sure to create a virtual button first (In the example below, the virtual button’s name is “WOLButton” and its function is one of a “Momentary Button Tile”.

Here is the code:

 *  wakeonlancustom
 *  Copyright 2018 Mihai Floares
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
    name: "wakeonlancustom",
    namespace: "psecto",
    author: "Mihai Floares",
    description: "wake pc on lan",
    category: "My Apps",
    iconUrl: "",
    iconX2Url: "",
    iconX3Url: "")

preferences {
    section("WOLButton") {
        input "WOLButton", "capability.switch", required: true, title: "button?"
def initialize() {
	subscribeToCommand(WOLButton, "push", myWOLCommand)

def myWOLCommand(evt) {
sendHubCommand(new physicalgraph.device.HubAction (
        "wake on lan YOUR_DEVICE_MAC_ADDRESS_without_columns_or_spaces",


That’s it. Enjoy. More details on


Ran across this the other day:

I created my smartapp using your code and inserted the MAC address as instructed (just the letters and numbers). The button push registers under Live Logging as an event posted to the device (the Hub?). However, nothing happens. I can send a WOL packet just fine using a linux machine on the network. But the smartapp won’t actually send the command over and wake up my machine.

Any ideas? Thanks.

It’s strange, in my case the code works.

  • Make sure the that the label of your device is the same to the one your are using in your code. Personally, I’ve set all device’s identifiers the same (in my case wolPC, see attached image).

  • Then, make sure you target the correct button to be used, in the correct location

Now, you’ve said you can send wol packets… is your machine receiving them? On the target device, you can use (for test purpose) a wol sniffer (port 9), I personally used one called “Depicus”.

I hope this helps…

Wow, thanks for taking the time to include pictures! I tried it again and when I clicked Install on the simulator to test it gives me this error:


I used the momentary button tile as the handler so I don’t know why I’m getting the error. I will test it using the actual smartapp on my smartthings app shortly.

From the linux machine I am able to wake the PC by using ether-wake. Thanks for letting me know about Depicus.

I posted my version of this to github. Wrote if for myself a while back so I edited a bit to make it more user friendly…Very similar to @psecto’s…I use a momentary button tile for my setup as well.

1 Like

I’ve ended up using $appSettings. … your version is even better :slight_smile: , thanks for posting.

@mannyfresh2500 you should add the button device under “My Devices”, not “My Device Handlers”.

1 Like

I too tried the revised smartapp, by stephack. I like the ability to enter/change the MAC address on the phone itself.

The button I added was under My Devices. I ran a packet capture capture looking for activity on ports UDP 7 or 9 from my linux machine using tcpdump but I didn’t see anything when I activated the button. This is what is registered on live logging: “Info postEventToEndpoint: event successfully posted.” So the button is executing the code in the smartapp but for some reason my hub is not sending the WOL magic packet.

I double-checked my MAC address of the “sleeping” computer. And I double-checked again that I can wake it up from another machine. Both the smartthings hub and the target machine are on the same switch, same subnet, as is the linux box that can send the WOL packet just fine.

I’m missing something but I’m not sure what it is. Do you have to turn on something on the hub to enable to access the newer API commands? I’m at firmware version 20.00017.

I’ve been using Virtual Switches and a CoRE Piston for this for a while now. I haven’t tried it in webCoRE because I am a firm believer in, “If it ain’t broke…” Doesn’t work with WiFi connected PCs…I use Smart Plugs to turn them on.

I use Host Pinger to check the status of network connected devices.


HI @mannyfresh2500, make sure that your MAC address is in CAPS perhaps?

I’ve not tested the below, but it should work… this is a device handler, install it make sure to select a location and hub when adding it, otherwise it wont work!.. once it is added you can add in the MAC address without the colons or hyphens in the device settings…

Give it a go let me know if it works… worth a try I expect!

// Device MUST be associated to a location for it to work.

metadata {
	definition (name: "WOL", namespace: "jebbett", author: "Jake Tebbett") {
		capability "Actuator"
		capability "Switch"
		capability "Momentary"

	tiles {
		standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
			state "off", label: 'Push', action: "momentary.push", backgroundColor: "#ffffff", nextState: "on"
			state "on", label: 'Push', action: "momentary.push", backgroundColor: "#53a7c0"
		main "switch"
		details "switch"

preferences {
input("myMac", "text", title:"MAC Address without colons", required:false, displayDuringSetup:true)

def push() {
	def result = new physicalgraph.device.HubAction (
    "wake on lan ${myMac}",
log.debug result

def on() {

def off() {
	// nothing

I think you need to use sendHubCommand(result) for the HubAction to work.

1 Like

Codes taken from the official ST documentation: (not saying that’s not wrong btw)