触发意图
如果你的代码将用户的语音或文本匹配到 intents,你可以让该 intent 交由 Home Assistant 处理。这既可以在你自己的 integration 内部完成,也可以通过通用的 Intent handle API 来实现。
当你 fire 一个 intent 时,你会收到一个 response,或者抛出一个 error。由你的代码负责将结果返回给用户。
HTTP API
当 intent integration 被加载后,会在 /api/intent/handle 提供一个 HTTP API endpoint。你可以向它 POST JSON 数据,其中包含 intent name 及其 data:
Home Assistant integration
在 Home Assistant 中处理 intent 的示例代码。
intent response 是 homeassistant.helpers.intent.IntentResponse 的一个实例。
Speech dictionary 的值:
Reprompt dictionary 的值:
Card dictionary 的值:

