mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-14 04:46:49 +00:00
Document set_conversation_response
script action (#31004)
* Document `set_conversation_response` script action * Update scripts.markdown * Apply suggestions from code review * close raw tag * Add backticks --------- Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> Co-authored-by: c0ffeeca7 <k0ffeeka7@gmail.com>
This commit is contained in:
parent
b1b107e49f
commit
3728e81fe8
@ -914,6 +914,36 @@ script:
|
|||||||
entity_id: light.ceiling
|
entity_id: light.ceiling
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Respond to a conversation
|
||||||
|
|
||||||
|
The `set_conversation_response` script action allows returning a custom response
|
||||||
|
when an automation is triggered by a conversation engine, for example a voice
|
||||||
|
assistant. The conversation response can be templated.
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Example of a templated conversation response resulting in "Testing 123"
|
||||||
|
- variables:
|
||||||
|
my_var: "123"
|
||||||
|
- set_conversation_response: "{{ 'Testing ' + my_var }}":
|
||||||
|
```
|
||||||
|
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
|
The response is handed to the conversation engine when the automation finishes. If
|
||||||
|
the `set_conversation_response` is executed multiple times, the most recent
|
||||||
|
response will be handed to the conversation engine. To clear the response, set it
|
||||||
|
to `None`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Example of a clearing a conversation response
|
||||||
|
set_conversation_response: ~
|
||||||
|
```
|
||||||
|
|
||||||
|
If the automation was not triggered by a conversation engine, the response
|
||||||
|
will not be used by anything.
|
||||||
|
|
||||||
[Script integration]: /integrations/script/
|
[Script integration]: /integrations/script/
|
||||||
[automations]: /docs/automation/action/
|
[automations]: /docs/automation/action/
|
||||||
[Alexa/Amazon Echo]: /integrations/alexa/
|
[Alexa/Amazon Echo]: /integrations/alexa/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user