註冊工具說明

Google 助理 SDK 內含註冊工具 (googlesamples-assistant-devicetool),協助您註冊裝置。 本頁面概述了這項工具可用的說明指令和指令 輸出內容

這些說明指令假設您使用 Python 虛擬主機 環境

工具選項

googlesamples-assistant-devicetool --help
Usage: googlesamples-assistant-devicetool [OPTIONS] COMMAND [ARGS]...

Options:
  --project-id TEXT      Enter the Google Developer Project ID that you want
                         to use with the registration tool. If you don't use
                         this flag, the tool will use the project listed in
                         the client_secret_<client-id>.json file you specify
                         with the --client-secrets flag.
  --client-secrets TEXT  Enter the path and filename for the
                         client_secret_<client-id>.json file you downloaded
                         from your developer project. This file is used to
                         infer the Google Developer Project ID if it was not
                         provided with the --project-id flag. If the
                         --project-id flag and this flag are not used, the
                         tool will look for this file in the current directory
                         (by searching for a file named after the client_id
                         stored in the credentials file).
  --verbose              Shows detailed JSON response
  --api-endpoint TEXT    Hostname for the Google Assistant API. Do not use
                         this flag unless explicitly instructed.  [default:
                         embeddedassistant.googleapis.com]
  --credentials TEXT     File location of the generated credentials file. The
                         google-oauthlib-tool generates this file after
                         authorizing the user with the client_secret_<client-
                         id>.json file. This credentials file authorizes
                         access to the Google Assistant API. You can use this
                         flag if the credentials were generated in a location
                         that is different than the default.  [default:
                         /home/pi/.config/google-oauthlib-
                         tool/credentials.json]
  --help                 Show this message and exit.

Commands:
  delete           Delete given device model or instance.
  get              Gets all of the information (fields) for a...
  list             Lists all of the device models and/or...
  register         Registers a device model and instance.
  register-device  Registers a device instance under an existing...
  register-model   Registers a device model.

指令

刪除

googlesamples-assistant-devicetool delete --help
Usage: googlesamples-assistant-devicetool delete [OPTIONS] ID

  Delete given device model or instance.

Options:
  --model   Enter the identifier for an existing device model.  [required]
  --device  Enter the identifier for an existing device instance.  [required]
  --help    Show this message and exit.

取得

googlesamples-assistant-devicetool get --help
Usage: googlesamples-assistant-devicetool get [OPTIONS] ID

  Gets all of the information (fields) for a given device model or instance.

Options:
  --model   Enter the identifier for an existing device model.  [required]
  --device  Enter the identifier for an existing device instance.  [required]
  --help    Show this message and exit.

清單

googlesamples-assistant-devicetool list --help
Usage: googlesamples-assistant-devicetool list [OPTIONS]

  Lists all of the device models and/or instances associated with the
  current Google Developer project. To change the current project, use the
  devicetool's --project-id flag.

Options:
  --model   [required]
  --device  [required]
  --help    Show this message and exit.

註冊

googlesamples-assistant-devicetool register --help
Usage: googlesamples-assistant-devicetool register [OPTIONS]

  Registers a device model and instance.

  Device model fields can only contain letters, numbers, and the following
  symbols: period (.), hyphen (-), underscore (_), space ( ) and plus (+).
  The first character of a field must be a letter or number.

  Device instance fields must start with a letter or number. The device ID
  can only contain letters, numbers, and the following symbols: period (.),
  hyphen (-), underscore (_), and plus (+). The device nickname can only
  contain numbers, letters, and the space ( ) symbol.

