Share how you are using the new "ask a question" functionality

Hi,

I thought it might be fun to just highlight to each other how we are using the new “ask a question” functionality. Just to inspire inspiration and creativity, since it’s a new feature.

I wrote a simple automation to ask my wife if she wants to run the Roborock vacuum, when she is leaving the house. I will eventually import and use the binary “yes/no” blueprint in the blog. But for now I just have it standalone for testing.

Matt

  - id: vacuum_voice_prompt
    alias: "[Appliances] Vacuum Voice Prompt"
    mode: single
    triggers:
      - trigger: state
        entity_id: lock.front_door_lock
        from: "locked"
        to: "unlocked"
    conditions:
      - condition: state
        entity_id: person.serena
        state: "home"
      - condition: state
        entity_id: input_boolean.babysitter
        state: "off"
      - condition: state
        entity_id: climate.persephone_climate
        state: "heat_cool"
      - condition: state
        entity_id: binary_sensor.persephone_located_at_home
        state: "on"
      - condition: state
        entity_id: vacuum.remi
        state: "docked"
    actions:
      - action: assist_satellite.ask_question
        data:
          entity_id: assist_satellite.voice_assist_satellite
          preannounce: true
          preannounce_media_id: media-source://media_source/mesa_media/chord.mp3
          question: >
            {{ [
              "Would you like me to run Remi?",
              "Would you like me to vacuum?",
              "Should I start Remi?",
              "Would you like me to ask Remi to start cleaning?",
              "Should Remi clean the house while you're gone?"
            ] | random }}
          answers:
            - id: "yes"
              sentences:
                - "Yes"
                - "Sure"
                - "Absolutely"
                - Go ahead
                - Please do
                - Yes please
                - Of course
                - That's fine
                - Do it
                - Yep
                - Yeah
                - Ok
                - Okay
            - id: "no"
              sentences:
                - "No"
                - "Nope"
                - "Not today"
                - "Don't"
                - "Please don't"
                - "No thank you"
                - "I don't think so"
                - "Not now"
                - "That's a no"
                - "I'd rather not"
                - "No way"
                - "Not really"
                - "Cancel that"
                - "Negative"
                - "Stop"
            - id: "everywhere"
              sentences:
                - "Everywhere"
                - "The whole house"
                - "The entire house"
        response_variable: answer
      - choose:
          - conditions: "{{ answer.id == 'yes' }}"
            sequence:
              - action: script.vacuum_main_areas
          - conditions: "{{ answer.id == 'everywhere' }}"
            sequence:
              - action: script.vacuum_everywhere

I made this amazing game:

2 Likes

Just started playing with it :slight_smile: btw; does this only follow Text To Speech or any sentence? Reason for asking is that natively my language is Norwegian and I can’t seem to get it to work with Norwegian (Text To Speech is currently not supporting Norwegian).

Sorry if this is a little long, but you asked… :smiley:

I have a sensor in my office chair that tracks when my fat butt sits down, so when I FIRST sit down each morning (I have a boolean that activates when the automation runs and then resets at 5 am each day), my office voice assistant asks if I would like to hear my daily briefing.

If I say “yes”, it will call a script that plays my daily briefing, pauses long enough for the briefing to finish, and then, using assist_satellite.ask_question, it will ask if there’s anything else I need.

If I say “yes” to that, using assist_satellite.start_conversation, it asks what it can do for me.

If I answer “no” to the first question about the briefing, it just tells me I can ask for it whenever I am ready, and then asks if there is anything else I need.

If I answer “no” to the second question, it exits gracefully and tells me let it know when it can help.

If anyone sees something that could be improved, please feel free to speak up. I am always open to constructive criticism.

Automation:

alias: First Sitdown
description: Automation for when I first sit down in my office chair each day
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.office_chair
    to: "on"
    from: "off"
conditions:
  - condition: state
    entity_id: input_boolean.first_sitdown
    state: "off"
