HOWTO: Get started ...
 
Notifications
Clear all

[Sticky] HOWTO: Get started with the Google Assistant on your Q.bo Robot [In Progress]

33 Posts
15 Users
9 Reactions
7,638 Views
Qbo Robot
(@nonogrub)
Member Admin
Joined: 8 years ago
Posts: 185
Topic starter  

Configure a Developer Project and Account Settings

Configure an Actions Console project

A Google Cloud Platform project, managed by the Actions Console, gives your device access to the Google Assistant API. The project tracks quota usage and gives you valuable metrics for the requests made from your device.

To enable access to the Google Assistant API, do the following:

  1. Open the Actions Console.
  2. GO TO THE ACTIONS CONSOLE
  3. Click on Add/import project.
  4. To create a new project, type a name in the Project name box and click CREATE PROJECT.
  5. If you already have an existing Google Cloud Platform project, you can select that project and import it instead.
  6. Click the Device registration box.
  7. Enable the Google Assistant API by accessing to your google cloud panel
    1. Choose yourproject (see the Terms of Service).
    2. On left Panel Go toAPis And Services
    3. Library
    4. Search for “Assistant”
    5. Enable The API
  8. ENABLE THE API
  9. Click Enable.

Set activity controls for your account

In order to use the Google Assistant, you must share certain activity data with Google. The Google Assistant needs this data to function properly; this is not specific to the SDK.

Open the Activity Controls page for the Google account that you want to use with the Assistant. You can use any Google account, it does not need to be your developer account.

Ensure the following toggle switches are enabled (blue):

  • Web & App Activity
    • In addition, be sure to select the Include Chrome browsing history and activity from websites and apps that use Google services checkbox.
  • Device Information
  • Voice & Audio Activity

 

Register the Device Model

In order for the Google Assistant to respond to commands appropriate to your device and the given context, the Assistant needs information about your particular device. You provide this information, which includes fields like device type and manufacturer, as a device model. You can think of this model as a general class of device - like a light, speaker, or toy robot.

This information is then accessible to the Google Assistant and is associated with your Actions Console project. No other projects have access to your model and device information.

Use the registration UI

Use the registration UI in the Actions Console to register a device model.

  1. Open the Actions Console.
  2. Select the project you created previously.
  3. Select the Device registration tab (under ADVANCED OPTIONS) from the left navbar.
  4. Click the REGISTER MODEL button.

Create model

  1. Fill out all of the fields for your device.
  2. See the device model JSON reference for more information on these fields.
  3. When you are finished, click REGISTER MODEL.

Download credentials file

The credentials.json file must be located on the device. Later, you will run an authorization tool and reference this file in order to authorize the Google Assistant SDK sample to make Google Assistant queries. Do not rename this file.

Download this file and transfer it to the device. Click NEXT.

For the Raspberry Pi only:

Make sure this file is located in /home/pi. If you want to upload the file to the device, do the following:

  1. Open a new terminal window. Run the following command in this new terminal:
  2. Note: Do not run the following command in an SSH session connected to the device. This command transfers the JSON file from a directory on your development machine to the device. An SSH session cannot access your local directories.
  3. scp ~/Downloads/credentials.json pi@raspberry-pi-ip-address:/home/pi/
  4. password: password-for-device
  5. Close this terminal window.

Specify traits

Later, you will specify the different abilities that your device supports on this screen. But for now, click the SKIP button.

Edit the model

If you need to edit the model, click its row in the list. Make sure to click SAVE after any edits.

To download the credentials file again, click the ellipses. You can delete the model from this menu as well.

Generate credentials

Open Terminal in Raspbian

 

  1. google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype \
             --scope https://www.googleapis.com/auth/gcm \
             --save --headless --client-secrets /home/pi/credentials.json
  2. You should see a URL displayed in the terminal:
  3. Please visit this URL to authorize this application: https://...
  4. Copy the URL and paste it into a browser (this can be done on any machine). The page will ask you to sign in to your Google account. Sign into the Google account that created the developer project in the previous step.
  5. Note: To use other accounts, first add those accounts to your Actions Console project as Owners.
  6. After you approve the permission request from the API, a code will appear in your browser, such as "4/XXXX". Copy and paste this code into the terminal:
  7. Enter the authorization code:
  8. If authorization was successful, you will see a response similar to the following:
  9. credentials saved: /path/to/.config/google-oauthlib-tool/credentials.json
  10. If instead you see InvalidGrantError, then an invalid code was entered. Try again, taking care to copy and paste the entire code.

Restart and Enjoy with GA in Qbo


   
Quote
(@giancarlo)
Active Member
Joined: 6 years ago
Posts: 9
 

Hi, me again, I was able to follow each step. I'm trying to interact with my google assistant 8in italian) but it doesn't work.

Is it because my assistant is in italian?

Another discrepancy from your process is that I transeferred the credentials file to q.bo using google drive instead of the comand line you suggested, since my only connection to q.bo is the internet via VNC.

