diff --git a/custom_components/chime_tts/__init__.py b/custom_components/chime_tts/__init__.py index 41e6bd6f..9fa708c3 100644 --- a/custom_components/chime_tts/__init__.py +++ b/custom_components/chime_tts/__init__.py @@ -74,6 +74,7 @@ QUEUE_TIMEOUT_KEY, QUEUE_TIMEOUT_DEFAULT, TTS_TIMEOUT_KEY, + TTS_TIMEOUT_DEFAULT, SPOTIFY_PLATFORM, TTS_PLATFORM_KEY, DEFAULT_LANGUAGE_KEY, @@ -410,7 +411,7 @@ async def async_update_configuration(config_entry: ConfigEntry, hass: HomeAssist _data[TTS_PLATFORM_KEY] = options.get(TTS_PLATFORM_KEY, "") # TTS timeout - _data[TTS_TIMEOUT_KEY] = options.get(TTS_TIMEOUT_KEY, None) + _data[TTS_TIMEOUT_KEY] = options.get(TTS_TIMEOUT_KEY, TTS_TIMEOUT_DEFAULT) # Default language _data[DEFAULT_LANGUAGE_KEY] = options.get(DEFAULT_LANGUAGE_KEY, None) @@ -605,8 +606,7 @@ async def async_request_tts_audio( audio_data = None media_source_id = None try: - timeout = _data.get(TTS_TIMEOUT_KEY, None) - _LOGGER.debug("```Generating TTS audio with a timeout of %ss", str(timeout or 0)) + timeout = _data.get(TTS_TIMEOUT_KEY, TTS_TIMEOUT_DEFAULT) media_source_id = await asyncio.wait_for( asyncio.to_thread( tts.media_source.generate_media_source_id, diff --git a/custom_components/chime_tts/config_flow.py b/custom_components/chime_tts/config_flow.py index c79b5ac1..b18a09c7 100755 --- a/custom_components/chime_tts/config_flow.py +++ b/custom_components/chime_tts/config_flow.py @@ -13,6 +13,7 @@ QUEUE_TIMEOUT_KEY, QUEUE_TIMEOUT_DEFAULT, TTS_TIMEOUT_KEY, + TTS_TIMEOUT_DEFAULT, TTS_PLATFORM_KEY, DEFAULT_LANGUAGE_KEY, DEFAULT_VOICE_KEY, @@ -100,7 +101,7 @@ async def async_step_init(self, user_input): self.data = { QUEUE_TIMEOUT_KEY: self.get_data_key_value(QUEUE_TIMEOUT_KEY, user_input, QUEUE_TIMEOUT_DEFAULT), - TTS_TIMEOUT_KEY: self.get_data_key_value(TTS_TIMEOUT_KEY, user_input, ""), + TTS_TIMEOUT_KEY: self.get_data_key_value(TTS_TIMEOUT_KEY, user_input, TTS_TIMEOUT_DEFAULT), TTS_PLATFORM_KEY: self.get_data_key_value(TTS_PLATFORM_KEY, user_input, ""), DEFAULT_LANGUAGE_KEY: self.get_data_key_value(DEFAULT_LANGUAGE_KEY, user_input, ""), DEFAULT_VOICE_KEY: self.get_data_key_value(DEFAULT_VOICE_KEY, user_input, ""), diff --git a/custom_components/chime_tts/const.py b/custom_components/chime_tts/const.py index 2b6666b3..6c9082cc 100755 --- a/custom_components/chime_tts/const.py +++ b/custom_components/chime_tts/const.py @@ -100,6 +100,7 @@ QUEUE_TIMEOUT_KEY = "queue_timeout" QUEUE_TIMEOUT_DEFAULT = 60 TTS_TIMEOUT_KEY = "tts_timeout" +TTS_TIMEOUT_DEFAULT = 30 MAX_CONCURRENT_TASKS = 10 MAX_TIMEOUT = 600 QUEUE_PROCESSOR_SLEEP_TIME = 0.2