Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
L'Assistant Google doit pouvoir associer une requête à une commande à envoyer à votre appareil. Pour que cela fonctionne, vous devez déclarer les types de fonctionnalités compatibles avec votre appareil. Ces capacités sont appelées caractéristiques. Vous déclarez ces caractéristiques dans le modèle de votre appareil.
Google a déjà créé une grande variété de caractéristiques communes que l'on trouve sur de nombreux appareils. Ces caractéristiques ne sont pas liées à un seul type d'appareil. Vous pouvez les utiliser à votre guise.
Ajouter un trait
Vous avez déjà défini un modèle. Maintenant, mettez-le à jour en ajoutant une caractéristique. Dans ce cas, ajoutez une caractéristique d'activation/de désactivation pour contrôler une LED connectée à votre appareil.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\u003cp\u003eThe Google Assistant Library for Python is deprecated and developers should utilize the Google Assistant Service instead.\u003c/p\u003e\n"],["\u003cp\u003eDevice capabilities, known as traits, are defined within the device model to enable the Google Assistant to link user queries with device commands.\u003c/p\u003e\n"],["\u003cp\u003eGoogle provides pre-built traits for common device functionalities that can be incorporated into your device model.\u003c/p\u003e\n"],["\u003cp\u003eAdding a trait to your device model involves using the Actions Console to select and save the desired trait, such as the OnOff trait for controlling an LED.\u003c/p\u003e\n"]]],["Device traits define a device's abilities for the Google Assistant. To add a trait, access the Actions Console, select the \"Device registration\" tab, and edit the desired model. Within the model, add the desired trait by clicking the pencil icon in the \"Supported traits\" box and selecting it, like the \"OnOff\" trait for LED control, then save. The Google Assistant Library for Python is deprecated, use the Google Assistant Service instead.\n"],null,["# Register Traits\n\n| **Warning:** The Google Assistant Library for Python is deprecated as of June 28th, 2019. Use the [Google Assistant Service](/assistant/sdk/guides/service/python) instead.\n\n\u003cbr /\u003e\n\nThe Google Assistant needs to be able to associate a query with a\ncommand to send to your device. For this to work, you need to declare what kinds\nof abilities your device supports. These abilities are known as *traits*. You\ndeclare these traits within your device model.\n\nGoogle has already created a wide variety of common [traits](/assistant/sdk/reference/traits)\nfound on many devices. These traits are not tied to just one device type, you can\nuse them as you choose.\n\nAdd a trait\n-----------\n\nYou previously defined a model, now update it by adding a trait. In this case,\nadd an On/Off trait to control an LED attached to your device.\n\n1. Open the project in the [Actions Console](https://console.actions.google.com/).\n\n2. Select the **Device registration** tab from the left navbar.\n\n3. Click a model from the list to edit it.\n\n4. Click the pencil in the **Supported traits** box to add the trait.\n\n5. Select the **OnOff** checkbox. Click **SAVE**.\n\n6. Make sure to save changes to the model. Click **SAVE** again.\n\nNext step\n---------\n\n[Handle Commands](/assistant/sdk/guides/library/python/extend/handle-device-commands)"]]