Pass satellite id through assist pipeline (#151992)

This commit is contained in:
Artur Pragacz
2025-09-11 18:13:23 +02:00
committed by GitHub
parent d5132e8ea9
commit 1b99ffe61b
17 changed files with 90 additions and 8 deletions

View File

@@ -103,6 +103,7 @@ async def async_pipeline_from_audio_stream(
wake_word_settings: WakeWordSettings | None = None, wake_word_settings: WakeWordSettings | None = None,
audio_settings: AudioSettings | None = None, audio_settings: AudioSettings | None = None,
device_id: str | None = None, device_id: str | None = None,
satellite_id: str | None = None,
start_stage: PipelineStage = PipelineStage.STT, start_stage: PipelineStage = PipelineStage.STT,
end_stage: PipelineStage = PipelineStage.TTS, end_stage: PipelineStage = PipelineStage.TTS,
conversation_extra_system_prompt: str | None = None, conversation_extra_system_prompt: str | None = None,
@@ -115,6 +116,7 @@ async def async_pipeline_from_audio_stream(
pipeline_input = PipelineInput( pipeline_input = PipelineInput(
session=session, session=session,
device_id=device_id, device_id=device_id,
satellite_id=satellite_id,
stt_metadata=stt_metadata, stt_metadata=stt_metadata,
stt_stream=stt_stream, stt_stream=stt_stream,
wake_word_phrase=wake_word_phrase, wake_word_phrase=wake_word_phrase,

View File

@@ -583,6 +583,9 @@ class PipelineRun:
_device_id: str | None = None _device_id: str | None = None
"""Optional device id set during run start.""" """Optional device id set during run start."""
_satellite_id: str | None = None
"""Optional satellite id set during run start."""
_conversation_data: PipelineConversationData | None = None _conversation_data: PipelineConversationData | None = None
"""Data tied to the conversation ID.""" """Data tied to the conversation ID."""
@@ -636,9 +639,12 @@ class PipelineRun:
return return
pipeline_data.pipeline_debug[self.pipeline.id][self.id].events.append(event) pipeline_data.pipeline_debug[self.pipeline.id][self.id].events.append(event)
def start(self, conversation_id: str, device_id: str | None) -> None: def start(
self, conversation_id: str, device_id: str | None, satellite_id: str | None
) -> None:
"""Emit run start event.""" """Emit run start event."""
self._device_id = device_id self._device_id = device_id
self._satellite_id = satellite_id
self._start_debug_recording_thread() self._start_debug_recording_thread()
data: dict[str, Any] = { data: dict[str, Any] = {
@@ -646,6 +652,8 @@ class PipelineRun:
"language": self.language, "language": self.language,
"conversation_id": conversation_id, "conversation_id": conversation_id,
} }
if satellite_id is not None:
data["satellite_id"] = satellite_id
if self.runner_data is not None: if self.runner_data is not None:
data["runner_data"] = self.runner_data data["runner_data"] = self.runner_data
if self.tts_stream: if self.tts_stream:
@@ -1057,7 +1065,6 @@ class PipelineRun:
self, self,
intent_input: str, intent_input: str,
conversation_id: str, conversation_id: str,
device_id: str | None,
conversation_extra_system_prompt: str | None, conversation_extra_system_prompt: str | None,
) -> str: ) -> str:
"""Run intent recognition portion of pipeline. Returns text to speak.""" """Run intent recognition portion of pipeline. Returns text to speak."""
@@ -1088,7 +1095,8 @@ class PipelineRun:
"language": input_language, "language": input_language,
"intent_input": intent_input, "intent_input": intent_input,
"conversation_id": conversation_id, "conversation_id": conversation_id,
"device_id": device_id, "device_id": self._device_id,
"satellite_id": self._satellite_id,
"prefer_local_intents": self.pipeline.prefer_local_intents, "prefer_local_intents": self.pipeline.prefer_local_intents,
}, },
) )
@@ -1099,7 +1107,8 @@ class PipelineRun:
text=intent_input, text=intent_input,
context=self.context, context=self.context,
conversation_id=conversation_id, conversation_id=conversation_id,
device_id=device_id, device_id=self._device_id,
satellite_id=self._satellite_id,
language=input_language, language=input_language,
agent_id=self.intent_agent.id, agent_id=self.intent_agent.id,
extra_system_prompt=conversation_extra_system_prompt, extra_system_prompt=conversation_extra_system_prompt,
@@ -1269,6 +1278,7 @@ class PipelineRun:
text=user_input.text, text=user_input.text,
conversation_id=user_input.conversation_id, conversation_id=user_input.conversation_id,
device_id=user_input.device_id, device_id=user_input.device_id,
satellite_id=user_input.satellite_id,
context=user_input.context, context=user_input.context,
language=user_input.language, language=user_input.language,
agent_id=user_input.agent_id, agent_id=user_input.agent_id,
@@ -1567,10 +1577,15 @@ class PipelineInput:
device_id: str | None = None device_id: str | None = None
"""Identifier of the device that is processing the input/output of the pipeline.""" """Identifier of the device that is processing the input/output of the pipeline."""
satellite_id: str | None = None
"""Identifier of the satellite that is processing the input/output of the pipeline."""
async def execute(self) -> None: async def execute(self) -> None:
"""Run pipeline.""" """Run pipeline."""
self.run.start( self.run.start(
conversation_id=self.session.conversation_id, device_id=self.device_id conversation_id=self.session.conversation_id,
device_id=self.device_id,
satellite_id=self.satellite_id,
) )
current_stage: PipelineStage | None = self.run.start_stage current_stage: PipelineStage | None = self.run.start_stage
stt_audio_buffer: list[EnhancedAudioChunk] = [] stt_audio_buffer: list[EnhancedAudioChunk] = []
@@ -1656,7 +1671,6 @@ class PipelineInput:
tts_input = await self.run.recognize_intent( tts_input = await self.run.recognize_intent(
intent_input, intent_input,
self.session.conversation_id, self.session.conversation_id,
self.device_id,
self.conversation_extra_system_prompt, self.conversation_extra_system_prompt,
) )
if tts_input.strip(): if tts_input.strip():