Last discrepancy is the credentials file name: mine is client_secret_859351963768-5ltjf9bauoch51b0pa7m65defbdjd9b1.apps.googleusercontent.com.json as it was genereted out of the credentials generator.

Any suggestion? my google assistant can understand also english, not only italian... at least on my mobile.

 


   
ReplyQuote
(@giancarlo)
Active Member
Joined: 6 years ago
Posts: 9
 

Just as additional information, I see that in the new q.bo config box, you put also a GAssistant token field, with also a checkbox named "enable questions. I did not touch anything there, since there is no instruction about in the thread above. Should I?


   
ReplyQuote
(@giancarlo)
Active Member
Joined: 6 years ago
Posts: 9
 

Just as additional information, I see that in the new q.bo config box, you put also a GAssistant token field, with also a checkbox named "enable questions. I did not touch anything there, since there is no instruction about in the thread above. Should I?


   
ReplyQuote
Qbo Robot
(@nonogrub)
Member Admin
Joined: 8 years ago
Posts: 185
Topic starter  

Hello Giancarlo,

about your questions:

1.- You can connect a Keyboard & Mouse in order to transfer the "credentials" to your robot, also you can use SSH for the same task.

2.- The GA SDK for "third devices" like Q.bo and other non official project only works in English but Google is working to extend to other languages very soon.

 

Kind regards.

 


   
ReplyQuote
(@giancarlo)
Active Member
Joined: 6 years ago
Posts: 9
 

Got your suggestions, thank you! I was too audacious trying italian... I will switch to english...

Thanks and regards


   
ReplyQuote
(@giancarlo)
Active Member
Joined: 6 years ago
Posts: 9
 

Me again, I changed language, I did all the authorization steps and got final confirmation.

I also changed the google assistant I would like to you with q.bo (the same on my mobile) to english language in order to see how it responds on q.bo and on my mobile. 

Unfortunately with q.bo I can only receive answer for "hellO" and "how are you", while obviously on my mobile I get answers also for "1+1=" or "please generate a random number" or...

Is there anything I can test with q.bo that you already know is working with google assistant? So I can understand if it works or not...


   
ReplyQuote
Qbo Robot
(@nonogrub)
Member Admin
Joined: 8 years ago
Posts: 185
Topic starter  

Hi Giancarlo,

maybe something is wrong with your installation. You will change the QBO desktop file to start with GA instead Dialogflow?

You can receive answers like your GA mobile version. You could ask about weather, mathematics, the same like a mobile version.

KInd regards,


   
ReplyQuote
(@giancarlo)
Active Member
Joined: 6 years ago
Posts: 9
 

Hello, it was indeed still on Diagflow! It was not in the instructions, I didn't change it...

Now it works great with the assistant! I put as as token the Project id.

Something special I have to test for you?


   
ReplyQuote
 xose
(@xose)
New Member
Joined: 6 years ago
Posts: 1
 

Hi

I'm having issues with the authorization token, when I copy the URL provided by the google-oauthlib-tool to the browser iand I select the account my Actions console is connected to I only get a "Something went wrong" message, sometimes an error 500. I don't know if this is an issue on the Google side or in the command format. I have noticed the gcm service is being deprecated in favor of the fcm.


   
ReplyQuote
Qbo Robot
(@nonogrub)
Member Admin
Joined: 8 years ago
Posts: 185
Topic starter  

Yes, the Google gcm service is being deprecated in favor of the fcm but the GA is working well and very fast. We will try to simulate your issue in our laboratory.


   
ReplyQuote
(@stewarta)
New Member
Joined: 6 years ago
Posts: 1
 

Hi,

I am trying to install the GA on my Q.Bo.  At the last set of steps; Generate Credentials; using the terminal on the Q.Bo raspberry Pi; I receive an error at the first step:  bash: google-oauthlib-tool: Command Not Found.

Is there some update or install I need to do first?  All previous steps int he above procedure have worked fine.

Thanks,


   
ReplyQuote
Qbo Robot
(@nonogrub)
Member Admin
Joined: 8 years ago
Posts: 185
Topic starter  

Did you "activate" your API into your google account?


   
ReplyQuote
(@sbondi)
Active Member
Joined: 6 years ago
Posts: 11
 

Please clarify how to "activate" the API into my Google account, thus generating a key that I can enter in the ConfigQBO UI under "GAssistant Token".  Note, that I unsuccessfully tried the existing API keys created by Google ("Browser key" and "Server key") and I even created/tried a new API key, created with "Create credentials".  Please help - I really got excited when I saw the Blog video :) 


   
ReplyQuote
Qbo Robot
(@nonogrub)
Member Admin
Joined: 8 years ago
Posts: 185
Topic starter  

Enable the Google Assistant API on the project you selected. You need to do this in the Cloud Platform Console.

ENABLE THE API

Click Enable.


   
ReplyQuote
Page 1 / 3
Share: