Run the Sample Code
Stay organized with collections
Save and categorize content based on your preferences.
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.
googlesamples-assistant-pushtotalk --project-id my-dev-project --device-model-id my-model
Press the Enter key and try some of the following queries:
- Who am I?
- What time is it?
- 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.
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 both model and instance IDs. If you run the sample without providing
these as arguments, it will default to using the saved IDs.
Find the device instance ID in the output for the sample.
INFO:root:Connecting to embeddedassistant.googleapis.com
WARNING:root:Device config not found: [Errno 2] No such file or directory: '/home/pi/.config/googlesamples-assistant/device_config.json'
INFO:root:Registering device
INFO:root:Device registered: 0eea18ae-d17e-11e7-ac7a-b827ebb8010f # Device instance ID
Press Enter to send a new request...
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["Run the provided command, replacing placeholders with your project and model IDs, to initiate a sample query."],["Test the setup with example queries like \"Who am I?\", \"What time is it?\", or weather-related questions."],["Locate the device instance ID within the sample's output for future use and potential troubleshooting."],["Refer to provided resources for troubleshooting, language settings, and next steps in extending device functionality."]]],["To run the sample, replace placeholders in the provided command with your Google Cloud project ID and model name. Execute the command and try example queries. If no response, consult troubleshooting. The first run generates a unique device instance ID, displayed in the output, and saves it for future use. The command can be run without arguments if the ID was saved. You can change the language or add personal settings through the Google Assistant app. Further steps like extending or adding device actions are possible.\n"]]