View File

@@ -522,6 +522,7 @@ class AssistSatelliteEntity(entity.Entity):
pipeline_id=self._resolve_pipeline(), pipeline_id=self._resolve_pipeline(),
conversation_id=session.conversation_id, conversation_id=session.conversation_id,
device_id=device_id, device_id=device_id,
satellite_id=self.entity_id,
tts_audio_output=self.tts_options, tts_audio_output=self.tts_options,
wake_word_phrase=wake_word_phrase, wake_word_phrase=wake_word_phrase,
audio_settings=AudioSettings( audio_settings=AudioSettings(

View File

@@ -71,6 +71,7 @@ async def async_converse(
language: str | None = None, language: str | None = None,
agent_id: str | None = None, agent_id: str | None = None,
device_id: str | None = None, device_id: str | None = None,
satellite_id: str | None = None,
extra_system_prompt: str | None = None, extra_system_prompt: str | None = None,
) -> ConversationResult: ) -> ConversationResult:
"""Process text and get intent.""" """Process text and get intent."""
@@ -97,6 +98,7 @@ async def async_converse(
context=context, context=context,
conversation_id=conversation_id, conversation_id=conversation_id,
device_id=device_id, device_id=device_id,
satellite_id=satellite_id,
language=language, language=language,
agent_id=agent_id, agent_id=agent_id,
extra_system_prompt=extra_system_prompt, extra_system_prompt=extra_system_prompt,

View File

@@ -470,6 +470,7 @@ class DefaultAgent(ConversationEntity):
language, language,
assistant=DOMAIN, assistant=DOMAIN,
device_id=user_input.device_id, device_id=user_input.device_id,
satellite_id=user_input.satellite_id,
conversation_agent_id=user_input.agent_id, conversation_agent_id=user_input.agent_id,
) )
except intent.MatchFailedError as match_error: except intent.MatchFailedError as match_error:

