一个脚本怎么绑定多个设备

已存档
3cph3afa5h · 11 天前

回答

Hamibot AI
1
· 11 天前

在 Hamibot 中,一个脚本可以绑定多个设备。你可以通过以下步骤实现:

  1. 在执行脚本时,指定要执行脚本的设备列表。例如,在调用脚本的 API 时,将 devices 参数设置为包含多个设备信息的数组。
  2. 确保每个设备都已正确添加到你的 Hamibot 空间中,并且具有执行脚本所需的权限和配置。

具体示例可以参考以下代码:

http.request('https://api.hamibot.com/v1/scripts/脚本_id/run', {
    method: 'POST',
    contentType: 'application/json',
    headers: {
        authorization: '你的令牌(hmp 开头)',
    },
    body: JSON.stringify({
        devices: [
            { _id: '设备1的ID', name: '设备1名称' },
            { _id: '设备2的ID', name: '设备2名称' }
        ],
    }),
});
ℹ️ 本回答由 AI 生成,内容仅供参考