mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Move life360 I/O out of event loop in config flow (#35193)
This commit is contained in:
parent
8279efc164
commit
d8ebdda714
@ -47,8 +47,8 @@ class Life360ConfigFlow(config_entries.ConfigFlow):
|
|||||||
try:
|
try:
|
||||||
# pylint: disable=no-value-for-parameter
|
# pylint: disable=no-value-for-parameter
|
||||||
vol.Email()(self._username)
|
vol.Email()(self._username)
|
||||||
authorization = self._api.get_authorization(
|
authorization = await self.hass.async_add_executor_job(
|
||||||
self._username, self._password
|
self._api.get_authorization, self._username, self._password
|
||||||
)
|
)
|
||||||
except vol.Invalid:
|
except vol.Invalid:
|
||||||
errors[CONF_USERNAME] = "invalid_username"
|
errors[CONF_USERNAME] = "invalid_username"
|
||||||
@ -89,7 +89,9 @@ class Life360ConfigFlow(config_entries.ConfigFlow):
|
|||||||
username = user_input[CONF_USERNAME]
|
username = user_input[CONF_USERNAME]
|
||||||
password = user_input[CONF_PASSWORD]
|
password = user_input[CONF_PASSWORD]
|
||||||
try:
|
try:
|
||||||
authorization = self._api.get_authorization(username, password)
|
authorization = await self.hass.async_add_executor_job(
|
||||||
|
self._api.get_authorization, username, password
|
||||||
|
)
|
||||||
except LoginError:
|
except LoginError:
|
||||||
_LOGGER.error("Invalid credentials for %s", username)
|
_LOGGER.error("Invalid credentials for %s", username)
|
||||||
return self.async_abort(reason="invalid_credentials")
|
return self.async_abort(reason="invalid_credentials")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user