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

I gave you an option earlier. I have full control of all of my PCs using a combination of CoRE and Event Ghost…

YMMV but all of this work is already done for you.

1 Like

I’m going to explore this option too. Thanks!

@mannyfresh2500 try to reboot the hub using the reset physical button on its back. When the Hub is back online, its LED will turn solid green. This solved comms problems for me a couple of times.

I already had webCoRE set up from a previous experiment, so I decided to simply use a piston that executes a WOL action based on a button push. It’s something like @rontalley suggested but I don’t need the extra functionality of eventghost and all that at this time. I just didn’t realize webCoRE did WOL. So thanks for the idea! My hub sent a WOL packet successfully using a piston.

1 Like

I should have really read the rest of the documentation…

So I guess swapping out the below should fix it

log.debug result
for
return result

I also fall in to this category too: :slight_smile:

1 Like

@mannyfresh2500, did you ever get this working?

Last night I tried to create another WOL handler for another pc using my Boot Me Up app and it failed as well. To test further, I removed and readded my previously working instance for my original pc and it also failed to work…huh?

While trying to fix, I am seeing a lot of inconsistencies with how the app was subscribing to the switch events and it would work at one moment and not work after changing an insignificant piece of text in the code. Really strange behavior. Especially the inconsistent logging.

In any event, I completely deleted the old app from my IDE and rewrote it and instead passing the “return result” from another method and it appears to work. I no longer try to figure out why things work the way they do with ST anymore. As soon as my Hubitat adds this WOL feature I plan to port this over and rely on ST for one less thing. See code below and I hope you have better luck with it. DON"T FORGET TO COMPLETELY REMOVE THE OLD APP. DO NOT TRY TO REPLACE THE CODE IN PLACE.

definition(
    name: "Boot Me Up Scottie",
    namespace: "stephack",
    author: "Stephan Hackett",
    description: "Activate WOL Magic Packet",
    category: "Convenience",
    iconUrl: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png",
    iconX2Url: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png",
    iconX3Url: "https://raw.githubusercontent.com/stephack/Virtual/master/resources/images/power.png")

preferences {    
    section("Choose Switch") {
    	input "myDevice", "capability.switch", required: true, title: "Choose a Switch"
        input "myMac", "text", required: true, title: "MAC of workstation"
    }
}

def installed() {
	log.debug "Installed with settings: ${settings}"
	initialize()
}

def updated() {
	log.debug "Updated with settings: ${settings}"
	unsubscribe()
	initialize()
}

def initialize() {
	subscribe(myDevice, "switch.on", myHandler)
}

def myHandler(evt) {
	log.info "${myDevice} activated"
    sendHubCommand(createWOL())
}

def createWOL(evt) {
    log.debug "Sending Magic Packet to: $myMac"
    def result = new physicalgraph.device.HubAction (
       	"wake on lan $myMac",
       	physicalgraph.device.Protocol.LAN,
       	null
    )    
    return result
}
1 Like

My CoRE piston did the trick for me. I just needed something simple. I will post the code here shortly. It is based on something I saw but I can’t remember where exactly I saw it. The MAC is bogus, so ignore that and put in yours. Hopefully this screenshot will upload correctly.

1 Like

Glad you got it working. If I planned to stay with ST I would have used Core as well. But I’ve pretty much migrated to Hubitat and only use my ST hub for Hue and this WOL component. I’m sure others will appreciate you sharing your piston though.

What are the parameters to add this as a Github integration?

Also, on another note… does the router have to have something for WOL to work?

Typically no. You do have to make sure that your PC is setup to receive the command. It’s typically in the BIOS which is accessible by pressing delete, F5 or similar while the PC is booting.

Motherboard settings vary from brand to brand so just look up your model and then enable WOL.

1 Like

I’ve got an Asus Prime Z270A mb… I’ve seen where the supposed wol settings are… but the Boot Me Up app isn’t doing anything… (I admit it, I haven’t read this entire thread) … I set up a WOL PC button and added it to the app… put the mac address both in upper and lowercase but nothing… I didn’t try with “:” in between… could that be it? I took the app straight from @stephack 's github…

Did you enable WOL on your motherboard?
It should work with or without the “:” but I recommend you don’t include them.

I think I did… but not sure how to check…

Well that’s the first thing you would need to confirm. There are also WOL mobile apps that you can use to verify functionality.

1 Like

I read somewhere that it might take a while for the device to be listening to the magic packet… how long might that be?

It should respond in almost immediately. Definitely less than 5 seconds in my experience.

I must have something wrong in the config… I installed an app on my android tablet and it sees the pc… with a green light when it’s on, and a red light when off… but it just won’t wake it up no matter how many times I click the pc… ugh…

Hi all,

I used @psecto 's code, and my SmartApp works great from within my ST iPhone app. I open my app, go to My Home, click on wolPC “PUSH” and my PC wakes right up.

Here’s my problem, though, I can’t get my Amazon Echo to wake my PC using the same ST device!

See attached pics. I scanned and added the wolPC device just fine in my Alexa app (renamed Dad’s Computer in pics below), and when I click on it it sends info to ST, but the PC doesn’t wake up. Hmmmm. So confusing heh.

Any tips would be appreciated (btw I’ve changed the name of the command in Alexa app and removed and readded the device countless times).

TIA.

@stephack
Hi Stephan, I’m using your code but I can’t wol my PC.
My network, Bios etc… are correctly configurated (infact, I can power my PC ON with the Wake On Lan app on my android phone).
I entered mac address in capital caracthers and I changed “myDevice” in “PC” (created as Momentary Button Tile in area “My devices” of ST).
I installed the smartapp in home/phisical device/my MAC address

Where am I wrong?
Inside ST app for my android device I can see “PC” but I can’t control it.

Unfortunately this app was designed to work with the Smartthings Classic interface (the one they are slowly replacing with the version you are currently using). I no longer use smartthings for my automations and have no way of recreating this for use in the new app. Not sure if it’s even possible. Maybe someone in the community might be able to help you port this over. It’s a very simple app. Good luck.

Stephan