actions:
  - action: input_boolean.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.first_sitdown
  - action: assist_satellite.ask_question
    metadata: {}
    data:
      question: Hello Glenn.  Would you like your daily briefing now?
      preannounce: true
      answers:
        - id: "yes"
          sentences:
            - Sure
            - Please
            - Yes [please]
            - Definitly
            - ok
        - id: "no"
          sentences:
            - No [thank you]
            - not now
      entity_id: assist_satellite.boom_box_satellite_assist_satellite
    response_variable: answer
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ answer.id == 'yes' }}"
        sequence:
          - action: script.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: script.office_briefing
          - delay:
              hours: 0
              minutes: 0
              seconds: 30
              milliseconds: 0
    default:
      - action: assist_satellite.announce
        metadata: {}
        data:
          message: Sounds good.  Just ask when you are ready for it.
          preannounce: false
        target:
          entity_id: assist_satellite.boom_box_satellite_assist_satellite
  - action: assist_satellite.ask_question
    metadata: {}
    data:
      question: Is there anything else I can do for you?
      preannounce: false
      entity_id: assist_satellite.boom_box_satellite_assist_satellite
      answers:
        - id: "yes"
          sentences:
            - yes [please]
        - id: "no"
          sentences:
            - no [thanks] [thank you]
            - not now
    target:
      entity_id: assist_satellite.boom_box_satellite_assist_satellite
    response_variable: answer2
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ answer2.id == 'yes' }}"
        sequence:
          - action: assist_satellite.start_conversation
            metadata: {}
            data:
              start_message: What can I do for you?
              preannounce: false
            target:
              entity_id: assist_satellite.boom_box_satellite_assist_satellite
    default:
      - action: assist_satellite.announce
        metadata: {}
        data:
          message: Just let me know when I can help.
          preannounce: true
        target:
          entity_id: assist_satellite.boom_box_satellite_assist_satellite
mode: single

Daily Briefing Script:

sequence:
  - variables:
      weather_entity: weather.pirateweather
      zone_entity: zone.home
      calendar_duration:
        hours: 18
      prompt: >-
        Please generate text for a notification that will be sent to the users
        smartphone with helpful information.


        You are a helpful personal agent that generates text for the user:

        - Your answers are helpful, friendly, warm, insightful and should not
        include emojis.  Also, your answer is intended to be converted to
        speech, so should be formatted in a manner to be spoken aloud.

        - Your answers are not technical, and do not include Home Assistant
        internal details such as entities in responses.


        - Your messages help the user prepare for their day, for example:
          - Making note of unusual weather for the location and time of year (but not mundane details like "0% chance of precipitation")
          - Tell me about my agenda for the day.  If there are no events scheduled for the day, assume my 
            day is open and adjust accordingly.  Do not make up events for my agenda.
          - Anything that may be special or unique, such as celebrating a birthday
          - If today is Sunday, include that the Trash bin needs to be filled.
          - If today is Wednesday, include that the Recycle and Lawn Waste bins need to be ready.
  - alias: Fetch Weather Forecast
    data:
      type: hourly
    target:
      entity_id:
        - "{{ weather_entity }}"
    response_variable: daily_forecast
    action: weather.get_forecasts
  - variables:
      forecast_entity: "{{ daily_forecast[weather_entity] }}"
      forecast: "{{ forecast_entity.forecast[0] }}"
  - alias: Fetch Calendar Agenda
    target:
      entity_id: |
        {% set calendars = 
          [
            "calendar.mom",
            "calendar.work",
            "calendar.family_calendar",
            "calendar.home"
          ]
        %} {% for calendar in calendars %}
          {{ calendar }}{%- if not loop.last %},
          {%- endif %}
        {% endfor %}
    data:
      start_date_time: "{{ today_at('1:00') }}"
      duration:
        hours: 24
    response_variable: agenda
    action: calendar.get_events
  - variables:
      events: |
        {% set pattern = '[a-zA-Z\d!@#$%&*-].*' %}
        {% for calendar in agenda %}      
          {% for event in agenda[calendar]["events"] %}
            {{ event.start }} - {{ event.end }} : {{ event.summary | regex_findall_index(pattern) }}|    
          {%- endfor %}         
        {%- endfor %}
  - alias: Conversation Agent Notification Text
    data:
      text: >-
        I am male. My name is Glenn. The time is {{ now() }}.  Only use 12-hour
        time format.

            {%- if weather_entity is defined %}

            {%- set temperature_unit = state_attr(weather_entity, 'temperature_unit')
            -%}

            Forecast: {{ forecast.condition }} ({{ forecast.temperature }}{{
            temperature_unit }}, {{ forecast.precipitation }}% precipitation)

            {%- endif %}


          Tell me my agenda for the day in chronological order.
                The following are my activities for the day: {{
                events }} (If no activities are listed above, assume my day is open and
                adjust accordingly; do not make stuff up for my agenda.) 

        {{ prompt }}
      agent_id: conversation.chatgpt
    response_variable: agent
    action: conversation.process
  - data:
      message: "{{ agent.response.speech.plain.speech }}"
      preannounce: false
    action: assist_satellite.announce
    target:
      entity_id: assist_satellite.boom_box_satellite_assist_satellite
