设备操作概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
借助 Google 助理 SDK,您可以将 Google 助理嵌入到自己的项目中,使其功能与 Google Home 类似。不过,您的项目可能具有 Google Home 所不具备的独特硬件功能:例如,它可能具有独特的 LED 显示屏,可自定义亮度和颜色设置。
设备操作是一组工具和 API,可让您在自己开发的项目中扩展 Google 助理的功能,以充分发挥硬件功能的潜力。
内置设备操作
Google 针对日常事务创建了各种常用的内置设备操作,包括灯具、电器和摄像头。借助这些操作,您可以利用 Google 助理的自然语言处理功能来控制项目。例如,带有灯的项目可以通过多种方式开启:
- Ok Google,开灯。
- Hey Google,开灯。
- Ok Google,打开客厅的灯。
您可以创建自己的项目,以响应许多智能家居特征
的指令,例如:
- Ok Google,将亮度设为 50%。
- Hey Google,将温度设为 98 度。
自定义设备操作
您还可以为自己的独特硬件创建自定义设备操作。对于这些操作,您需要定义语法和命令:
- Ok Google,让我的灯闪烁 5 次。
- Hey Google,向左移动。
详细了解如何通过 Google 助理服务纳入这些操作。
运作方式
设备上已安装 Google 助理 SDK,以及用于访问 Google 助理服务的凭据。设备发送语音请求(开启),并要求服务开启设备的板载 LED。
设备还会发送其型号和设备实例标识符,以便服务能够确定如何在上下文中以最佳方式响应请求。
该服务使用自动语音识别 (ASR) 来确定用户说出的字词,使用自然语言处理 (NLP) 来分析和理解这些字词所表达的请求的含义,并使用设备匹配来为请求提供上下文。此上下文非常重要,因为它定义了设备支持的操作以及应如何完成这些操作。
然后,该服务会返回一段文字,并将其读给用户听(好的。),同时还会返回特定于设备的命令。设备知道如何处理此命令:它会开启 LED!

开始使用
通过将 Google 助理嵌入到项目中,然后使用设备操作添加独特的功能,将您的创意变为现实。您可以使用 Google 助理服务开发项目。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[[["易于理解","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"]],["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eThe Google Assistant SDK enables you to integrate the Google Assistant into your projects, similar to a Google Home, and leverage Device Actions to utilize unique hardware features.\u003c/p\u003e\n"],["\u003cp\u003eDevice Actions provide tools and APIs to extend the Assistant's capabilities, allowing your project to respond to voice commands for functionalities like lights, appliances, and cameras using built-in or custom actions.\u003c/p\u003e\n"],["\u003cp\u003eBuilt-in Device Actions cover common smart home features, while Custom Device Actions let you define unique voice commands and functionalities tailored to your specific hardware.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Assistant service utilizes Automatic Speech Recognition, Natural Language Processing, and device context to understand user requests and trigger corresponding actions on your device.\u003c/p\u003e\n"],["\u003cp\u003eYou can get started by embedding the Google Assistant into your project and adding custom functionalities with Device Actions using the provided resources and guides.\u003c/p\u003e\n"]]],[],null,[]]