Sentence
The Sentence trigger is useful when you want to start an automation with your voice, or by typing to Assist. You choose one or more sentences, and the trigger reacts when you say or type one of them. For example, you can say “it’s party time” to start a party scene, or ask “is the garage door open” and have Assist answer.
Using this trigger from the user interface
If you prefer building automations visually, Home Assistant walks you through this trigger step by step. You pick what to watch, tweak a few options, and save. No YAML knowledge required.
To use this trigger in an automation:
- Go to Settings > Automations & scenes.
- Open an existing automation, or select Create automation > Create new automation.
- In the When section, select Add trigger.
- Search for and select the Sentence trigger.
- In Add sentence, enter a sentence that should start the automation, and select Add sentence
. - Don’t use punctuation, such as a question mark.
- To add more sentences, repeat this step. Each of the sentences starts the automation.
- Optional: To have Assist answer, add the Set conversation response action.
- Select Save.
Options in the UI
Writing sentences
Sentences use the same template sentence syntax as custom sentences. Use square brackets for optional words, and parentheses with | for alternatives:
trigger: conversation
command:
- "[it's ]party time"
- "happy (new year|birthday)"
The first sentence matches both “party time” and “it’s party time”. The second sentence matches both “happy new year” and “happy birthday”. When Assist matches a sentence, it ignores punctuation and capitalization.
Sentence wildcards
You can use lists as wildcards to capture text from the matched sentence. The captured text is available in trigger.slots. For example, with the sentence play {album} by {artist}, trigger.slots.album contains the name of the album. For the full data, including trigger.details, refer to Sentence triggers.
Wildcards match greedily. If a wildcard captures more text than you expect, add words around the wildcard to make the sentence more specific.
Inline number ranges
To match a number, use a range like {0..100:brightness}. This matches numbers from 0 to 100, and stores the value in the brightness slot. It works for digits and words, so the sentence set brightness to {0..100:brightness} percent matches both “set brightness to 50 percent” and “set brightness to fifty percent”.
In both cases, trigger.slots.brightness is 50. To get the text that was said or typed, use trigger.details, such as trigger.details.brightness.text.
Using this trigger in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
When this trigger starts an automation, it passes data about what happened to the automation. You can use this trigger data in the templates of your conditions and actions. To see which data is available, refer to Trigger data in templates.
In YAML, use trigger: conversation. A basic example looks like this:
trigger: conversation
command: "[it's ]party time"
This runs when you say or type “party time” or “it’s party time”.
Options in YAML
The sentence, or a list of sentences, that starts the automation. Use the template sentence syntax, and don’t use punctuation.
Good to know
- The trigger works with the Home Assistant conversation agent of Assist. Other conversation agents, such as the ones of the OpenAI and Google Gemini integrations, only use sentence triggers when Prefer handling commands locally is turned on.
- Home Assistant checks sentence triggers before the built-in sentences. If your sentence also matches a built-in command, such as “turn on the kitchen lights”, your automation runs instead of the built-in command.
- Several automations can use the same sentence. They all run. Assist answers with the first response that one of the automations sets with Set conversation response. If none of them sets a response, Assist answers “Done”.
- For the data that this trigger passes to your conditions and actions, such as
trigger.sentenceandtrigger.slots, refer to Sentence triggers.
Try it yourself
Ready to test this? Go to Settings > Automations & scenes, create a new automation, and add this trigger. Save the automation, and then make the trigger react. For example, change the state of the targeted entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more], turn on a light that the trigger monitors, or change its brightness. To check whether the automation ran, open its traces.
For this trigger, open Assist and say or type one of your sentences. For a complete walkthrough, refer to Adding a custom sentence to trigger an automation.
More examples
Real scenarios where this trigger fires in automations and scripts. Copy any example and adapt it to your setup. In the visual editor, select the UI options listed in the example when they are available, or paste the YAML code.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the visual automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.
Automation: answer whether the garage door is open
When you ask Assist “Is the garage door open?”, this automation answers with the current state of the garage door, for example, “The garage door is closed.”
-
Trigger: Sentence
-
Sentence:
Is the garage door open
-
Sentence:
-
Action: Set conversation response
-
Set conversation response:
The garage door is {{ states('cover.garage_door') }}.
-
Set conversation response:
YAML example for answering whether the garage door is open
alias: "Answer whether the garage door is open"
triggers:
- trigger: conversation
command: "Is the garage door open"
actions:
- set_conversation_response: >
The garage door is {{ states('cover.garage_door') }}.
Automation: play an album by an artist
When you say “play” followed by the name of an album, “by”, and the name of an artist, play that album on the living room speaker. The wildcards capture both names. This example uses the Play media action of the Music Assistant integration, which can find an album by its name.
-
Trigger: Sentence
-
Sentence:
play {album} by {artist}
-
Sentence:
-
Action: Play media (Music Assistant)
-
Target: Living room speaker (
media_player.living_room_speaker) -
Media ID(s):
{{ trigger.slots.album }} - Media type: Album
-
Artist name:
{{ trigger.slots.artist }}
-
Target: Living room speaker (
YAML example for playing an album by an artist
alias: "Play an album by an artist"
triggers:
- trigger: conversation
command: "play {album} by {artist}"
actions:
- action: music_assistant.play_media
target:
entity_id: media_player.living_room_speaker
data:
media_id: "{{ trigger.slots.album }}"
media_type: album
artist: "{{ trigger.slots.artist }}"
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the trigger you’re using and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain triggers or suggest the right one when you describe what you want in plain language.
Related triggers
Explore related triggers:
- Manual event received: Triggers when an event is fired on the Home Assistant event bus.