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 Google Developer Project. No other projects have access to your model and device information.

The sample code includes a registration tool for your convenience. Make sure you run the tool in the same directory you used to generate your credentials. Also, note that you must be an Owner or Editor of a given Google Developer Project to register models for it. (Add these roles for other users in the Cloud Console—see the IAM documentation).

Use the registration tool

Use the registration tool to register 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.

In the following command, replace my-model with whatever you want to call your model. Note that this name must be globally unique so you should use your Google Developer Project ID as a prefix to help avoid collisions (for example, my-dev-project-my-model1).

googlesamples-assistant-devicetool register-model --manufacturer my-manufacturer \
          --product-name my-product-name [--description my-product-description] \
          --type device-type [--trait supported-trait] --model my-model

Here is an example command:

googlesamples-assistant-devicetool register-model --manufacturer "Assistant SDK developer" \
          --product-name "Assistant SDK light" --type LIGHT --model my-model

Now query the server for the model you just created.

googlesamples-assistant-devicetool get --model my-model

You can run the register command again and supply any (or all) of these arguments to update the model. See the device model JSON reference for more information.

List the device models

You can check all the device models created under your developer project at any time by using the command below:

googlesamples-assistant-devicetool list --model

Next step

Run the Sample Code