使用脚本而不是麦克风向谷歌助手发送命令

Bha*_*ant 5 google-assist-api raspberry-pi3 google-assistant-sdk

我已经在 Raspberry Pi 3 中配置了 Google Assistant SDK,并且演示应用程序运行良好。有没有办法使用 Python 脚本将“OK Google,示例命令”发送到 Google Assistant SDK?或者它只会接受来自 Mic 的输入?

我打算编写一个微型移动应用程序,它将向我的 Raspberry Pi 谷歌助手应用程序发送命令。

Der*_*lin 4

更新:即使这是一个老问题,这里是最新的更新。

现在可以使用v1alpha2版本。gRPC 消息AssistConfig被定义为一个联合,您可以在其中选择音频输出配置文本查询


如果您使用的是python库,请参阅AssistConfig. 以下是使用文本查询的配置示例(改编自pushtotalk.py示例,第 183 行):

config = embedded_assistant_pb2.AssistConfig(
        # instead of audio_in_config
        # note: no need to use 'OK google'
        text_query = "who are you ?", 
        audio_out_config=embedded_assistant_pb2.AudioOutConfig(
            encoding='LINEAR16',
            sample_rate_hertz=self.conversation_stream.sample_rate,
            volume_percentage=self.conversation_stream.volume_percentage,
        ),
        dialog_state_in=dialog_state_in,
        device_config=embedded_assistant_pb2.DeviceConfig(
            device_id=self.device_id,
            device_model_id=self.device_model_id,
        )
    )
Run Code Online (Sandbox Code Playgroud)

如果您使用golang这里是 godoc 的链接