Logic Machine Forum
WoL script problem - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: WoL script problem (/showthread.php?tid=687)



WoL script problem - leondias - 20.03.2017

Hello,

Is there any simple Wake-On-Lan script, to wake PC by Logic Machine?

I tried to use code from thread:
http://forum.logicmachine.net/showthread.php?tid=33&highlight=wake
but it doesn't work.



Just found a working script:

Code:
function wol_send(mac_dest)

 local mac = ''
 for w in string.gmatch(mac_dest, "[0-9A-Za-z][0-9A-Za-z]") do
   mac = mac .. string.char(tonumber(w, 16))
 end
 local udp = require("socket").udp()
 udp:settimeout(1)
 udp:setoption("broadcast", true)
 udp:sendto(string.char(0xff):rep(6) .. mac:rep(16) , '255.255.255.255', 9)
 
end

CASE CLOSED  Smile


RE: WoL script problem - admin - 21.03.2017

Have you actually checked that WOL works? This script doesn't work for me on the latest FW, it requires some changes to the socket library to make it work.


RE: WoL script problem - leondias - 21.03.2017

(21.03.2017, 07:15)admin Wrote: Have you actually checked that WOL works? This script doesn't work for me on the latest FW, it requires some changes to the socket library to make it work.

Yes, with this script (bottom one) I can wake NUC PC without any changes.
We are using LM5 lite which we received last week, so it should be latest FW i think.