alias: Office Briefing
description: ""
2 Likes

Just a though… If you called the script using script.office_briefing instead of script.turn_on, then the next action won’t occur until the script called has finished and you wouldn’t have to guess at how long it might take. You could then give it a comfortable 1 - 2 second pause to inhale before continuing.

WAITING FOR SCRIPT TO COMPLETE

1 Like

I think you’d still have to have a pause - a script completes in a fraction of a second.

Thank you!! That works great!!

1 Like

It actually waits until the script is finished saying what it needs to say before continuing on.

1 Like

Glad I could help.

@jackjourneyman the script will proccess in a fraction of a second, but the actions of the script will consume time. I use this quite frequently with voice so that the response is always timely.

2 Likes

@atomicpapa thanks so much for sharing! That’s such a creative use case!

Super nit but just FYI you have a typo in “definitely” in your answers.

Great example!

Fixed! Thanks for the heads up!

1 Like

Have any of you had success using the Script Blueprint that was in the 2025.7 release blog? I’m having trouble. I posted a comment in the release blog thread but haven’t had any bites.

I haven’t tried. What errors are you hitting?

I’ve got it here but basically I think we need to pass variables to the script from an automation but it’s not clear to me. When I try to pass data to the script it fails, when I don’t it fails…

@sparkydave if you feel like posting the YAML from your automation, I’m sure we can take a look and see if we can help!

The fields are voice_assistant and preannounce. While it’s a bit kludgy, you can see the blueprint more fleshed out if you open the script in the Script editor then click “Take Control” in the breadcrumbs menu.

Also, when using script.turn_on you should be using variables in data:

action: script.turn_on
target:
  entity_id: script.bedroom_roller_shutters_question
data:
  variables:
    voice_assistant: assist_satellite.home_assistant_voice
    preannounce: false

I know it’s only a screenshot, but it is above. The hard work is done by the script blueprint that came in this months HA release.

1 Like

Thanks, I’ll give this a test run. It’s disappointing that the team didn’t include these details with the Script Blueprint that was released.

EDIT: test run whilst away from home looks good, no error. I’ll test tonight. Thanks mate

1 Like

OMG I did not know this ability existed! This is super useful, thanks!

1 Like

I’m also having trouble to get this new action to work, I’ve tried the blueprint, and also a more basic script I built myself (shown below) and neither work.

I’ve selected the target assist satellite, entered what I want it to say, and nothing ever comes out of it. I do see the satellite go to “Responding” state and get stuck there though, so it’s trying to do something…

sequence:
  - action: assist_satellite.ask_question
    metadata: {}
    data:
      question: Turn the light off
      preannounce: true
      answers:
        - id: "yes"
          sentences:
            - "Yes"
            - Ok
            - Sure
            - Yeah
            - Yep
            - Yes please
        - id: "no"
          sentences:
            - "No"
            - Nope
            - No thanks
            - No way
            - F off
            - Nah
      entity_id: assist_satellite.kitchen_counter_esphome_assist_satellite
    response_variable: response
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ response.id == \"yes\" }}"
        sequence:
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: light.lounge_main
      - conditions:
          - condition: template
            value_template: "{{ response.id == \"no\" }}"
        sequence:
          - action: light.turn_off
            metadata: {}
            data: {}
            target:
              entity_id:
                - light.lounge_sofa_strip
alias: Confirm an action
description: ""