在 configuration.yaml 中设置自定义语句
你可以在 configuration.yaml 文件中的 conversation 配置里添加意图和语句:
这会扩展 HassTurnOn 意图的默认英文语句。除了可以说“turn on the kitchen light”,你也可以说“activate the kitchen light”。
你也可以添加新的意图,并通过 intent_script 集成为它们定义响应和动作:
除了文本响应之外,intent_script 还可以触发 Home Assistant 中任何可用的 action,例如调用服务或触发事件。
在配置目录中设置语句
更高级的自定义可以在 Home Assistant 的 config 目录中完成。例如,放在 config/custom_sentences/en 中的 YAML 文件,会在请求英文语句(语言代码 en)时被加载。
以下示例创建了一个新的 SetVolume 意图,用于修改两个媒体播放器之一的音量:
如上所述,你随后可以使用 intent_script 集成为 SetVolume 实现动作并提供响应:
自定义响应
你也可以在 config/custom_sentences/<language> 中自定义现有意图的响应:

