สคีมาของรุ่นอุปกรณ์และอินสแตนซ์
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
รุ่นของอุปกรณ์
ช่องต่างๆ ในส่วนนี้เป็นตัวกำหนดรุ่นของอุปกรณ์
ฟิลด์รุ่นอุปกรณ์มีได้เฉพาะตัวอักษร ตัวเลข และรายการต่อไปนี้ สัญลักษณ์ ได้แก่ จุด (.) ขีดกลาง (-) ขีดล่าง (_) เว้นวรรค ( ) และเครื่องหมายบวก (+) อักขระตัวแรกของช่องต้องเป็นตัวอักษรหรือตัวเลข
{ "project_id": "my-devices-project", "device_model_id": "my-devices-project-prototype-light-v1", "manifest": { "manufacturer": "Assistant SDK developer", "product_name": "Assistant SDK light", "device_description": "Assistant SDK light device" }, "device_type": "action.devices.types.LIGHT", "traits": ["action.devices.traits.OnOff"] }
{ "project_id": string, "device_model_id": string, "manifest": { "manufacturer": string, "product_name": string, "device_description": string }, "device_type": string, "traits": [ string ] }
project_id
: (สตริง) ต้องระบุ รหัสโปรเจ็กต์ Google Cloud Platform ของโปรเจ็กต์คอนโซล Actions เพื่อเชื่อมโยงกับรุ่นอุปกรณ์นี้ โปรเจ็กต์หนึ่งๆ จะมีอุปกรณ์ได้หลายรุ่น device_model_id
: (สตริง) ต้องระบุ ตัวระบุที่ไม่ซ้ำกันทั่วโลก สำหรับรุ่นอุปกรณ์นี้ ใช้ project_id
เป็น คำนำหน้าเพื่อช่วยหลีกเลี่ยงการชนกันของโปรเจ็กต์ทั้งหมด ใช้แล้ว ในเมตริกและระหว่างการลงทะเบียนอุปกรณ์ manifest
: (object(Manifest)) ข้อมูลเมตาที่อธิบาย รุ่นและผู้ผลิตอุปกรณ์ ซึ่งอาจจะแสดงใน SDK (เร็วๆ นี้) คอนโซล แดชบอร์ดเมตริก และอินเทอร์เฟซแบบภาพอื่นๆ ที่เกี่ยวข้อง manifest.manufacturer
: (สตริง) ต้องระบุ ชื่ออุปกรณ์ ผู้ผลิต manifest.product_name
: (สตริง) ต้องระบุ สำหรับผู้บริโภค ชื่อผลิตภัณฑ์สำหรับรุ่นอุปกรณ์นี้ manifest.device_description
: (สตริง) ไม่บังคับ คำอธิบาย ของรุ่นอุปกรณ์นี้
device_type
: (สตริง) ต้องระบุ ประเภทของฮาร์ดแวร์ของอุปกรณ์ เลือก จากตัวเลือกต่อไปนี้ action.devices.types.CAMERA
action.devices.types.DISHWASHER
action.devices.types.DRYER
action.devices.types.LIGHT
action.devices.types.OUTLET
action.devices.types.PHONE
action.devices.types.REFRIGERATOR
action.devices.types.SCENE
action.devices.types.SOUNDBAR
action.devices.types.SPEAKER
action.devices.types.SWITCH
action.devices.types.THERMOSTAT
action.devices.types.TV
action.devices.types.VACUUM
action.devices.types.WASHER
traits
: (Array<String>) ไม่บังคับ รายการลักษณะของอุปกรณ์ รองรับ ลักษณะรวมถึงคำสั่ง แอตทริบิวต์ และสถานะสำหรับ อุปกรณ์ คุณไม่จำเป็นต้องกำหนดแพ็กเกจการดำเนินการ ที่จะใช้ ฟีเจอร์ในตัว
อินสแตนซ์ของอุปกรณ์
ช่องต่างๆ ในส่วนนี้จะเป็นตัวกำหนดอินสแตนซ์ของอุปกรณ์
ช่องอินสแตนซ์อุปกรณ์ต้องขึ้นต้นด้วยตัวอักษรหรือตัวเลข รหัสอุปกรณ์ มีได้เฉพาะตัวอักษร ตัวเลข และสัญลักษณ์ต่อไปนี้เท่านั้น: จุด (.), ขีดกลาง (-) ขีดล่าง (_) และบวก (+) ชื่อเล่นของอุปกรณ์ใช้ได้เฉพาะ มีตัวเลข ตัวอักษร และสัญลักษณ์เว้นวรรค ( )
{ "id": "my_led_1", "model_id": "my-devices-project-prototype-light-v1", "nickname": "My Assistant Light", "client_type": "SDK_LIBRARY" }
{ "id": string, "model_id": string, "nickname": string, "client_type": string }
id
: (สตริง) ต้องระบุ ตัวระบุสำหรับอุปกรณ์ทดสอบ ต้องเท่ากับ ไม่ซ้ำในอุปกรณ์ทั้งหมดที่ลงทะเบียนภายใต้ โปรเจ็กต์นักพัฒนาซอฟต์แวร์ model_id
: (สตริง) ต้องระบุ ตัวระบุรุ่นอุปกรณ์ ต้อง เหมือนกับ device_model_id
ที่เชื่อมโยงกับอุปกรณ์ทดสอบนี้ รุ่นของอุปกรณ์ต้องลงทะเบียนแล้ว ก่อนหน้านี้ nickname
: (สตริง) ไม่บังคับ ชื่อเล่นสำหรับอุปกรณ์ ชื่อนี้ จะใช้เพื่ออ้างถึงอุปกรณ์ในอินเทอร์เฟซแบบภาพ เช่น การตั้งค่า Assistant client_type
: (สตริง) ต้องระบุ ประเภทของอุปกรณ์ไคลเอ็นต์ ต้องเท่ากับ อย่างใดอย่างหนึ่งต่อไปนี้: SDK_SERVICE
หรือ SDK_LIBRARY
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eDevice models are defined with a unique ID, manufacturer details, device type, and supported traits, enabling the Google Assistant to understand and interact with the device.\u003c/p\u003e\n"],["\u003cp\u003eDevice instances represent individual devices, linking to a specific model with a unique ID, an optional nickname, and client type (SDK service or library).\u003c/p\u003e\n"],["\u003cp\u003eDevice model and instance IDs can contain letters, numbers, and specific symbols, ensuring proper formatting for identification within the Google ecosystem.\u003c/p\u003e\n"],["\u003cp\u003eA device model's \u003ccode\u003etraits\u003c/code\u003e field determines its functionalities and capabilities, allowing developers to define its behavior and interaction with the Google Assistant.\u003c/p\u003e\n"],["\u003cp\u003eDevice instances are registered using their unique ID and associated with a pre-registered device model, enabling them to be recognized and controlled by the Google Assistant.\u003c/p\u003e\n"]]],["Device models are defined by fields such as `project_id`, `device_model_id`, `manifest`, `device_type`, and `traits`. Fields can contain letters, numbers, and specific symbols. `Manifest` describes the device's manufacturer, product name, and description. Device instances have fields like `id`, `model_id`, `nickname`, and `client_type`, which specify unique identifiers, associated device models, nicknames, and client types. The device `id` and `model_id` are required.\n"],null,["# Device Model and Instance Schemas\n\nDevice model\n------------\n\nThe device model is defined by the fields in this section.\n\n\nDevice model fields can only contain letters, numbers, and the following\nsymbols: period (.), hyphen (-), underscore (_), space ( ) and plus\n(+). The first character of a field must be a letter or number.\nExample \n\n```carbon\n{\n \"project_id\": \"my-devices-project\",\n \"device_model_id\": \"my-devices-project-prototype-light-v1\",\n \"manifest\": {\n \"manufacturer\": \"Assistant SDK developer\",\n \"product_name\": \"Assistant SDK light\",\n \"device_description\": \"Assistant SDK light device\"\n },\n \"device_type\": \"action.devices.types.LIGHT\",\n \"traits\": [\"action.devices.traits.OnOff\"]\n}\n```\nSchema \n\n```carbon\n{\n \"project_id\": string,\n \"device_model_id\": string,\n \"manifest\": {\n \"manufacturer\": string,\n \"product_name\": string,\n \"device_description\": string\n },\n \"device_type\": string,\n \"traits\": [ string ]\n}\n```\n\n- **`project_id`:** (String) Required. Google Cloud Platform project [ID](https://support.google.com/cloud/answer/6158840) of the Actions Console project to associate with this device model. A project can contain multiple device models.\n- **`device_model_id`:** (String) Required. Globally-unique identifier for this device model; use the `project_id` as a prefix to help avoid collisions over the range of all projects. Used in metrics and during device registration.\n- **`manifest`:** (object(Manifest)) Required. Metadata that describes the device model and manufacturer. This may be shown in the (upcoming) SDK console, metrics dashboards, and other related visual interfaces.\n - **`manifest.manufacturer`:** (String) Required. Name of the device manufacturer.\n - **`manifest.product_name`:** (String) Required. Consumer-facing product name for this device model.\n - **`manifest.device_description`:** (String) Optional. Description of this device model.\n- **`device_type`:** (String) Required. The type of device hardware. Select from the following:\n - `action.devices.types.CAMERA`\n - `action.devices.types.DISHWASHER`\n - `action.devices.types.DRYER`\n - `action.devices.types.LIGHT`\n - `action.devices.types.OUTLET`\n - `action.devices.types.PHONE`\n - `action.devices.types.REFRIGERATOR`\n - `action.devices.types.SCENE`\n - `action.devices.types.SOUNDBAR`\n - `action.devices.types.SPEAKER`\n - `action.devices.types.SWITCH`\n - `action.devices.types.THERMOSTAT`\n - `action.devices.types.TV`\n - `action.devices.types.VACUUM`\n - `action.devices.types.WASHER`\n- **`traits`:** (Array\\\u003cString\\\u003e) Optional. List of traits the device supports. Traits include the commands, attributes, and states for the device. You do not need to define an [Action package](/assistant/conversational/action-package/reference/rest/Shared.Types/ActionPackage) to use [built-in traits](/assistant/sdk/reference/traits).\n\nDevice instance\n---------------\n\nThe device instance is defined by the fields in this section.\n\n\nDevice instance fields must start with a letter or number. The device ID\ncan only contain letters, numbers, and the following symbols: period (.),\nhyphen (-), underscore (_), and plus (+). The device nickname can only\ncontain numbers, letters, and the space ( ) symbol.\nExample \n\n```carbon\n {\n \"id\": \"my_led_1\",\n \"model_id\": \"my-devices-project-prototype-light-v1\",\n \"nickname\": \"My Assistant Light\",\n \"client_type\": \"SDK_LIBRARY\"\n }\n```\nSchema \n\n```carbon\n {\n \"id\": string,\n \"model_id\": string,\n \"nickname\": string,\n \"client_type\": string\n }\n```\n\n- **`id`:** (String) Required. Identifier for the test device. Must be unique within all of the devices registered under the same Google Developer project.\n- **`model_id`:** (String) Required. Identifier of the device model; must be the same as the [`device_model_id`](#device_model_json) associated with this test device. The device model must have been registered previously.\n- **`nickname`:** (String) Optional. Nickname for the device. This name will be used to refer to the device in visual interfaces like the Assistant settings.\n- **`client_type`:** (String) Required. The type of client device. Must be either of the following: `SDK_SERVICE` or `SDK_LIBRARY`."]]