From 492ef67d0227082331b42b4b0f2a28f06d03f136 Mon Sep 17 00:00:00 2001 From: tronikos Date: Sun, 12 May 2024 19:19:20 -0700 Subject: [PATCH] Call Google Assistant SDK service using async_add_executor_job (#117325) --- homeassistant/components/google_assistant_sdk/__init__.py | 4 +++- homeassistant/components/google_assistant_sdk/helpers.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/google_assistant_sdk/__init__.py b/homeassistant/components/google_assistant_sdk/__init__.py index 7d8653b509d..52950a82b93 100644 --- a/homeassistant/components/google_assistant_sdk/__init__.py +++ b/homeassistant/components/google_assistant_sdk/__init__.py @@ -169,7 +169,9 @@ class GoogleAssistantConversationAgent(conversation.AbstractConversationAgent): self.language = user_input.language self.assistant = TextAssistant(credentials, self.language) - resp = self.assistant.assist(user_input.text) + resp = await self.hass.async_add_executor_job( + self.assistant.assist, user_input.text + ) text_response = resp[0] or "" intent_response = intent.IntentResponse(language=user_input.language) diff --git a/homeassistant/components/google_assistant_sdk/helpers.py b/homeassistant/components/google_assistant_sdk/helpers.py index ccd0fe765ac..b6b13f92fcf 100644 --- a/homeassistant/components/google_assistant_sdk/helpers.py +++ b/homeassistant/components/google_assistant_sdk/helpers.py @@ -79,7 +79,7 @@ async def async_send_text_commands( ) as assistant: command_response_list = [] for command in commands: - resp = assistant.assist(command) + resp = await hass.async_add_executor_job(assistant.assist, command) text_response = resp[0] _LOGGER.debug("command: %s\nresponse: %s", command, text_response) audio_response = resp[2]