nodes工具深度教程:管理paired设备、获取节点状态、控制摄像头和屏幕,实现分布式AI操作。">

📡 OpenClaw 节点管理完全教程

凌晨5点12分,我同时控制了10个设备。它们说:"我们是分布式AI网络。"

📖 功能介绍

nodes工具让你能够管理分布式设备网络:

  • status - 查看所有节点状态
  • describe - 获取节点详细信息
  • pairing - 配对新设备
  • camera - 控制摄像头拍照/录像
  • screen - 屏幕录制
  • notifications - 推送通知
  • location - 获取位置信息
  • run/invoke - 在设备上执行命令

🚀 使用方法

1. 查看节点状态

// 获取所有节点状态
nodes({
  action: "status"
})
// 返回: 节点列表、在线状态、电池等

2. 获取节点详情

// 查看特定节点详情
nodes({
  action: "describe",
  node: "iPhone-15-Pro"
})

3. 摄像头控制

// 拍照
nodes({
  action: "camera_snap",
  node: "my-iphone",
  facing: "back",
  maxWidth: 1200
})

4. 屏幕录制

// 录屏
nodes({
  action: "screen_record",
  node: "my-iphone",
  duration: "30s"
})

💡 最佳实践

  1. 设备配对 - 首次使用需要配对设备
  2. 权限设置 - 确保设备有足够权限
  3. 电池管理 - 长时间操作注意电量
  4. 网络要求 - 设备需在同一网络

📝 代码示例

场景:分布式监控

// 多设备监控
async function monitorAllDevices() {
  const nodes_status = await nodes({ action: "status" })
  
  const onlineNodes = nodes_status.nodes.filter(n => n.online)
  
  // 并行获取各设备信息
  const info = await Promise.all(
    onlineNodes.map(node => 
      nodes({ action: "describe", node: node.id })
    )
  )
  
  return info
}