View File

@@ -201,6 +201,7 @@ async def websocket_hass_agent_debug(
context=connection.context(msg), context=connection.context(msg),
conversation_id=None, conversation_id=None,
device_id=msg.get("device_id"), device_id=msg.get("device_id"),
satellite_id=None,
language=msg.get("language", hass.config.language), language=msg.get("language", hass.config.language),
agent_id=agent.entity_id, agent_id=agent.entity_id,
) )

View File

@@ -37,6 +37,9 @@ class ConversationInput:
device_id: str | None device_id: str | None
"""Unique identifier for the device.""" """Unique identifier for the device."""
satellite_id: str | None
"""Unique identifier for the satellite."""
language: str language: str
"""Language of the request.""" """Language of the request."""
@@ -53,6 +56,7 @@ class ConversationInput:
"context": self.context.as_dict(), "context": self.context.as_dict(),
"conversation_id": self.conversation_id, "conversation_id": self.conversation_id,
"device_id": self.device_id, "device_id": self.device_id,
"satellite_id": self.satellite_id,
"language": self.language, "language": self.language,
"agent_id": self.agent_id, "agent_id": self.agent_id,
"extra_system_prompt": self.extra_system_prompt, "extra_system_prompt": self.extra_system_prompt,

View File

@@ -100,6 +100,7 @@ async def async_attach_trigger(
entity_name: entity["value"] for entity_name, entity in details.items() entity_name: entity["value"] for entity_name, entity in details.items()
}, },
"device_id": user_input.device_id, "device_id": user_input.device_id,
"satellite_id": user_input.satellite_id,
"user_input": user_input.as_dict(), "user_input": user_input.as_dict(),
} }

View File

@@ -114,6 +114,7 @@ async def async_handle(
language: str | None = None, language: str | None = None,
assistant: str | None = None, assistant: str | None = None,
device_id: str | None = None, device_id: str | None = None,
satellite_id: str | None = None,
conversation_agent_id: str | None = None, conversation_agent_id: str | None = None,
) -> IntentResponse: ) -> IntentResponse:
"""Handle an intent.""" """Handle an intent."""
@@ -138,6 +139,7 @@ async def async_handle(
language=language, language=language,
assistant=assistant, assistant=assistant,
device_id=device_id, device_id=device_id,
satellite_id=satellite_id,
conversation_agent_id=conversation_agent_id, conversation_agent_id=conversation_agent_id,
) )
@@ -1276,6 +1278,7 @@ class Intent:
"intent_type", "intent_type",
"language", "language",
"platform", "platform",
"satellite_id",
"slots", "slots",
"text_input", "text_input",
] ]
@@ -1291,6 +1294,7 @@ class Intent:
language: str, language: str,
assistant: str | None = None, assistant: str | None = None,
device_id: str | None = None, device_id: str | None = None,
satellite_id: str | None = None,
conversation_agent_id: str | None = None, conversation_agent_id: str | None = None,
) -> None: ) -> None:
"""Initialize an intent.""" """Initialize an intent."""
@@ -1303,6 +1307,7 @@ class Intent:
self.language = language self.language = language
self.assistant = assistant self.assistant = assistant
self.device_id = device_id self.device_id = device_id
self.satellite_id = satellite_id
self.conversation_agent_id = conversation_agent_id self.conversation_agent_id = conversation_agent_id
@callback @callback

View File

@@ -45,6 +45,7 @@
'intent_input': 'test transcript', 'intent_input': 'test transcript',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}), }),
'type': <PipelineEventType.INTENT_START: 'intent-start'>, 'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}), }),
@@ -145,6 +146,7 @@
'intent_input': 'test transcript', 'intent_input': 'test transcript',
'language': 'en-US', 'language': 'en-US',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}), }),
'type': <PipelineEventType.INTENT_START: 'intent-start'>, 'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}), }),
@@ -245,6 +247,7 @@
'intent_input': 'test transcript', 'intent_input': 'test transcript',
'language': 'en-US', 'language': 'en-US',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}), }),
'type': <PipelineEventType.INTENT_START: 'intent-start'>, 'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}), }),
@@ -369,6 +372,7 @@
'intent_input': 'test transcript', 'intent_input': 'test transcript',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}), }),
'type': <PipelineEventType.INTENT_START: 'intent-start'>, 'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}), }),

