Wake on Lan

Posted on
Sun Jan 20, 2019 7:15 pm
ginganinja offline
Posts: 12
Joined: Jan 14, 2019

Wake on Lan

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.

Posted on
Tue Jan 22, 2019 7:05 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Wake on Lan

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]

Posted on
Tue Jan 22, 2019 11:08 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Wake on Lan

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

Posted on
Wed Jan 23, 2019 8:16 am
ginganinja offline
Posts: 12
Joined: Jan 14, 2019

Re: Wake on Lan

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

Posted on
Sat Jan 26, 2019 6:17 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Wake on Lan

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

Posted on
Mon Jan 28, 2019 10:47 pm
ginganinja offline
Posts: 12
Joined: Jan 14, 2019

Re: Wake on Lan

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

Posted on
Mon Jan 28, 2019 11:04 pm
ginganinja offline
Posts: 12
Joined: Jan 14, 2019

Re: Wake on Lan

Turns out that i already had winremote plugin installed and totally missed that it has wakeonlan, am using that now.

Posted on
Fri Sep 01, 2023 8:40 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Wake on Lan

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

Posted on
Sat Sep 02, 2023 12:22 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Wake on Lan

It’s python3

Will post a py3 version this weekend


Sent from my iPhone using Tapatalk

Posted on
Tue Sep 05, 2023 11:26 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Wake on Lan

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


Sent from my iPhone using Tapatalk

Posted on
Tue Sep 05, 2023 11:32 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Wake on Lan

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]

Posted on
Tue Sep 12, 2023 2:17 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Wake on Lan

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)

Posted on
Tue Sep 12, 2023 8:17 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Wake on Lan

kw123 wrote:
This should work with py3

Karl

Worked like a charm. More importantly, how's that grandbaby?

Bill
My Plugin: My People

Posted on
Wed Sep 13, 2023 4:00 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Wake on Lan

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

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest