Run the Sample Code

At this point, you are ready to run the sample and make a query.

In the following command:

  • Replace my-dev-project with the Google Cloud Platform project ID for the Actions Console project you created. To find the project ID in the Actions Console, select the project, click the gear icon, and select Project settings.

  • Replace my-model with the name of the model you created in the previous step.

  • (Optional) Replace device-nickname with a nickname for the device. Replace text-query with a query you want the Assistant to automatically answer once it has started.

googlesamples-assistant-hotword --project-id my-dev-project --device-model-id my-model [--nickname device-nickname] [--query text-query]

Say Ok Google or Hey Google, followed by your query. You can try some of the following:

  • Who am I?
  • Listen to This American Life podcast.
  • What is the weather in San Francisco?

If the Assistant does not respond, follow the troubleshooting instructions.

To change the language for the Google Assistant or to enable personal results, use the Google Assistant app.

If you have a Cast-enabled device on the same network and configured with the same user account, you can control it remotely:

  • Ok Google, play Spotify on the Kitchen Speaker.

To broadcast a voice message, make sure to first set the device location in the Google Assistant app. Then try the following:

  • Ok Google, broadcast Come to dinner.

Find the device instance ID

When you run the sample the first time, it will generate a device instance for your particular device. This device instance will be associated with the device model that you specified to run the sample. You can also create the instance yourself using the registration tool.

The sample saves the device instance ID. If you run the sample with the same model ID, it defaults to using the saved device instance ID.

Find the device instance ID in the console for the sample.

device_model_id: my-model
device_id: 1C3E1558B0023E49F71CA0D241DA03CF # Device instance ID

Registering...Done.

ON_MUTED_CHANGED:
  {'is_muted': False}
ON_START_FINISHED
...

Next step

Now that you have the Google Assistant working on your device, it is time to extend it. You can take a look at some possible next steps here or continue on to creating Device Actions.