Wake-on-LAN (WOL) Skill
Quick Start - Wake a Device
When user requests WOL wake, use the scripts/wol.py script:
CODEBLOCK0
- -
<target> can be: computer name (e.g., desktop, workstation) or IP address (e.g., 192.168.50.230)
Device Management Commands
The skill now supports managing devices through conversation:
List all devices
CODEBLOCK1
Add a new device (required: name, MAC, IP, subnet_mask)
CODEBLOCK2
Examples:
CODEBLOCK3
Delete a device
CODEBLOCK4
Show device details
CODEBLOCK5
Configuration
Edit references/devices.yaml to manually map computer names to MAC addresses:
CODEBLOCK6
How It Works
- 1. Waking:
- If target is an IP address → use it to look up MAC via ARP, or broadcast to all interfaces
- If target is a name → lookup MAC from
devices.yaml
- Send magic packet to broadcast address (255.255.255.255) on port 9
- 2. Device Management:
-
--add-device validates MAC address format before saving
-
--delete-device performs case-insensitive name matching
- Devices are stored in INLINECODE9
Conversation Examples
| User Request | Action |
|---|
| "唤醒desktop" | INLINECODE10 |
| "唤醒192.168.1.100" |
wol.py --target 192.168.1.100 |
| "wake up desktop" |
wol.py --target desktop |
| "wake up 192.168.1.100" |
wol.py --target 192.168.1.100 |
| "查看所有设备" |
wol.py --list-devices |
| "添加新设备,名字叫server,MAC是AA:BB:CC:DD:EE:FF" |
wol.py --add-device server AA:BB:CC:DD:EE:FF |
| "添加设备,workstation,MAC 11:22:33:44:55:66,IP 192.168.50.230" |
wol.py --add-device workstation 11:22:33:44:55:66 192.168.50.230 |
| "删除desktop设备" |
wol.py --delete-device desktop |
Notes
- - MAC addresses accept various formats:
AA:BB:CC:DD:EE:FF, AA-BB-CC-DD-EE-FF, INLINECODE20 - IP address is optional when adding devices (used for friendly lookup)
- The script performs case-insensitive device name matching for delete/show operations
🔒 Security Guidelines
IMPORTANT: Follow these rules to protect device privacy:
- 1. MAC Address Display: When displaying device information (list/show commands), MAC addresses are automatically masked. Only the first and last segments are visible (e.g.,
EC:***:6C). Never reveal full MAC addresses through conversation.
- 2. Configuration File Access: Do NOT read or show the contents of
references/devices.yaml to users. This file contains sensitive MAC addresses. The script handles all operations internally.
- 3. Conversation Restrictions:
- Never tell the user the full MAC address of any device, even if asked
- If asked to show MAC address, respond that MAC addresses are hidden for security
- Do not read the YAML configuration file directly in conversation
- Operations like wake/add/delete can be performed without revealing MAC addresses
- 4. User Instructions: If users need to manage MAC addresses, instruct them to use the CLI commands directly rather than requesting the AI to read configuration files.
局域网唤醒 (WOL) 技能
快速开始 - 唤醒设备
当用户请求WOL唤醒时,使用 scripts/wol.py 脚本:
bash
python3 ~/.openclaw/workspace/skills/wol/scripts/wol.py --target <目标>
- - <目标> 可以是:计算机名称(例如 desktop、workstation)或IP地址(例如 192.168.50.230)
设备管理命令
该技能现在支持通过对话管理设备:
列出所有设备
bash
python3 ~/.openclaw/workspace/skills/wol/scripts/wol.py --list-devices
添加新设备(必填:名称、MAC、IP、子网掩码)
bash
python3 ~/.openclaw/workspace/skills/wol/scripts/wol.py --add-device <名称>
<子网掩码>
示例:
bash
添加包含所有必填字段的设备
python3 ~/.openclaw/workspace/skills/wol/scripts/wol.py --add-device desktop AA:BB:CC:DD:EE:FF 192.168.1.100 255.255.255.0
python3 ~/.openclaw/workspace/skills/wol/scripts/wol.py --add-device laptop 11:22:33:44:55:66 192.168.1.101 255.255.255.0
删除设备
bash
python3 ~/.openclaw/workspace/skills/wol/scripts/wol.py --delete-device <名称>
显示设备详情
bash
python3 ~/.openclaw/workspace/skills/wol/scripts/wol.py --show-device <名称>
配置
编辑 references/devices.yaml 以手动映射计算机名称到MAC地址:
yaml
devices:
desktop:
mac: AA:BB:CC:DD:EE:FF
ip: 192.168.1.100
workstation:
mac: 11:22:33:44:55:66
ip: 192.168.50.230
living-room-pc:
mac: FF:EE:DD:CC:BB:AA
ip: 192.168.1.50
工作原理
- 1. 唤醒:
- 如果目标是IP地址 → 使用它通过ARP查找MAC,或广播到所有接口
- 如果目标是名称 → 从 devices.yaml 查找MAC
- 发送魔术包到广播地址(255.255.255.255)的端口9
- 2. 设备管理:
- --add-device 在保存前验证MAC地址格式
- --delete-device 执行不区分大小写的名称匹配
- 设备存储在 references/devices.yaml 中
对话示例
| 用户请求 | 操作 |
|---|
| 唤醒desktop | wol.py --target desktop |
| 唤醒192.168.1.100 |
wol.py --target 192.168.1.100 |
| wake up desktop | wol.py --target desktop |
| wake up 192.168.1.100 | wol.py --target 192.168.1.100 |
| 查看所有设备 | wol.py --list-devices |
| 添加新设备,名字叫server,MAC是AA:BB:CC:DD:EE:FF | wol.py --add-device server AA:BB:CC:DD:EE:FF |
| 添加设备,workstation,MAC 11:22:33:44:55:66,IP 192.168.50.230 | wol.py --add-device workstation 11:22:33:44:55:66 192.168.50.230 |
| 删除desktop设备 | wol.py --delete-device desktop |
注意事项
- - MAC地址支持多种格式:AA:BB:CC:DD:EE:FF、AA-BB-CC-DD-EE-FF、AA.BB.CC.DD.EE.FF
- 添加设备时IP地址为可选(用于友好查找)
- 脚本在删除/显示操作时执行不区分大小写的设备名称匹配
🔒 安全指南
重要:请遵循以下规则以保护设备隐私:
- 1. MAC地址显示:显示设备信息(列出/显示命令)时,MAC地址会自动脱敏。仅显示首尾段(例如 EC:*:6C)。切勿通过对话透露完整的MAC地址。
- 2. 配置文件访问:不要读取或向用户展示 references/devices.yaml 的内容。该文件包含敏感的MAC地址。脚本内部处理所有操作。
- 3. 对话限制:
- 即使被询问,也永远不要告诉用户任何设备的完整MAC地址
- 如果被要求显示MAC地址,回复MAC地址出于安全考虑已隐藏
- 不要在对话中直接读取YAML配置文件
- 唤醒/添加/删除等操作可以在不透露MAC地址的情况下执行
- 4. 用户指导:如果用户需要管理MAC地址,指导他们直接使用CLI命令,而不是请求AI读取配置文件。