0

I tried to follow the documentation and got stuck in the point

  1. Open a terminal and follow the instructions to configure a new Python virtual environment and install the `google-assistant-library.

The link in this point redirects to a general page (Introduction to the Google Assistant Library) rather than the instructions. I think it misses the explanation what it means to open the terminal and exact steps to be followed. Is the link really correct?

Maybe I need help in using the console correctly, but I am not getting it from that poor documentation. I can connect to RP with Serial to USB cable and Putty. But simply I do not know what that point 11 and onwards mean... Any idea? Thank you

Majo
  • 423
  • 4
  • 14

2 Answers2

1

It looks like the links in the Assistant SDK docs were modified, but it should be pointing to this page:

sudo apt-get update
sudo apt-get install python3-dev python3-venv # Use python3.4-venv if the package cannot be found.
python3 -m venv env
env/bin/python -m pip install --upgrade pip setuptools
source env/bin/activate

python -m pip install --upgrade google-auth-oauthlib[tool]
google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype \
      --save --headless --client-secrets /path/to/client_secret_client-id.json

This will save the credentials at /path/to/.config/google-oauthlib-tool/credentials.json, which you can then copy into your project in order to authenticate the Google Assistant.

Nick Felker
  • 11,536
  • 1
  • 21
  • 35
  • Thanks. Is this set of commands to be run in the console of the Android things.? I figured out these steps finally. Though I thought they were related to a different version of Linux. Entering those commands in Androidthings console throws error of sudo etc being unknown...The user guide is very confusing. – Majo Jan 25 '18 at 20:48
  • Yes these should be run on your development machine (Ubuntu) – Nick Felker Jan 25 '18 at 20:50
  • Would be fine if this was stated in the documentation. If someone uses Windows /iOs based development machine might get an impression the steps should be done in RP running Androidthings since the documentation and development is meant for. Step 11 requires then to change development environment suddently to Ubuntu... :-) for those developers. – Majo Jan 25 '18 at 21:02
  • @Majo you should be able to create a virtualenv after installing a recently version of python on Windows/OSX using the official installer from http://python.org/ (just ignore the `apt-get` instructions since python3 on those platform comes with virtualenv built-in) – proppy Jan 26 '18 at 02:25
0

As Nick and proppy noted, one step is to obtain authorization code to be used in later steps. Unfortunately the documentation skipped few very important steps and it can lead to confusion. Sadly Google did not simplify the process of integrating the Assistant in the same development environment and hope they will integrate this clumsy process to Android Studio as with other services

If you are developing under Windows you need to:

  1. use a Linux environment and follow the steps in console of that Linux PC (not in the Android Things console of the RP!). Or install Python in Windows. I used the Raspbian in my RP3 to do the Linux version of the procedure...
  2. install Python environment first in the Linux PC console

sudo apt-get update sudo apt-get install python3-dev python3-venv python3 -m venv env env/bin/python -m pip install --upgrade pip setuptools source env/bin/activate

  1. in this Python environment install google-auth-oauthlib that will generate the credential file

python -m pip install --upgrade google-auth-oauthlib[tool]

  1. change the directory to place you saved the downloaded json file from step before step 11 in the documenatation. e.g.

cd /home/pi/Downloads/

  1. run the google auth tool with the path to your downloaded json file (including its long name, replace idxxx with your id)

google-oauthlib-tool --client-secrets /home/pi/Downloads/client_secret_client-idxxx.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless

  1. there will be a link generated in the console. You have to insert the link into browser . You will be prompted in browser to let the tool to use your account and the you will receive an authentication code. Enter this code to the prompt back in the console.

  2. find the generated authenticated authorization code file in the folder prompted in the console and continue in the original documentation steps

Majo
  • 423
  • 4
  • 14