Wake on Lan

Client Apps for other platforms, integrations from other controllers, etc.
ginganinja
Posts: 12
Joined: Mon Jan 14, 2019 10:11 pm

Wake on Lan

Post by ginganinja »

Hi All,

Was struggling with performing WakeOnLan functionality from within Indigo and found something I think is worth sharing.

It starts with the following piece of software, that is my favorite price, free!!!

http://www.readpixel.com/wakeonlan/

Download and install this on your Mac, now use their client software to test and troubleshoot your wake on lan functionality.

Once you get it working, you can then use Apple Script to call this app from within an Indigo Action Group.

Sample script:

tell application "WakeOnLan"
wakeup "192.168.4.135"
end tell

The other nice thing about this software is that I did a network sniff and basically the approach is to try about 6-7 different types of WakeOnLan signals (wonderful thing about standards is that there is so many to choose from). So your chance of getting it working is quite good.

Let me know if you have any questions/concerns, would be glad to help out.
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Wake on Lan

Post by DaveL17 »

Interesting. I don't have a need for this, but thanks for sharing.
I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]
User avatar
kw123
Posts: 8421
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: Wake on Lan

Post by kw123 »

here a python version. No need to install anything
You can put this into an action script and replace MAC number with your device number and the IP number to your BroadCast # likely ends with .255 (192.168.0.255 etc)

Code: Select all

import socket

def sendWakewOnLan(MAC,ipN):
	data = ''.join(['FF' * 6, MAC.replace(':', '') * 16])
	sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
	sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
	sock.sendto(data.decode("hex"), (ipN, 9))

ipBC= "192.168.1.255"
mac = "12:34:56:78:AB:CD"
sendWakewOnLan(mac, ipBC)
Karl
ginganinja
Posts: 12
Joined: Mon Jan 14, 2019 10:11 pm

Re: Wake on Lan

Post by ginganinja »

Thanks Karl!

Agreed, I would rather call it straight from an action group. I'll give this a try and let you know how it works out.

RS
User avatar
kw123
Posts: 8421
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: Wake on Lan

Post by kw123 »

Ps. Fingscan as well as UniFi plugins have ping and wol as options to manage up/ downs of ip devices build in.


Sent from my iPhone using Tapatalk
ginganinja
Posts: 12
Joined: Mon Jan 14, 2019 10:11 pm

Re: Wake on Lan

Post by ginganinja »

Karl,

I test out your script and it worked great.

Thanks for the tip.

I will look into the other plugin's as well, but the script is pretty easy/fast.

RS
ginganinja
Posts: 12
Joined: Mon Jan 14, 2019 10:11 pm

Re: Wake on Lan

Post by ginganinja »

Turns out that i already had winremote plugin installed and totally missed that it has wakeonlan, am using that now.
User avatar
whmoorejr
Posts: 767
Joined: Tue Jan 15, 2013 11:23 am
Location: Houston, TX

Re: Wake on Lan

Post by whmoorejr »

kw123 wrote:here a python version. ....

Code: Select all

import socket

def sendWakewOnLan(MAC,ipN):
	data = ''.join(['FF' * 6, MAC.replace(':', '') * 16])
	sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
	sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
	sock.sendto(data.decode("hex"), (ipN, 9))

ipBC= "192.168.1.255"
mac = "12:34:56:78:AB:CD"
sendWakewOnLan(mac, ipBC)
Did something change? None of my old WOL scripts run anymore. Now I just get an error.

Code: Select all

   Action Group                    Wake On LAN - 2nd Attempt
   Script Error                    action group "Wake On LAN - 2nd Attempt" embedded script error:
   Script Error                    'str' object has no attribute 'decode'
   Script Error                    Exception Traceback (most recent call shown last):

     embedded script, line 11, at top level
     embedded script, line 7, in sendWakewOnLan
AttributeError: 'str' object has no attribute 'decode'
Bill
My Plugin: My People
User avatar
kw123
Posts: 8421
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: Wake on Lan

Post by kw123 »

It’s python3

Will post a py3 version this weekend


Sent from my iPhone using Tapatalk
User avatar
kw123
Posts: 8421
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: Wake on Lan

Post by kw123 »

Sorry I am out of town. Will have to wait until Tuesday next week.
Just became grandfather


Sent from my iPhone using Tapatalk
User avatar
DaveL17
Posts: 6845
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Wake on Lan

Post by DaveL17 »

Congratulations Grandpa!


Sent from my iPhone using Tapatalk Pro
I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]
User avatar
kw123
Posts: 8421
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: Wake on Lan

Post by kw123 »

This should work with py3

Karl

Code: Select all

import socket
import struct


def sendWakewOnLan(MAC,ipN):
	mac = MAC.replace(":","")
	sendData = bytes.fromhex("FF" * 6 + mac * 16)  #  <---- changed from py2
	sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
	sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
	sock.sendto(sendData, (ipN, 9))

ipBC= "192.168.1.255"
mac = "12:34:56:78:AB:AB"
sendWakewOnLan(mac, ipBC)
User avatar
whmoorejr
Posts: 767
Joined: Tue Jan 15, 2013 11:23 am
Location: Houston, TX

Re: Wake on Lan

Post by whmoorejr »

kw123 wrote:This should work with py3

Karl
Worked like a charm. More importantly, how's that grandbaby?
Bill
My Plugin: My People
User avatar
kw123
Posts: 8421
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: Wake on Lan

Post by kw123 »

Mom and baby are doing fine. As they live in Chicago and we in Vienna it will take some time before we see them.


Sent from my iPhone using Tapatalk
Post Reply

Return to “Other Applications and Integrations”