mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Block until config is retrieved when adding satellite entity to HA (#128685)
Block until config is retrieved
This commit is contained in:
parent
120e17fa1e
commit
f21c8d895f
@ -247,15 +247,15 @@ class EsphomeAssistSatellite(
|
|||||||
assist_satellite.AssistSatelliteEntityFeature.ANNOUNCE
|
assist_satellite.AssistSatelliteEntityFeature.ANNOUNCE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Block until config is retrieved.
|
||||||
|
# If the device supports announcements, it will return a config.
|
||||||
|
_LOGGER.debug("Waiting for satellite configuration")
|
||||||
|
await self._update_satellite_config()
|
||||||
|
|
||||||
if not (feature_flags & VoiceAssistantFeature.SPEAKER):
|
if not (feature_flags & VoiceAssistantFeature.SPEAKER):
|
||||||
# Will use media player for TTS/announcements
|
# Will use media player for TTS/announcements
|
||||||
self._update_tts_format()
|
self._update_tts_format()
|
||||||
|
|
||||||
# Fetch latest config in the background
|
|
||||||
self.config_entry.async_create_background_task(
|
|
||||||
self.hass, self._update_satellite_config(), "esphome_voice_assistant_config"
|
|
||||||
)
|
|
||||||
|
|
||||||
async def async_will_remove_from_hass(self) -> None:
|
async def async_will_remove_from_hass(self) -> None:
|
||||||
"""Run when entity will be removed from hass."""
|
"""Run when entity will be removed from hass."""
|
||||||
await super().async_will_remove_from_hass()
|
await super().async_will_remove_from_hass()
|
||||||
|
@ -1448,6 +1448,7 @@ async def test_get_set_configuration(
|
|||||||
states=[],
|
states=[],
|
||||||
device_info={
|
device_info={
|
||||||
"voice_assistant_feature_flags": VoiceAssistantFeature.VOICE_ASSISTANT
|
"voice_assistant_feature_flags": VoiceAssistantFeature.VOICE_ASSISTANT
|
||||||
|
| VoiceAssistantFeature.ANNOUNCE
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user