View File

@@ -23,6 +23,7 @@
'intent_input': 'Set a timer', 'intent_input': 'Set a timer',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}), }),
'type': <PipelineEventType.INTENT_START: 'intent-start'>, 'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}), }),
@@ -178,6 +179,7 @@
'intent_input': 'Set a timer', 'intent_input': 'Set a timer',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}), }),
'type': <PipelineEventType.INTENT_START: 'intent-start'>, 'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}), }),
@@ -411,6 +413,7 @@
'intent_input': 'Set a timer', 'intent_input': 'Set a timer',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}), }),
'type': <PipelineEventType.INTENT_START: 'intent-start'>, 'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}), }),
@@ -634,6 +637,7 @@
'intent_input': 'test input', 'intent_input': 'test input',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}), }),
'type': <PipelineEventType.INTENT_START: 'intent-start'>, 'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}), }),
@@ -687,6 +691,7 @@
'intent_input': 'test input', 'intent_input': 'test input',
'language': 'en-US', 'language': 'en-US',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}), }),
'type': <PipelineEventType.INTENT_START: 'intent-start'>, 'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}), }),
@@ -740,6 +745,7 @@
'intent_input': 'test input', 'intent_input': 'test input',
'language': 'en-us', 'language': 'en-us',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}), }),
'type': <PipelineEventType.INTENT_START: 'intent-start'>, 'type': <PipelineEventType.INTENT_START: 'intent-start'>,
}), }),

View File

@@ -44,6 +44,7 @@
'intent_input': 'test transcript', 'intent_input': 'test transcript',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}) })
# --- # ---
# name: test_audio_pipeline.4 # name: test_audio_pipeline.4
@@ -136,6 +137,7 @@
'intent_input': 'test transcript', 'intent_input': 'test transcript',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}) })
# --- # ---
# name: test_audio_pipeline_debug.4 # name: test_audio_pipeline_debug.4
@@ -240,6 +242,7 @@
'intent_input': 'test transcript', 'intent_input': 'test transcript',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}) })
# --- # ---
# name: test_audio_pipeline_with_enhancements.4 # name: test_audio_pipeline_with_enhancements.4
@@ -354,6 +357,7 @@
'intent_input': 'test transcript', 'intent_input': 'test transcript',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}) })
# --- # ---
# name: test_audio_pipeline_with_wake_word_no_timeout.6 # name: test_audio_pipeline_with_wake_word_no_timeout.6
@@ -575,6 +579,7 @@
'intent_input': 'Are the lights on?', 'intent_input': 'Are the lights on?',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}) })
# --- # ---
# name: test_intent_failed.2 # name: test_intent_failed.2
@@ -599,6 +604,7 @@
'intent_input': 'Are the lights on?', 'intent_input': 'Are the lights on?',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}) })
# --- # ---
# name: test_intent_timeout.2 # name: test_intent_timeout.2
@@ -635,6 +641,7 @@
'intent_input': 'never mind', 'intent_input': 'never mind',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}) })
# --- # ---
# name: test_pipeline_empty_tts_output.2 # name: test_pipeline_empty_tts_output.2
@@ -785,6 +792,7 @@
'intent_input': 'Are the lights on?', 'intent_input': 'Are the lights on?',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}) })
# --- # ---
# name: test_text_only_pipeline[extra_msg0].2 # name: test_text_only_pipeline[extra_msg0].2
@@ -833,6 +841,7 @@
'intent_input': 'Are the lights on?', 'intent_input': 'Are the lights on?',
'language': 'en', 'language': 'en',
'prefer_local_intents': False, 'prefer_local_intents': False,
'satellite_id': None,
}) })
# --- # ---
# name: test_text_only_pipeline[extra_msg1].2 # name: test_text_only_pipeline[extra_msg1].2

