Register Traits for the Device

The Google Assistant needs to be able to associate a query with a command to send to your device. For this to work, you need to declare what kinds of abilities your device supports. These abilities are known as traits. You declare these traits within your device model.

Google has already created a wide variety of common traits found on many devices. These traits are not tied to just one device type, you can use them as you choose.

Add a trait

You previously defined a model, now update it by adding a trait. In this case, add an On/Off trait to control an LED attached to your device.

googlesamples-assistant-devicetool register-model --manufacturer "Assistant SDK developer" \
          --product-name "Assistant SDK light" --type LIGHT --trait action.devices.traits.OnOff \
          --model my-model # To add more traits: --trait action.devices.traits.Brightness --trait action.devices.traits.ColorTemperature

Update the device instance

The sample code registered a particular device instance based on your original device model. Since you updated this device model, you need to update the instance(s) that use it.

In the command below, change my-model to the name you used for your model. Change my-device-id to the device instance ID that was created by the sample.

googlesamples-assistant-devicetool register-device --client-type LIBRARY \
          --model my-model --device my-device-id

Use this same command to update the device instance if the associated device model changes again (for example, when you add more traits).

Next step

Handle Commands on the Device