Zarejestruj cechy
Asystent Google musi być w stanie powiązać zapytanie z poleceniem, które ma zostać wysłane na Twoje urządzenie. Aby to działało, musisz zadeklarować, jakie funkcje obsługuje Twoje urządzenie. Są to tzw. cechy. Te cechy deklarujesz w ramach modelu urządzenia.
Firma Google stworzyła już wiele wspólnych cech, które występują na wielu urządzeniach. Te cechy nie są powiązane tylko z jednym typem urządzenia – możesz ich używać według własnego uznania.
Dodaj cechę
Masz już zdefiniowany model, a teraz zaktualizuj go, dodając cechę. W tym przypadku dodaj funkcję włączania/wyłączania, by sterować diodą LED podłączoną do urządzenia.
Otwórz projekt w Konsoli Actions.
Na lewym pasku nawigacyjnym wybierz kartę Rejestracja urządzenia.
Kliknij model na liście, aby go edytować.
Kliknij ołówek w polu Obsługiwane cechy, aby dodać cechę.
Zaznacz pole wyboru OnOff. Kliknij ZAPISZ.
Pamiętaj, aby zapisać zmiany w modelu. Ponownie kliknij ZAPISZ.
Następny krok
Obsługa poleceń
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2023-12-02 UTC.
[null,null,["Ostatnia aktualizacja: 2023-12-02 UTC."],[[["The Google Assistant Library for Python is deprecated and developers should utilize the Google Assistant Service instead."],["Device capabilities, known as traits, are defined within the device model to enable the Google Assistant to link user queries with device commands."],["Google provides pre-built traits for common device functionalities that can be incorporated into your device model."],["Adding 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."]]],["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"]]