Sending commands to google assistant using script instead of mic
Asked Answered
S

2

6

I have configured Google Assistant SDK in Raspberry Pi 3 and demo application is working fine. Is there any way to send “OK Google, Example Command” to Google Assistant SDK using Python script? Or it will only take input from Mic?

I am planning to write tiny mobile application which will send commands to my Raspberry Pi google assistant application.

Squashy answered 2/8, 2017 at 10:11 Comment(2)
Well, you can pre-record and save a ready audio file to send for whatever "example command"Alboin
Any updates on this problem? I am looking to integrate the text commands in my js app.Hako
B
4

UPDATE: even if it is an old question, here is the latest update.

It is now possible using the v1alpha2 version. The gRPC message AssistConfig is defined as an union where you can choose between an audio out config or a text query.


If you are using the python library, see the AssistConfig. Here is an example of config using a text query (adapted from the pushtotalk.py sample, line 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,
        )
    )

If you are using golang, here is the link to the godoc.

Bohemia answered 23/3, 2018 at 19:53 Comment(1)
Can it read some text instead of the query text_query = "who are you ?"?Cheeseburger
M
0

The current release of the Assistant SDK (Alpha v1) only supports sending and receiving audio. This is a frequent request, however, and we'll see what they provide in future updates.

Manheim answered 2/8, 2017 at 14:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.