Home Assistant Guide

Simple tutorials for powerful automations

Voice Assistant Automations in Home Assistant

Home Assistant makes it easy to create powerful automations that respond to your voice using Assist. You can trigger automations or scripts with flexible sentence patterns, use slots to capture variable details, and have your assistant or satellite devices speak, listen, or process custom commands. This guide walks you through it all, step by step.

How Sentence Triggers Work

A sentence trigger runs your automation when you say a specific phrase (or set of phrases) to Assist. The trigger patterns can use:

  • [optional] – Words in square brackets are optional.
    Example: [it's ]party time matches "party time" and "it's party time".
  • (a|b) – Alternatives, choose one.
    Example: happy (new year|birthday) matches "happy new year" or "happy birthday".
  • {slot_name}Slots (sometimes called wildcards), let you match and capture anything spoken in that place.
    Example: play {genre} music matches "play jazz music", "play relaxing music", etc., and makes the spoken words available as a variable.

You can list multiple command: patterns in a single trigger, each using any of these syntaxes.


triggers:
  - trigger: conversation
    command:
      - "[it's ]party time"
      - "happy (new year|birthday)"
    

Using Slots to Capture Variable Input

Slots are placeholders in your sentence patterns that capture user-provided values. For example, {color} in set the light to {color} will capture whatever color the user says.


triggers:
  - trigger: conversation
    command:
      - "set the [living room] light to {color}"
actions:
  - service: light.turn_on
    data:
      entity_id: light.living_room
      color_name: "{{ trigger.slots.color }}"
  - set_conversation_response: "Setting the light to {{ trigger.slots.color }}."
    

In your actions, use trigger.slots.slotname to get the captured value. You can use this in templates for actions, service calls, or custom responses.

Customizing the Assistant's Response

The set_conversation_response action lets you control what the voice assistant says back after your automation runs. You can use plain text or templates that include slot values, states, or other variables.


actions:
  - set_conversation_response: "Party mode activated! 🎉"
    

Combine this with slots for dynamic, natural conversations.


triggers:
  - trigger: conversation
    command:
      - "play {genre} music"
actions:
  - set_conversation_response: "Playing {{ trigger.slots.genre }} music!"
    

Trigger Variables Reference

Variable Description
trigger.platform Always conversation for this type of trigger.
trigger.sentence The full spoken phrase.
trigger.slots Object with slot names/values. Example: trigger.slots.genre for {genre}.
trigger.details Advanced info for each slot, including name, text, and value.
trigger.device_id ID of device that heard the command (if available).

Assist Satellite Actions

  • assist_satellite:announce:
    Makes a satellite device speak a message out loud in a specific room. The device will not listen for a reply after the announcement.
    • Targets: Satellite device, area, or entity for the announcement.
    • Message: Text-to-speech message to announce. (Required unless Media ID is set)
    • Media ID: (Optional) Play a media file (like an MP3) instead of TTS.
    • Preannounce: (Optional) Play a short notification sound before the message.
    • Preannounce media ID: (Optional) Custom preannounce sound/media file.
    
    actions:
      - assist_satellite:announce
        device_id: assist_satellite.home_assistant_voice_09969e_assist_satellite
        message: "Dinner is ready!"
        preannounce: true
    			
  • assist_satellite:start_conversation:
    Makes a satellite speak a prompt, then listen for a command or question. This is different from announce - the device waits for a spoken reply.
    • Targets: Satellite device, area, or entity to start the conversation.
    • Start message: The spoken prompt (e.g. "How can I help you?"). (Required if no Start media ID)
    • Start media ID: (Optional) Play a media file as the prompt instead of TTS.
    • Extra system prompt: (Optional) Add background info/instructions for the AI for this conversation.
    • Preannounce: (Optional) Play a notification sound before the prompt.
    • Preannounce media ID: (Optional) Custom preannounce sound.
    
    actions:
      - assist_satellite:start_conversation
        device_id: assist_satellite.home_assistant_voice_09969e_assist_satellite
        start_message: "How can I help you?"
        preannounce: true
    			

    Tip: If you do not provide either a Start message or Start media ID, this action will fail.

    In short: Use announce to just speak; use start_conversation if you want the device to listen for a response.

  • assist_satellite:ask_question New:
    Lets you create true back-and-forth conversations. The satellite asks a question, waits for a spoken answer, and saves the response to a variable for your automation. Optionally, you can define "expected answers" to speed up local recognition and even use slots (wildcards) in answers!
    • entity_id: The satellite device to ask the question.
    • question: What you want the device to ask (e.g. "What kind of music do you want to listen to?").
    • answers: (Optional but recommended) List of possible answers, each with an id and matching sentences. Sentences can include slots (e.g. {genre}).
    • preannounce, preannounce_media_id: (Optional) Play a sound before the question (see announce above).
    • response_variable: The variable name to store the answer in (e.g. answer).
    
    actions:
      - action: assist_satellite.ask_question
        data:
          entity_id: assist_satellite.living_room_voice_assistant
          preannounce: true   # optional
          preannounce_media_id: media-source://...   # optional
          question: "What kind of music do you want to listen to?"
          answers:
            - id: genre
              sentences:
                - "genre {genre}"
            - id: artist
              sentences:
                - "artist {artist}"
        response_variable: answer
      - choose:
          - conditions: "{{ answer.id == 'genre' }}"
            sequence:
              - action: music_assistant.play_media
                data:
                  media_id: "My {{ answer.slots.genre }} playlist"
                  media_type: playlist
                target:
                  entity_id: media_player.living_room_speakers
          - conditions: "{{ answer.id == 'artist' }}"
            sequence:
              - action: music_assistant.play_media
                data:
                  media_id: "{{ answer.slots.artist }}"
                  media_type: artist
                target:
                  entity_id: media_player.living_room_speakers
    			

    How it works: The answer the user gives is saved in the variable (here answer). Use {{ answer.id }} to know which answer matched, and {{ answer.slots.genre }} or {{ answer.slots.artist }} to access what was said. This enables "choose your own adventure" style voice flows, dynamic menus, confirmations, and more.

    Tip: For closed questions (e.g. yes/no), you can define lots of accepted phrases. The official blueprint handles 50 ways of saying yes or no!

  • conversation.process:
    Processes a sentence as if it were spoken to Assist, optionally as if it came from a specific device. This is useful for triggering Assist automations or responses from a script, automation, or another integration, without actually speaking.
    • sentence: The command or question to process.
    • device_id: (Optional) Treat the command as if heard by a specific Assist device.
    
    actions:
      - conversation.process:
          sentence: "turn off all lights"
          device_id: assist_satellite.home_assistant_voice_09969e_assist_satellite
    			

Quick Reference

  • Alternatives: (a|b) (choose one)
  • Optional: [word] (include or leave out)
  • Slots: {slot_name} (capture variable words)
  • trigger.sentence: The matched spoken phrase
  • trigger.slots: Captured slot values
  • trigger.details: Slot/wildcard details (advanced)
  • trigger.device_id: Device that heard the command (if available)