Intent Script
The intent_script
integration allows users to configure actions and responses to intents. Intents can be fired by any integration that supports it. Examples are Alexa (Amazon Echo), Dialogflow (Google Assistant) and Snips.
If you are using intent script with LLMs and have parameters, make sure to mention the parameters and their types in the description.
# Example configuration.yaml entry
intent_script:
GetTemperature: # Intent type
description: Return the temperature and notify the user
speech:
text: We have {{ states('sensor.temperature') }} degrees
action:
action: notify.notify
data:
message: Hello from an intent!
Inside an intent we can define these variables:
Configuration Variables
Name of the intent. Multiple entries are possible.
Defines an action to run to intents.
Set to True to have Home Assistant not wait for the script to finish before returning the intent response.
The script mode in which to run the intent script. Use this to define if the intent should be able to run multiple times in parallel.
Card to display.
Text or template to return.
Text to speech.
Using the action response
When using a speech
template, data returned from the executed action are
available in the action_response
variable.
conversation:
intents:
EventCountToday:
- "How many meetings do I have today?"
intent_script:
EventCountToday:
action:
- action: calendar.get_events
target:
entity_id: calendar.my_calendar
data_template:
start_date_time: "{{ today_at('00:00') }}"
duration: { "hours": 24 }
response_variable: result # get action response
- stop: ""
response_variable: result # and return it
speech:
text: "{{ action_response['calendar.my_calendar'].events | length }}" # use the action's response