From d8ebdda7148cd6b293c502e113a69ae943c76495 Mon Sep 17 00:00:00 2001 From: Phil Bruckner Date: Mon, 4 May 2020 14:58:16 -0500 Subject: [PATCH] Move life360 I/O out of event loop in config flow (#35193) --- homeassistant/components/life360/config_flow.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/life360/config_flow.py b/homeassistant/components/life360/config_flow.py index e0ea645b197..e24bb3639b6 100644 --- a/homeassistant/components/life360/config_flow.py +++ b/homeassistant/components/life360/config_flow.py @@ -47,8 +47,8 @@ class Life360ConfigFlow(config_entries.ConfigFlow): try: # pylint: disable=no-value-for-parameter vol.Email()(self._username) - authorization = self._api.get_authorization( - self._username, self._password + authorization = await self.hass.async_add_executor_job( + self._api.get_authorization, self._username, self._password ) except vol.Invalid: errors[CONF_USERNAME] = "invalid_username" @@ -89,7 +89,9 @@ class Life360ConfigFlow(config_entries.ConfigFlow): username = user_input[CONF_USERNAME] password = user_input[CONF_PASSWORD] try: - authorization = self._api.get_authorization(username, password) + authorization = await self.hass.async_add_executor_job( + self._api.get_authorization, username, password + ) except LoginError: _LOGGER.error("Invalid credentials for %s", username) return self.async_abort(reason="invalid_credentials")