View File

@@ -1707,6 +1707,7 @@ async def test_chat_log_tts_streaming(
language: str | None = None, language: str | None = None,
agent_id: str | None = None, agent_id: str | None = None,
device_id: str | None = None, device_id: str | None = None,
satellite_id: str | None = None,
extra_system_prompt: str | None = None, extra_system_prompt: str | None = None,
): ):
"""Mock converse.""" """Mock converse."""
@@ -1715,6 +1716,7 @@ async def test_chat_log_tts_streaming(
context=context, context=context,
conversation_id=conversation_id, conversation_id=conversation_id,
device_id=device_id, device_id=device_id,
satellite_id=satellite_id,
language=language, language=language,
agent_id=agent_id, agent_id=agent_id,
extra_system_prompt=extra_system_prompt, extra_system_prompt=extra_system_prompt,

View File

@@ -43,6 +43,7 @@ def mock_conversation_input(hass: HomeAssistant) -> conversation.ConversationInp
conversation_id=None, conversation_id=None,
agent_id="mock-agent-id", agent_id="mock-agent-id",
device_id=None, device_id=None,
satellite_id=None,
language="en", language="en",
) )

View File

@@ -2534,6 +2534,7 @@ async def test_non_default_response(hass: HomeAssistant, init_components) -> Non
context=Context(), context=Context(),
conversation_id=None, conversation_id=None,
device_id=None, device_id=None,
satellite_id=None,
language=hass.config.language, language=hass.config.language,
agent_id=None, agent_id=None,
) )
@@ -2884,6 +2885,7 @@ async def test_intent_cache_exposed(hass: HomeAssistant) -> None:
context=Context(), context=Context(),
conversation_id=None, conversation_id=None,
device_id=None, device_id=None,
satellite_id=None,
language=hass.config.language, language=hass.config.language,
agent_id=None, agent_id=None,
) )
@@ -2923,6 +2925,7 @@ async def test_intent_cache_all_entities(hass: HomeAssistant) -> None:
context=Context(), context=Context(),
conversation_id=None, conversation_id=None,
device_id=None, device_id=None,
satellite_id=None,
language=hass.config.language, language=hass.config.language,
agent_id=None, agent_id=None,
) )
@@ -2958,6 +2961,7 @@ async def test_intent_cache_fuzzy(hass: HomeAssistant) -> None:
context=Context(), context=Context(),
conversation_id=None, conversation_id=None,
device_id=None, device_id=None,
satellite_id=None,
language=hass.config.language, language=hass.config.language,
agent_id=None, agent_id=None,
) )
@@ -3000,6 +3004,7 @@ async def test_entities_filtered_by_input(hass: HomeAssistant) -> None:
context=Context(), context=Context(),
conversation_id=None, conversation_id=None,
device_id=None, device_id=None,
satellite_id=None,
language=hass.config.language, language=hass.config.language,
agent_id=None, agent_id=None,
) )
@@ -3026,6 +3031,7 @@ async def test_entities_filtered_by_input(hass: HomeAssistant) -> None:
context=Context(), context=Context(),
conversation_id=None, conversation_id=None,
device_id=None, device_id=None,
satellite_id=None,
language=hass.config.language, language=hass.config.language,
agent_id=None, agent_id=None,
) )
@@ -3166,6 +3172,7 @@ async def test_handle_intents_with_response_errors(
context=Context(), context=Context(),
conversation_id=None, conversation_id=None,
device_id=None, device_id=None,
satellite_id=None,
language=hass.config.language, language=hass.config.language,
agent_id=None, agent_id=None,
) )
@@ -3203,6 +3210,7 @@ async def test_handle_intents_filters_results(
context=Context(), context=Context(),
conversation_id=None, conversation_id=None,
device_id=None, device_id=None,
satellite_id=None,
language=hass.config.language, language=hass.config.language,
agent_id=None, agent_id=None,
) )

