{"id":15011953,"url":"https://github.com/a7md0/wakeonlan","last_synced_at":"2025-06-12T02:05:47.089Z","repository":{"id":35044558,"uuid":"192239453","full_name":"a7md0/WakeOnLan","owner":"a7md0","description":"Wake On LAN magic packets generator library for ESP8266 \u0026 ESP32 boards","archived":false,"fork":false,"pushed_at":"2025-04-17T17:42:41.000Z","size":78,"stargazers_count":201,"open_issues_count":1,"forks_count":18,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-09T00:05:00.986Z","etag":null,"topics":["esp32","esp32-arduino","esp8266","esp8266-arduino","espressif32","espressif8266","platformio","wake-on-lan","wol"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a7md0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-06-16T21:42:31.000Z","updated_at":"2025-04-29T11:01:21.000Z","dependencies_parsed_at":"2024-09-15T22:03:12.130Z","dependency_job_id":"bcab1cc8-8ef8-4ec5-8a38-98e234f88d5f","html_url":"https://github.com/a7md0/WakeOnLan","commit_stats":{"total_commits":65,"total_committers":3,"mean_commits":"21.666666666666668","dds":"0.32307692307692304","last_synced_commit":"e676bd5b0691436726a12cbd683f19e0d5018530"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/a7md0/WakeOnLan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a7md0%2FWakeOnLan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a7md0%2FWakeOnLan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a7md0%2FWakeOnLan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a7md0%2FWakeOnLan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a7md0","download_url":"https://codeload.github.com/a7md0/WakeOnLan/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a7md0%2FWakeOnLan/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259382283,"owners_count":22848834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp32","esp32-arduino","esp8266","esp8266-arduino","espressif32","espressif8266","platformio","wake-on-lan","wol"],"created_at":"2024-09-24T19:41:56.176Z","updated_at":"2025-06-12T02:05:47.071Z","avatar_url":"https://github.com/a7md0.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WakeOnLan [![Build Status](https://github.com/a7md0/WakeOnLan/actions/workflows/PlatformIO.yml/badge.svg)](https://github.com/a7md0/WakeOnLan/actions/workflows/PlatformIO.yml) [![PlatformIO Registry](https://badges.registry.platformio.org/packages/a7md0/library/WakeOnLan.svg)](https://registry.platformio.org/libraries/a7md0/WakeOnLan) [![arduino-library-badge](https://www.ardu-badge.com/badge/WakeOnLan.svg?)](https://reference.arduino.cc/reference/en/libraries/wakeonlan)\nThis Library provides an easy way to generate/send magic packets from an ESP8266 or ESP32 to any MAC Address. Additionally, it supports the \"SecureOn\" feature from some motherboard manufacturers. Finally, it also supports using any port number (instead of the default port 9.)\u003cbr /\u003e\u003cbr /\u003e\nThis library can be used in any environment that the IPAddress, WiFiUDP \u0026 delay classes are available.\n\n## **Install**\nYou can install this library in the Arduino IDE by navigating to Tools -\u003e Library Manager and search for this library's name. Alternatively, download this repository as zip file, then in the IDE navigate to Sketch -\u003e Include library -\u003e Add .ZIP library\u003cbr /\u003e\u003cbr /\u003e\n\nTo install the library in the PlatformIO IDE, use the library name like so:\n`lib_deps = WakeOnLan`\n OR copy the repository link and add to the 'lib_deps' variable:\n`lib_deps = https://github.com/a7md0/WakeOnLan.git`\n\n#### Include and initialize WiFiUDP\n```cpp\n#include \u003cWiFiUdp.h\u003e\nWiFiUDP UDP;\n```\n\n#### Include and initialize WakeOnLan class\n```cpp\n#include \u003cWakeOnLan.h\u003e\nWakeOnLan WOL(UDP); // Pass WiFiUDP class\n```\n\n#### Add this line in void setup() (optional)\n\n`WOL.setRepeat(3, 100); // Repeat the packet three times with 100ms delay between`\n\n#### After connecting to WiFi successfully, Calculate and set the broadcast address (optional)\n`WOL.calculateBroadcastAddress(WiFi.localIP(), WiFi.subnetMask());`\n\n#### Manually set the broadcast address (optional)\n`WOL.setBroadcastAddress(\"192.168.1.255\");`\n  \n## **Usage**\n\n### **Send WOL from char array MAC Address**\n\n#### Set MAC address in variable\n```cpp\nconst char *MACAddress = \"01:23:45:67:89:AB\";\n```\n\n##### Send WOL UDP packet (Using the default port - 9)\n`WOL.sendMagicPacket(MACAddress);`\n\n##### Send WOL UDP packet (Use port 7)\n`WOL.sendMagicPacket(MACAddress, 7);`\n\n\n#### Set MAC address and SecureOn variables\n```cpp\nconst char *MACAddress = \"01:23:45:67:89:AB\";\nconst char *secureOn = \"FE:DC:BA:98:76:54\";\n```\n\n##### Send WOL UDP packet with password (Using the default port - 9)\n`WOL.sendSecureMagicPacket(MACAddress, secureOn);`\n\n##### Send WOL UDP packet with password (Use port 7)\n`WOL.sendSecureMagicPacket(MACAddress, secureOn, 7);`\n  \n### **Send WOL from byte array MAC Address**\n\n#### Set MAC address in variable\n```cpp\nuint8_t MAC[6] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB}; // 01:23:45:67:89:AB\n```\n\n##### Send WOL UDP packet (Using the default port - 9)\n`WOL.sendMagicPacket(MAC, sizeof(MAC));`\n\n##### Send WOL UDP packet (Use port 7)\n`WOL.sendMagicPacket(MAC, sizeof(MAC), 7);`\n\n\n#### Set MAC address and SecureOn in variable\n```cpp\nuint8_t MAC[6] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB}; // 01:23:45:67:89:AB\nuint8_t SECURE_ON[6] = {0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54}; // FE:DC:BA:98:76:54\n```\n\n##### Send WOL UDP packet with password (By default port 9)\n`WOL.sendSecureMagicPacket(MAC, sizeof(MAC), SECURE_ON, sizeof(SECURE_ON));`\n\n##### Send WOL UDP packet with password (Use port 7)\n`WOL.sendSecureMagicPacket(MAC, sizeof(MAC), SECURE_ON, sizeof(SECURE_ON), 7);`\n\n\n### **Generate magic packet**\n\n#### Generate\n```cpp\nsize_t magicPacketSize = 6 + (6 * 16);  // FF*6 + MAC*16\nuint8_t* magicPacket = new uint8_t[magicPacketSize]; // Magic packet will be stored in this variable\n\nuint8_t MAC[6] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB}; // 01:23:45:67:89:AB\n\nWOL.generateMagicPacket(magicPacket, magicPacketSize, pMacAddress, sizeof(MAC));\n```\n\n#### Generate with \"SecureOn\"\n```cpp\nsize_t magicPacketSize = 6 + (6 * 16) + 6;  // FF*6 + MAC*16 + SecureOn\nuint8_t* magicPacket = new uint8_t[magicPacketSize]; // Magic packet will be stored in this variable\n\nuint8_t MAC[6] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB}; // MAC Address = 01:23:45:67:89:AB\nuint8_t SECURE_ON[6] = {0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54}; // SecureOn = FE:DC:BA:98:76:54\n\nWOL.generateMagicPacket(magicPacket, magicPacketSize, MAC, sizeof(MAC), SECURE_ON, sizeof(SECURE_ON));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa7md0%2Fwakeonlan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa7md0%2Fwakeonlan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa7md0%2Fwakeonlan/lists"}