智慧住宅意圖是簡單的訊息物件,用來說明smart home Action to perform such as turn on a light or cast audio to a speaker.
所有 smart home 意圖都包含在 action.devices
命名空間中,且您必須為這些意圖提供執行要求。每次Google Assistant
sends an intent to fulfillment, a user's
third-party OAuth 2 access token is passed in the Authorization header.
以下是支援的 smart home 意圖:
同步處理
action.devices.SYNC
意圖用於要求使用者已連線且可供使用的 smart home 裝置清單。
當使用者透過 Google Home app (GHA)
, they also
get authenticated to your cloud infrastructure. Then,
Assistant receives an OAuth2 token. At this point,
Assistant sends a action.devices.SYNC
intent to your
fulfillment to retrieve the initial list of user devices and capabilities from
your cloud infrastructure. 設定裝置時

為避免取消連結及重新連結使用者帳戶,您可以將要求同步處理傳送至 Assistant。這項操作會將 action.devices.SYNC
意圖傳送至執行要求,以同步處理裝置和功能清單。詳情請參閱實作 要求同步處理。

在設定「本機執行要求」時,本機首頁平台會檢查來自 smart home 動作的 Cloud 執行要求中的 SYNC
回應。如要進一步瞭解如何修改 SYNC
回應以支援本機執行要求,請參閱更新雲端執行中的 SYNC 回應。
查詢
action.devices.QUERY
意圖用於查詢 smart home 裝置的目前狀態。
當使用者查詢裝置狀態時,為了回答以下問題,例如:「Ok Google,廚房的燈是什麼?」Assistant 會將 action.devices.QUERY
意圖傳送至執行要求。

為了提供最佳使用者體驗,請實作報告狀態,主動向使用者裝置主動回報目前的狀態: Google Home Graph . For example, this lets Assistant know if your user turned on a smart light with a physical light switch.

執行
action.devices.EXECUTE
意圖用於提供在 smart home 裝置上執行的指令。
當使用者傳送指令至 Assistant 的裝置時,執行要求會收到您的 action.devices.EXECUTE
意圖,用於說明動作和要執行的動作。使用者可以透過裝置 (例如「Ok Google,打開客廳的燈」) 對裝置執行動作。

取消連結
當使用者取消應用程式帳戶與 Assistant 的連結時,系統會觸發 action.devices.DISCONNECT
意圖來通知您。收到 action.devices.DISCONNECT
意圖後,請不要回報這位使用者的裝置狀態。