ภาพรวมการดำเนินการของอุปกรณ์
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
SDK ของ Google Assistant ช่วยให้คุณฝัง Google Assistant ลงในโปรเจ็กต์ของคุณเองได้
เพื่อให้ทำงานคล้ายกับ Google Home อย่างไรก็ตาม โปรเจ็กต์ของคุณ
อาจมีความสามารถด้านฮาร์ดแวร์ที่ไม่เหมือนใครซึ่ง Google Home ไม่มี เช่น
อาจมีจอแสดงผล LED ที่ไม่เหมือนใครพร้อมการตั้งค่าความสว่างและ
สีที่ปรับแต่งได้
การดำเนินการของอุปกรณ์คือชุดเครื่องมือและ API ที่ช่วยให้คุณขยายสิ่งที่ Assistant ทำได้ในโปรเจ็กต์ที่คุณพัฒนา เพื่อใช้ศักยภาพของความสามารถด้านฮาร์ดแวร์ได้อย่างเต็มที่
การดำเนินการของอุปกรณ์ในตัว
Google ได้สร้างการทำงานของอุปกรณ์ทั่วไปในตัวที่หลากหลายสำหรับสิ่งต่างๆ ในชีวิตประจำวัน
ซึ่งรวมถึงไฟ เครื่องใช้ไฟฟ้า และกล้อง การดำเนินการเหล่านี้ช่วยให้คุณ
ใช้ประโยชน์จากการประมวลผลภาษาธรรมชาติของ Google Assistant เพื่อ
ควบคุมโปรเจ็กต์ได้ ตัวอย่างเช่น โปรเจ็กต์ที่มีไฟสามารถเปิดได้หลายวิธี ดังนี้
- Ok Google เปิดไฟหน่อย
- Ok Google เปิดไฟหน่อย
- Ok Google เปิดไฟห้องนั่งเล่นหน่อย
คุณสร้างโปรเจ็กต์ของคุณเองที่ตอบสนองต่อคำสั่งสำหรับลักษณะสมาร์ทโฮม
ได้ เช่น
- Ok Google ปรับความสว่างเป็น 50%
- Ok Google ตั้งอุณหภูมิเป็น 36 องศา
การทำงานของอุปกรณ์ที่กำหนดเอง
นอกจากนี้ คุณยังสร้างการทำงานของอุปกรณ์ที่กำหนดเองสำหรับฮาร์ดแวร์ที่ไม่เหมือนใครของคุณเองได้ด้วย สำหรับการดำเนินการเหล่านี้
คุณต้องกำหนดไวยากรณ์และคำสั่ง
- Ok Google กระพริบไฟ 5 ครั้ง
- Ok Google เลื่อนไปทางซ้าย
ดูข้อมูลเพิ่มเติมเกี่ยวกับการรวมการดำเนินการเหล่านี้โดยใช้บริการ Google Assistant
วิธีการทำงาน
อุปกรณ์มี SDK ของ Google Assistant ติดตั้งอยู่พร้อมกับข้อมูลเข้าสู่ระบบสำหรับ
เข้าถึงบริการของ Google Assistant อุปกรณ์จะส่งคำขอที่พูด
(เปิด) และขอให้บริการเปิดไฟ LED ในตัวของอุปกรณ์
นอกจากนี้ อุปกรณ์ยังส่งตัวระบุรุ่นและอินสแตนซ์ของอุปกรณ์เพื่อให้บริการ
พิจารณาวิธีตอบกลับคำขอในบริบทได้ดีที่สุด
บริการใช้การจดจำเสียงอัตโนมัติ (ASR) เพื่อระบุคำที่ผู้ใช้พูด การประมวลผลภาษาธรรมชาติ (NLP) เพื่อวิเคราะห์และทำความเข้าใจความหมายของคำขอจากคำเหล่านั้น และการจับคู่อุปกรณ์เพื่อระบุบริบทสำหรับคำขอ บริบทนี้มีความสำคัญเนื่องจากเป็นตัวกำหนดการดำเนินการที่อุปกรณ์รองรับและวิธีดำเนินการตามการดำเนินการเหล่านี้
จากนั้นบริการจะตอบกลับด้วยข้อความที่พูดกลับไปหาผู้ใช้ (ได้เลย)
พร้อมกับคำสั่งเฉพาะอุปกรณ์ อุปกรณ์ทราบวิธีจัดการคำสั่งนี้
โดยจะเปิดไฟ LED

เริ่มต้นใช้งาน
เปลี่ยนไอเดียของคุณให้เป็นจริงด้วยการฝัง Google Assistant
ลงในโปรเจ็กต์ แล้วเพิ่มฟังก์ชันการทำงานที่ไม่เหมือนใครด้วยการดำเนินการของอุปกรณ์ คุณพัฒนาโปรเจ็กต์โดยใช้บริการ Google Assistant ได้
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\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,["# Device Actions Overview\n\nWith the Google Assistant SDK, you can embed the Google Assistant into your\nown project, making it function similarly to a Google Home. However, your project\nmay have unique hardware capabilities that Google Home does not have: for\nexample, it may have a unique LED display with customizable brightness and\ncolor settings.\n\nDevice Actions are a set of tools and APIs that allow you to extend what\nthe Assistant can do, in the projects you develop, to take full potential of\ntheir hardware capabilities.\n\nBuilt-in Device Actions\n-----------------------\n\nGoogle has created a wide range of common built-in device actions for everyday\nthings, including lights, appliances, and cameras. With these actions, you can\nharness the power of the Google Assistant's natural language processing to\ncontrol your project. For example, a project with a light can be turned on in\ndifferent ways:\n\n- *Ok Google, turn on the light.*\n- *Hey Google, turn my light on.*\n- *Ok Google, turn on my living room light.*\n\nYou can create your own project that responds to commands for\nmany\n[smart home traits](/assistant/sdk/reference/traits)\nlike:\n\n- *Ok Google, set the brightness to 50%.*\n- *Hey Google, set the temperature to 98 degrees.*\n\nCustom Device Actions\n---------------------\n\nYou can also create custom device actions for your own unique hardware. For these\nactions, you define the grammar and commands:\n\n- *Ok Google, blink my light 5 times.*\n- *Hey Google, move left.*\n\nLearn more about incorporating these actions using the [Google Assistant service](/assistant/sdk/guides/service/python/extend/custom-actions).\n\nHow it works\n------------\n\nThe device has the Google Assistant SDK installed on it along with credentials for\naccessing the Google Assistant Service. The device sends out the spoken request\n(*Turn on.*) and asks the service to turn on the device's onboard LED.\nThe device also sends its model and device instance identifiers so the service\ncan determine how to best respond in context to the request.\n\nThe service uses Automatic Speech Recognition (ASR) to determine what words were\nspoken by the user, Natural Language Processing (NLP) to analyze and understand\nthe meaning of the request from these words, and device matching to provide context\nfor the request. This context is important because it defines the actions the\ndevice supports and how these actions should be fulfilled.\n\nThe service then responds with text that is spoken back to the user (*Sure.*)\nalong with the device-specific command. The device knows how to handle this\ncommand: it turns on its LED!\n\nGet started\n-----------\n\nBring your ideas to life by embedding the Google Assistant\ninto your project and then adding unique functionality with Device\nActions. You can develop your project [using the Google Assistant service](/assistant/sdk/guides/service/python)."]]