How To | Scripting a Wake-On-LAN (WOL) packet in Q-SYS

Learn how to create a Wake-On-LAN packet to remotely access a Q-SYS system.

Updated at May 8th, 2023

Your engagement helps us create the content you need. Click here to review this article.

Table of Contents


The Wake-On-LAN (WOL) packet is a special packet sent to a device to activate it.

In this example, we place a Text Controller found in the Scripting Components category.

Change the Name to "Button" and the Type to "Trigger".

The Control Pins could be changed afterwards for your use case.

Here's an example script:

--Down and Dirty WOL packet sender. There are many ways to do this better.
--not adding extra functions as to show concept

--First enter the IPv4 mac address of the destination after each '0x' in the char
mac = string.char(0x00)..string.char(0x60)..string.char(0x74)..string.char(0x00)..string.char(0xD5)..string.char(0x63)

--Then in the quotes enter the IPV4 Address of the interface that will be sending the WOL
SendingIPaddress = ""

--This is the length of time the socket will stay open
TimeInSeconds = 1

--Declare the udp socket
udp = UdpSocket.New()

--This makes the send packet
Packet = ''
Header = ''
Body   = ''
for i=1,6  do Header =  Header .. string.char(0xff) end --builds header of 6 hexbytes of FF
for i=1,16 do Body   =  Body   .. mac               end --builds body of 16 iterations of the mac
Packet  =     Header .. Body                            --combine the two parts

Controls.Button.EventHandler = function (ctl)           --the main function
  udp:Open(SendingIPaddress)                            --Binds UDP to the NIC to Send
  udp:Send("", 9, Packet)                --Sends the Packet that was built to Broadcast Port 9
  Timer.CallAfter(function()                            --internal function timer for a delay
    udp:Close()                                         --Closes the UDP socket
    collectgarbage()                                    --Minor maintenance nice to clean up your workspace
    end,TimeInSeconds)                                  --The close of the delay function with the time specified