智能家居 intent 是一个简单的消息传递对象,用于描述 smart home Action to perform such as turn on a light or cast audio to a speaker.
所有 smart home intent 都包含在 action.devices
命名空间中,并且您必须为 intent 提供执行方式。每次
Google Assistant
sends an intent to fulfillment, a user's
third-party OAuth 2 access token is passed in the Authorization header.
以下是受支持的 smart home intent:
SYNC
action.devices.SYNC
intent 用于请求用户已连接且可供使用的 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
intent 发送到您的执行方式,以同步设备和功能列表。如需了解详情,请参阅实现请求同步。

在本地执行方式设置期间,Local Home 平台会检查来自 smart home Action 的云执行方式的 SYNC
响应。如需详细了解如何修改 SYNC
响应以支持本地执行方式,请参阅在云执行方式中更新 SYNC 响应。
查询
action.devices.QUERY
intent 用于查询 smart home 设备的当前状态。
当用户查询设备状态时,为了回答“Ok Google,厨房里开了哪些灯?”之类的问题,
Assistant 会向您的执行方式发送 action.devices.QUERY
intent。

为了提供最佳用户体验,您应实现报告状态,以主动向 Google Home Graph . For example, this lets Assistant know if your user turned on a smart light with a physical light switch. 报告用户设备的当前状态

EXECUTE
action.devices.EXECUTE
intent 用于提供在 smart home 设备上执行的命令。
当用户使用 Assistant 向设备发送命令时,你的执行方式会接收到你的执行方式的 action.devices.EXECUTE
intent,该 intent 说明了要执行的操作和要执行操作的设备。用户可以使用“Ok Google,打开客厅的灯”等命令在设备上执行一项操作。

断开连接
当用户将应用帐号与 Assistant 解除关联时,会触发 action.devices.DISCONNECT
intent 通知您。收到 action.devices.DISCONNECT
intent 后,您不应报告此用户设备的状态。