Need Help Improving Computer ON/OFF Control

So, I’ve cobbled together a system that will turn my computer on and off (nice way to save energy when I’m away from my home), but now that Smartthings supports WOL I figured now would be a good time to ask about possibly improving it. Here’s how mine currently works:

I used the info from this post along with this program to turn the computer off/standby/etc…

I had to modify the code to get it to work with that particular program, and unfortunately it does not monitor my computer’s on/off state, but otherwise it has worked flawlessly. I’m just wondering if I can eliminate the need for a script running on my router AND if my computer’s on/off status could be monitored. I’ve tried messing with the code myself but I’m still pretty new, and my programming skills are lacking all around.

Any assitance would be greatly appreciated.

EDIT: The program I linked to previously was NOT the one I intended to link to… sorry for the confusion.

Support for WOL was recently added to CoRE as a task that takes the mac address as a parameter. I would greatly appreciate it if you could test it please?

1 Like

I will test it now and get back to you.

1 Like

It works! I’m new to CoRE (as in, I just saw the post announcing the new beta and I installed it… funny you should respond!), so I have it set like this currently:
IF
iPhone is present
THEN
Send WOL to my computer’s MAC.

Now, will it just continue to sent the WOL packet, should I set the piston to only execute on piston change or something similar? I guess I’ll have to look into the HTTP request option I also saw and see about using that… Great stuff, really can see this becoming immensely useful, if for nothing more than eliminating my need to have a script running on my router!

EDIT: Never mind, I changed it to “Changes to” for my phone presence… sorry for the dumb question :slight_smile:

In that simple form, both is present and changes to present would donthe same. WOL magic packet is only sent when you arrive. You would have to leave and return for thr WOL to be sent again.

Thank you for testing it for me, appreciate it

1 Like

Wow never new you can get the hub to send WOL/Magic packets, might have to quickly test this! I have a few servers which would be ideal for this.

Shame SOL (Sleep/Shutdown On LAN) doesn’t exist lol. Although I might be able to write a batch script to do that. I’ll be following this thread for ideas now :slight_smile:

This should save me some cash on electric bill!

Kraeg

WOL support has only existed for 17 days so it’s fairly new. The way I do SOL is with the app I linked to above, it’s as simple as visiting a URL and it shuts down my computer.

1 Like

Yeah and CoRE only supported it for 4 days :wink: fairly new feature there…

1 Like

Really appreciate all the hard work you and everyone else involved with CoRE are putting in, a well deserved donation is headed your way.

Also, I previously mis-linked to the program for Sleep on lan that I was using. This is the program I am currently using: http://www.ireksoftware.com/SleepOnLan/

2 Likes

Thank you, much appreciated :wink:

@egoods more documentation on the WOL feature here. @Tyler is the man :slight_smile:

@Tyler Looks like your WOL feature is getting its share of glory. How about a SOL feature as well?

UPDATE: I don’t think Windows implements SOL, a software is required for that. Linux may be in the same bucket? As far as I know, WOL is a BIOS feature, supplemented by network card support for WOL. SOL poses risks as far as BIOS support (imagine your office computers all going to sleep randomly… because one is infected…)

Thank you,
Adrian

I tried WoWLAN tonight and couldn’t make it work with CoRE. BIOS is set up, network card is set, power manager set up. Everything seems to be set up, but no magic happens. I’ll play more tomorrow, but hypothetically should work, right? Thoughts…

1 Like

Few questions (might be similar issue to @SBDOBRESCU above.

I have setup 1 simulated switch.

Made two CoRE pistons for the following:

PCWakeup:
If computer switch changes to on

Wake on LAN [MAC Address without :]

PCShutdown:
If computer switch changes to off
Make a GET web request to http://[PCs-IP]:[Port]/hibernate

Questions:

Now does the Port need to be externally facing? (is the magic packet coming from Cloud or actually from the hub so a 192.168.. ok?)
Do the web requests have the same? Or do I need to expose that SleepOnLAN software to the internet? (Dont like that idea, somebody portscans my IP and it’ll shut my PC down)
Is visiting a webpage (to shut the PC down) just a GET?

Kraeg

WOL is mac addressed, not IP. It shouldn’t traverse routers. The action is sent locally by the hub, no need to open any ports. There aren’t any ports, as far as I know. At least, the receiver is not looking for any particular port, but for a 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF and the mac address pattern.

As for the get web request, that one is done from the cloud. There were plans to add one for local access, not sure if I ever finished it. Will check tonight.

Cheers @ady624, I wasnt thinking clearly with WOL and MAC.

Be handy if we could send a GET request (or what ever is needed) from the hub, I know your hands are tied with most things but that’d be cool! I could use it for a few different bits and pieces.

At least I’ve got it all setup and ready for when I get a bit more time to sit and look at it.

Kraeg

WoWLAN works too!!! Nice work @Tyler & @ady624

1 Like

The Sleep on Lan service would need to be outwardly facing, but I don’t know that it’s particularly susceptible to port scanning… I’m far from an internet security expert and I know in a corporate environment it would certainly be a no-no, but they would have to not only port scan and know what port you have the service running on (you can change it to whatever port you’d like), but also how to use the service (/hibernate, /sleep, etc…) and that that’s what’s running at that port. All that and what does it gain the attacker? So they hibernate or shut off your machine, you realize what’s going on and stop running the service? I just don’t see it being a massive issue.

I’ve not been able to get it to work with CoRE yet, I’ll do some more testing this evening.

Well, my current setup still seems to be working (aside from being decidedly cobbled together and not at all streamlined, and current PC power status doesn’t work at all). I’m working my way through the Smartthings Groovy documentation, if I ever get to a point where I have a simplified solution working I’ll be sure to share.

Same boat here. Can turn on/off PC no problems but the PC status is what has to be worked on.

My current solution is to use an Iris SmartPlug which monitors Power. If the Power drops below 1W then the PC is considered off and visa-versa.

However, it would be cool if there was a ping command just like the web request to hibernate or shutdown. If the ping comes back then PC is on. If the ping does not come back then the PC is off. Could ping every 5 minutes?

Another solution I am working on is to use EventGhost to send PC status to ST. But Virtual Switches do not have end points so I am stuck…

Anyone?

If you have a tablet in your house doing smartiles, or some other function. You could use Tasker to ping your pc from it and set and virtual switch using sharptools.

I was doing this to our phones as and test for arrival / departure. Worked well except for the Iphones.