Wol

Wake-on-LAN (WoL) magic packet sender with optional SecureOn support.

Installation

Add :wol to your list of dependencies in mix.exs:

def deps do
  [
    {:wol, "~> 0.1.0"}
  ]
end

Usage

Send a magic packet to the default broadcast address on UDP port 9:

:ok = Wol.send("00:11:22:33:44:55")

Options

Wol.send/2 accepts:

Example:

:ok =
  Wol.send("00-11-22-33-44-55",
    port: 7,
    broadcast_ip: {192, 168, 1, 255},
    secure_on: <<1, 2, 3, 4>>,
    ifaddr: {192, 168, 1, 10},
    interface: "eth0"
  )

Errors

Wol.send/2 returns {:error, reason} for invalid inputs or UDP failures. Common reasons:

UDP errors (from :gen_udp) may also be returned.

Docs can be found at https://hexdocs.pm/wol.