Pi speaker (local audio output)
Play text-to-speech or an audio file on the gateway host default audio output. Typical use: OpenClaw gateway on a Raspberry Pi with a Bluetooth speaker set as default sink; you ask for an announcement, alarm, or news summary and want to hear it on that speaker.
When to use
- - User asks to "play X on the Pi speaker," "announce X," "alarm at ... with message Y," or "give me a news summary and play it on the speaker."
- Gateway is running on the Pi (or another host with local audio); default sink is already set (e.g. Bluetooth speaker). See Raspberry Pi audio for setup.
Quick procedure (do this in two tool calls)
There is no openclaw skill pi-speaker CLI. Use tts then exec only.
- 1. Call the tts tool with the announcement text. Keep announcement text short (e.g. one sentence) to avoid long TTS generation and request timeouts.
- From the tool result, get the audio file path (e.g.
details.audioPath or content like MEDIA:/path/to/file). Strip any MEDIA: prefix to get the real path on the host. - Call the exec tool with exactly one of:
pw-play <path>, paplay <path>, or $HOME/bin/openclaw-speaker-play.sh <path>. Do not invent a CLI like openclaw skill pi-speaker --text "..."; there is no such command.
Only after exec returns success (exit 0), tell the user the phrase was played on the Pi speaker.
How to do it (details)
Same as Quick procedure above. Generate audio with tts, then run exec with pw-play <path>, paplay <path>, or $HOME/bin/openclaw-speaker-play.sh <path>. Do not skip the exec step. If exec fails, report the error and do not claim that audio played.
Notes
- - The audio file is created on the gateway host; playback must run on that same host (bash tool without sandbox, or elevated).
- If playback fails, suggest checking: default sink is set (e.g.
pactl info or wpctl status), gateway runs as a user with an audio session, and Bluetooth speaker is connected. - After generating audio with the tts tool, always run the bash tool to play that file on the host (e.g.
pw-play /path/to/audio or $HOME/bin/openclaw-speaker-play.sh /path/to/audio). Do not send the audio to the user in the conversation. - Do not tell the user that audio was played until you have actually called the bash/exec tool with pw-play (or the script) and received a successful result.
- Example: after TTS returns path
/tmp/openclaw/tts-9vdLan/voice-1772897021460.mp3, run: pw-play /tmp/openclaw/tts-9vdLan/voice-1772897021460.mp3 via the bash tool.
Pi speaker(本地音频输出)
在网关主机默认音频输出上播放文本转语音或音频文件。典型用途:在树莓派上运行OpenClaw网关,并将蓝牙音箱设置为默认音频接收器;当您请求播报、警报或新闻摘要时,可通过该音箱听到。
使用场景
- - 用户要求在Pi音箱上播放X、播报X、在...时间用消息Y设置闹钟或给我一个新闻摘要并在音箱上播放。
- 网关在树莓派(或其他具有本地音频的主机)上运行;默认音频接收器已设置(如蓝牙音箱)。设置方法请参见Raspberry Pi音频。
快速操作流程(通过两次工具调用完成)
没有 openclaw skill pi-speaker 命令行工具。仅使用 tts 然后 exec。
- 1. 使用播报文本调用 tts 工具。保持播报文本简短(如一句话),以避免TTS生成时间过长和请求超时。
- 从工具结果中获取音频文件路径(例如 details.audioPath 或类似 MEDIA:/path/to/file 的内容)。去除任何 MEDIA: 前缀以获取主机上的真实路径。
- 调用 exec 工具,使用以下命令之一:pw-play 、paplay 或 $HOME/bin/openclaw-speaker-play.sh 。不要编造类似 openclaw skill pi-speaker --text ... 的命令行;不存在这样的命令。
只有在exec返回成功(退出码0)后,才能告知用户该短语已在Pi音箱上播放。
具体操作方法(详细说明)
与上述快速操作流程相同。使用 tts 生成音频,然后运行 exec 并执行 pw-play 、paplay 或 $HOME/bin/openclaw-speaker-play.sh 。不要跳过exec步骤。如果exec失败,报告错误,不要声称音频已播放。
注意事项
- - 音频文件在网关主机上创建;播放必须在同一台主机上运行(使用无沙箱的bash工具,或提升权限)。
- 如果播放失败,建议检查:默认音频接收器已设置(例如 pactl info 或 wpctl status)、网关以具有音频会话的用户身份运行、蓝牙音箱已连接。
- 使用tts工具生成音频后,始终运行bash工具在主机上播放该文件(例如 pw-play /path/to/audio 或 $HOME/bin/openclaw-speaker-play.sh /path/to/audio)。不要在对话中将音频发送给用户。
- 在您实际使用pw-play(或脚本)调用bash/exec工具并收到成功结果之前,不要告知用户音频已播放。
- 示例:TTS返回路径 /tmp/openclaw/tts-9vdLan/voice-1772897021460.mp3 后,通过bash工具运行:pw-play /tmp/openclaw/tts-9vdLan/voice-1772897021460.mp3。