SuperAPI AI 工具集

alexa-cli

通用与其它

查看项目

更新于 10-16 06:39

技能介绍

Alexa CLI 是一个命令行工具,通过 alexacli 命令控制 Amazon Echo 设备与智能家居,底层使用非官方的 Alexa API(与 Alexa 应用相同)。

用途

该工具用于在终端中操作 Amazon Echo 设备与智能家居,包括语音播报、发送语音指令、查询设备状态以及查看语音活动历史。它适合需要以脚本或命令行方式触发 Alexa 行为的场景,也适合集成到 AI/智能体流程中。

主要能力

  • 设备管理:使用 alexacli devices 列出所有 Echo 设备,可加 --json 输出 JSON 格式。
  • 文本转语音:使用 alexacli speak "Hello world" -d "Kitchen Echo" 在指定设备上朗读文本;使用 alexacli speak "Dinner is ready!" --announce 向所有设备广播。设备名称匹配灵活,支持部分、不区分大小写的匹配,例如 alexacli speak "Build complete" -d Kitchen。
  • 语音指令(智能家居控制):使用 alexacli command 发送任意指令,如同对 Alexa 说话。示例包括:
    • 灯光:alexacli command "turn off the living room lights" -d Kitchen、alexacli command "dim the bedroom lights to 50 percent" -d Bedroom
    • 恒温器:alexacli command "set thermostat to 72 degrees" -d Bedroom
    • 门锁:alexacli command "lock the front door" -d Kitchen
    • 音乐:alexacli command "play jazz music" -d "Living Room"
    • 计时器:alexacli command "set a timer for 10 minutes" -d Kitchen
    • -d 标志指定由哪个 Echo 处理该指令。
  • 获取回复:使用 alexacli ask 发送指令并捕获 Alexa 的文本回复,例如 alexacli ask "what's the thermostat set to" -d Kitchen 输出 The thermostat is set to 68 degrees.;也可加 --json,如 alexacli ask "what's on my calendar today" -d Kitchen --json。适用于查询设备状态或获取 Alexa 特定信息。
  • 历史记录:使用 alexacli history 查看最近的语音活动,可加 --limit 5 --json。
  • 认证配置:使用 alexacli auth 配置认证。

使用方式

命令参考如下:

命令 描述
alexacli devices 列出所有 Echo 设备
alexacli speak <text> -d <device> 在设备上进行文本转语音
alexacli speak <text> --announce 向所有设备广播
alexacli command <text> -d <device> 发送语音指令(智能家居、音乐等)
alexacli ask <text> -d <device> 发送指令并获取回复
alexacli history 查看最近的语音活动
alexacli auth 配置认证

适用场景

  • 在终端或脚本中触发 Echo 设备的语音播报或广播通知。
  • 通过自然语言指令控制智能家居设备(灯光、恒温器、门锁等)。
  • 查询 Alexa 的设备状态或日历等信息并获取文本回复。
  • 在 AI/智能体流程中集成语音播报与智能家居控制,官方说明指出对于 AI/智能体用途,优先使用带自然语言的 alexacli command。

限制与注意事项

  • 使用 Amazon 的非官方 API(与 Alexa 应用相同)。
  • 刷新令牌有效期约 14 天,过期后需重新运行 alexacli auth。
  • 设备名称支持部分、不区分大小写的匹配。
  • 关于收费、价格、支持平台等更多信息,资料中暂未提供。