Options:
  --model TEXT                    Enter a globally-unique identifier for this
                                  device model; you should use your project ID
                                  as a prefix to help avoid collisions over
                                  the range of all projects (for example, "my-
                                  dev-project-my-led1").  [required]
  --type [LIGHT|SWITCH|OUTLET]    Select the type of device hardware that best
                                  aligns with your device. Select LIGHT if
                                  none of the listed choices aligns with your
                                  device.  [required]
  --trait TEXT                    Add traits (abilities) that the device
                                  supports. Pass this flag multiple times to
                                  create a list of traits. Refer to https://de
                                  velopers.google.com/assistant/sdk/reference/
                                  traits/ for a list of supported traits.
  --manufacturer TEXT             Enter the manufacturer's name in this field
                                  (for example, "Assistant SDK developer").
                                  This information may be shown in the
                                  Assistant settings and internal analytics.
                                  [required]
  --product-name TEXT             Enter the product name in this field (for
                                  example, "Assistant SDK light").  [required]
  --description TEXT              Enter a description of the product in this
                                  field (for example, "Assistant SDK light
                                  device").
  --device TEXT                   Enter an identifier for the device instance.
                                  This ID must be unique within all of the
                                  devices registered under the same Google
                                  Developer project.  [required]
  --nickname TEXT                 Enter a nickname for the device. You can use
                                  this name when talking to your Assistant to
                                  refer to this device.
  --client-type [SERVICE|LIBRARY]
                                  Select the type of the client. Use SERVICE
                                  if using the Google Assistant Service or
                                  LIBRARY if using the Google Assistant
                                  Library.  [required]
  --help                          Show this message and exit.

註冊裝置

googlesamples-assistant-devicetool register-device --help
Usage: googlesamples-assistant-devicetool register-device [OPTIONS]

  Registers a device instance under an existing device model.

  Device instance fields must start with a letter or number. The device ID
  can only contain letters, numbers, and the following symbols: period (.),
  hyphen (-), underscore (_), and plus (+). The device nickname can only
  contain numbers, letters, and the space ( ) symbol.

Options:
  --device TEXT                   Enter an identifier for a device instance.
                                  If the device ID already exists, this
                                  command will update the device instance. If
                                  it does not exist, this command will create
                                  a new device instance. This ID must be
                                  unique within all of the devices registered
                                  under the same Google Developer project.
                                  [required]
  --model TEXT                    Enter the identifier for an existing device
                                  model. This new device instance will be
                                  associated with this device model.
                                  [required]
  --nickname TEXT                 Enter a nickname for the device. You can use
                                  this name when talking to your Assistant to
                                  refer to this device.
  --client-type [SERVICE|LIBRARY]
                                  Select the type of the client. Use SERVICE
                                  if using the Google Assistant Service or
                                  LIBRARY if using the Google Assistant
                                  Library.  [required]
  --help                          Show this message and exit.

註冊模型

googlesamples-assistant-devicetool register-model --help
Usage: googlesamples-assistant-devicetool register-model [OPTIONS]

  Registers a device model.

  Device model fields can only contain letters, numbers, and the following
  symbols: period (.), hyphen (-), underscore (_), space ( ) and plus (+).
  The first character of a field must be a letter or number.

Options:
  --model TEXT                  Enter a globally-unique identifier for this
                                device model; you should use your project ID
                                as a prefix to help avoid collisions over the
                                range of all projects (for example, "my-dev-
                                project-my-led1").  [required]
  --type [LIGHT|SWITCH|OUTLET]  Select the type of device hardware that best
                                aligns with your device. Select LIGHT if none
                                of the listed choices aligns with your device.
                                [required]
  --trait TEXT                  Add traits (abilities) that the device
                                supports. Pass this flag multiple times to
                                create a list of traits. Refer to https://deve
                                lopers.google.com/assistant/sdk/reference/trai
                                ts/ for a list of supported traits.
  --manufacturer TEXT           Enter the manufacturer's name in this field
                                (for example, "Assistant SDK developer"). This
                                information may be shown in the Assistant
                                settings and internal analytics.  [required]
  --product-name TEXT           Enter the product name in this field (for
                                example, "Assistant SDK light").  [required]
  --description TEXT            Enter a description of the product in this
                                field (for example, "Assistant SDK light
                                device").
  --help                        Show this message and exit.