View File

@@ -281,6 +281,7 @@ async def test_async_handle_sentence_triggers(
conversation_id=None, conversation_id=None,
agent_id=conversation.HOME_ASSISTANT_AGENT, agent_id=conversation.HOME_ASSISTANT_AGENT,
device_id=device_id, device_id=device_id,
satellite_id=None,
language=hass.config.language, language=hass.config.language,
), ),
) )
@@ -318,6 +319,7 @@ async def test_async_handle_intents(hass: HomeAssistant) -> None:
agent_id=conversation.HOME_ASSISTANT_AGENT, agent_id=conversation.HOME_ASSISTANT_AGENT,
conversation_id=None, conversation_id=None,
device_id=None, device_id=None,
satellite_id=None,
language=hass.config.language, language=hass.config.language,
), ),
) )
@@ -335,6 +337,7 @@ async def test_async_handle_intents(hass: HomeAssistant) -> None:
context=Context(), context=Context(),
conversation_id=None, conversation_id=None,
device_id=None, device_id=None,
satellite_id=None,
language=hass.config.language, language=hass.config.language,
), ),
) )

View File

@@ -50,6 +50,7 @@ async def test_if_fires_on_event(
"slots": "{{ trigger.slots }}", "slots": "{{ trigger.slots }}",
"details": "{{ trigger.details }}", "details": "{{ trigger.details }}",
"device_id": "{{ trigger.device_id }}", "device_id": "{{ trigger.device_id }}",
"satellite_id": "{{ trigger.satellite_id }}",
"user_input": "{{ trigger.user_input }}", "user_input": "{{ trigger.user_input }}",
} }
}, },
@@ -81,11 +82,13 @@ async def test_if_fires_on_event(
"slots": {}, "slots": {},
"details": {}, "details": {},
"device_id": None, "device_id": None,
"satellite_id": None,
"user_input": { "user_input": {
"agent_id": HOME_ASSISTANT_AGENT, "agent_id": HOME_ASSISTANT_AGENT,
"context": context.as_dict(), "context": context.as_dict(),
"conversation_id": None, "conversation_id": None,
"device_id": None, "device_id": None,
"satellite_id": None,
"language": "en", "language": "en",
"text": "Ha ha ha", "text": "Ha ha ha",
"extra_system_prompt": None, "extra_system_prompt": None,
@@ -185,6 +188,7 @@ async def test_response_same_sentence(
"slots": "{{ trigger.slots }}", "slots": "{{ trigger.slots }}",
"details": "{{ trigger.details }}", "details": "{{ trigger.details }}",
"device_id": "{{ trigger.device_id }}", "device_id": "{{ trigger.device_id }}",
"satellite_id": "{{ trigger.satellite_id }}",
"user_input": "{{ trigger.user_input }}", "user_input": "{{ trigger.user_input }}",
} }
}, },
@@ -230,11 +234,13 @@ async def test_response_same_sentence(
"slots": {}, "slots": {},
"details": {}, "details": {},
"device_id": None, "device_id": None,
"satellite_id": None,
"user_input": { "user_input": {
"agent_id": HOME_ASSISTANT_AGENT, "agent_id": HOME_ASSISTANT_AGENT,
"context": context.as_dict(), "context": context.as_dict(),
"conversation_id": None, "conversation_id": None,
"device_id": None, "device_id": None,
"satellite_id": None,
"language": "en", "language": "en",
"text": "test sentence", "text": "test sentence",
"extra_system_prompt": None, "extra_system_prompt": None,
@@ -376,6 +382,7 @@ async def test_same_trigger_multiple_sentences(
"slots": "{{ trigger.slots }}", "slots": "{{ trigger.slots }}",
"details": "{{ trigger.details }}", "details": "{{ trigger.details }}",
"device_id": "{{ trigger.device_id }}", "device_id": "{{ trigger.device_id }}",
"satellite_id": "{{ trigger.satellite_id }}",
"user_input": "{{ trigger.user_input }}", "user_input": "{{ trigger.user_input }}",
} }
}, },
@@ -408,11 +415,13 @@ async def test_same_trigger_multiple_sentences(
"slots": {}, "slots": {},
"details": {}, "details": {},
"device_id": None, "device_id": None,
"satellite_id": None,
"user_input": { "user_input": {
"agent_id": HOME_ASSISTANT_AGENT, "agent_id": HOME_ASSISTANT_AGENT,
"context": context.as_dict(), "context": context.as_dict(),
"conversation_id": None, "conversation_id": None,
"device_id": None, "device_id": None,
"satellite_id": None,
"language": "en", "language": "en",
"text": "hello", "text": "hello",
"extra_system_prompt": None, "extra_system_prompt": None,
@@ -449,6 +458,7 @@ async def test_same_sentence_multiple_triggers(
"slots": "{{ trigger.slots }}", "slots": "{{ trigger.slots }}",
"details": "{{ trigger.details }}", "details": "{{ trigger.details }}",
"device_id": "{{ trigger.device_id }}", "device_id": "{{ trigger.device_id }}",
"satellite_id": "{{ trigger.satellite_id }}",
"user_input": "{{ trigger.user_input }}", "user_input": "{{ trigger.user_input }}",
} }
}, },
@@ -474,6 +484,7 @@ async def test_same_sentence_multiple_triggers(
"slots": "{{ trigger.slots }}", "slots": "{{ trigger.slots }}",
"details": "{{ trigger.details }}", "details": "{{ trigger.details }}",
"device_id": "{{ trigger.device_id }}", "device_id": "{{ trigger.device_id }}",
"satellite_id": "{{ trigger.satellite_id }}",
"user_input": "{{ trigger.user_input }}", "user_input": "{{ trigger.user_input }}",
} }
}, },
@@ -590,6 +601,7 @@ async def test_wildcards(hass: HomeAssistant, service_calls: list[ServiceCall])
"slots": "{{ trigger.slots }}", "slots": "{{ trigger.slots }}",
"details": "{{ trigger.details }}", "details": "{{ trigger.details }}",
"device_id": "{{ trigger.device_id }}", "device_id": "{{ trigger.device_id }}",
"satellite_id": "{{ trigger.satellite_id }}",
"user_input": "{{ trigger.user_input }}", "user_input": "{{ trigger.user_input }}",
} }
}, },
@@ -636,11 +648,13 @@ async def test_wildcards(hass: HomeAssistant, service_calls: list[ServiceCall])
}, },
}, },
"device_id": None, "device_id": None,
"satellite_id": None,
"user_input": { "user_input": {
"agent_id": HOME_ASSISTANT_AGENT, "agent_id": HOME_ASSISTANT_AGENT,
"context": context.as_dict(), "context": context.as_dict(),
"conversation_id": None, "conversation_id": None,
"device_id": None, "device_id": None,
"satellite_id": None,
"language": "en", "language": "en",
"text": "play the white album by the beatles", "text": "play the white album by the beatles",
"extra_system_prompt": None, "extra_system_prompt": None,
@@ -660,7 +674,7 @@ async def test_trigger_with_device_id(hass: HomeAssistant) -> None:
"command": ["test sentence"], "command": ["test sentence"],
}, },
"action": { "action": {
"set_conversation_response": "{{ trigger.device_id }}", "set_conversation_response": "{{ trigger.device_id }} - {{ trigger.satellite_id }}",
}, },
} }
}, },
@@ -675,8 +689,12 @@ async def test_trigger_with_device_id(hass: HomeAssistant) -> None:
context=Context(), context=Context(),
conversation_id=None, conversation_id=None,
device_id="my_device", device_id="my_device",
satellite_id="assist_satellite.my_satellite",
language=hass.config.language, language=hass.config.language,
agent_id=None, agent_id=None,
) )
) )
assert result.response.speech["plain"]["speech"] == "my_device" assert (
result.response.speech["plain"]["speech"]
== "my_device - assist_satellite.my_satellite"
)