Block until config is retrieved when adding satellite entity to HA (#128685)

Block until config is retrieved
This commit is contained in:
Michael Hansen 2024-10-18 15:01:18 -05:00 committed by GitHub
parent 120e17fa1e
commit f21c8d895f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -247,15 +247,15 @@ class EsphomeAssistSatellite(
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):
# Will use media player for TTS/announcements
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:
"""Run when entity will be removed from hass."""
await super().async_will_remove_from_hass()

View File

@ -1448,6 +1448,7 @@ async def test_get_set_configuration(
states=[],
device_info={
"voice_assistant_feature_flags": VoiceAssistantFeature.VOICE_ASSISTANT
| VoiceAssistantFeature.ANNOUNCE
},
)
await hass.async_block_till_done()