Skip to content

Commit adf7251

Browse files
synesthesiamfrenckCopilot
authored
Document Assist satellite ask_question (#39733)
Co-authored-by: Franck Nijhof <git@frenck.dev> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 8f49732 commit adf7251

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed

source/_integrations/assist_satellite.markdown

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,131 @@ target:
112112
extra_system_prompt: "The user has left the lights on in the living room and is being asked if they'd like to turn them off."
113113
preannounce: false # chime disabled
114114
```
115+
116+
### Action `assist_satellite.ask_question`
117+
118+
The {% my developer_call_service service="assist_satellite.ask_question" %} action asks a question on the satellite, listens for a response, and matches it against a predefined list of possible answers. Information about the matched answer is stored in a `response_variable` so the appropriate next steps can be taken in your automation or script.
119+
120+
The question may be provided as text or a media id. If text is used, it will first be converted to a media id using the [text-to-speech](/integrations/tts) system of the satellite's configured [pipeline](/voice_control/voice_remote_local_assistant/).
121+
122+
Audio from the user's response is transcribed using the [speech-to-text](/integrations/stt) system of the satellite's configured [pipeline](/voice_control/voice_remote_local_assistant/).
123+
124+
The `answers` are given as a list of objects with the following structure:
125+
126+
- `id` - unique id of the answer
127+
- `sentences` - list of [sentence templates](https://developers.home-assistant.io/docs/voice/intent-recognition/template-sentence-syntax/#sentence-templates-syntax)
128+
129+
Sentence templates may contain wildcard `{slots}` that will be stored in the answer's `slots` field. For example, `play {album} by {artist}` will match "play the white album by the beatles" with "white album" stored in `slots.album` and "the beatles" in `slots.artist`.
130+
131+
The matched answer will be stored in a `response_variable` with the structure:
132+
133+
- `id` - unique id of the matching answer (or `None` if no match)
134+
- `sentence` - response text from user
135+
- `slots` - values of wildcard `{slots}` from matching answer
136+
137+
{% my developer_call_service badge service="assist_satellite.ask_question" %}
138+
139+
Examples in YAML:
140+
141+
{% raw %}
142+
143+
```yaml
144+
actions:
145+
- action: assist_satellite.ask_question
146+
data:
147+
question: "Welcome home! What kind of music would you like to listen to?"
148+
entity_id: assist_satellite.my_entity
149+
answers:
150+
- id: jazz
151+
sentences:
152+
- "[some] jazz [music] [please]"
153+
- "something spicy"
154+
- id: rock
155+
sentences:
156+
- "[some] rock [music] [please]"
157+
- "something with a beat"
158+
- id: nothing
159+
sentences:
160+
- "nothing [for now] [please]"
161+
- "nevermind"
162+
- "cancel"
163+
response_variable: answer
164+
- choose:
165+
- conditions:
166+
- condition: template
167+
value_template: "{{ answer.id == 'jazz' }}"
168+
sequence:
169+
- action: play_jazz_action
170+
- conditions:
171+
- condition: template
172+
value_template: "{{ answer.id == 'rock' }}"
173+
sequence:
174+
- action: play_rock_action
175+
default:
176+
- action: assist_satellite.announce
177+
data:
178+
message: "OK, maybe some other time."
179+
target:
180+
entity_id: assist_satellite.my_entity
181+
```
182+
183+
{%endraw %}
184+
185+
186+
Instead of text, the question can also be a media ID:
187+
188+
```yaml
189+
action: assist_satellite.ask_question
190+
data:
191+
entity_id: assist_satellite.my_entity
192+
question_media_id: ITEM_ID
193+
answers: ANSWERS
194+
response_variable: answer
195+
```
196+
197+
A chime is automatically played before the question. You can override this with your own sound by setting `preannounce_media_id`, or disable the chime entirely by setting `preannounce` to `false`.
198+
199+
Examples in YAML:
200+
201+
```yaml
202+
action: assist_satellite.ask_question
203+
data:
204+
entity_id: assist_satellite.my_entity
205+
preannounce_media_id: ITEM_ID # custom chime
206+
question: QUESTION
207+
answers: ANSWERS
208+
response_variable: answer
209+
```
210+
211+
```yaml
212+
action: assist_satellite.ask_question
213+
data:
214+
entity_id: assist_satellite.my_entity
215+
preannounce: false # chime disabled
216+
question: QUESTION
217+
answers: ANSWERS
218+
response_variable: answer
219+
```
220+
221+
If `answers` is omitted, the response text from the user will be available in the `sentence` text of the `response_variable`.
222+
223+
Examples in YAML:
224+
225+
{% raw %}
226+
227+
```yaml
228+
actions:
229+
- action: assist_satellite.ask_question
230+
data:
231+
question: "Say something"
232+
entity_id: assist_satellite.my_entity
233+
response_variable: answer
234+
- action: assist_satellite.announce
235+
data:
236+
message: "You said {{ answer.sentence }}"
237+
target:
238+
entity_id: assist_satellite.my_entity
239+
```
240+
241+
{% endraw %}
242+

0 commit comments

Comments
 (0)