mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Fix Habitica doing blocking I/O in the event loop (#117647)
This commit is contained in:
parent
3efdeaaa77
commit
2b195cab72
@ -151,12 +151,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: HabiticaConfigEntry) ->
|
||||
username = entry.data[CONF_API_USER]
|
||||
password = entry.data[CONF_API_KEY]
|
||||
|
||||
api = HAHabitipyAsync(
|
||||
api = await hass.async_add_executor_job(
|
||||
HAHabitipyAsync,
|
||||
{
|
||||
"url": url,
|
||||
"login": username,
|
||||
"password": password,
|
||||
}
|
||||
},
|
||||
)
|
||||
try:
|
||||
user = await api.user.get(userFields="profile")
|
||||
|
@ -33,12 +33,13 @@ async def validate_input(hass: HomeAssistant, data: dict[str, str]) -> dict[str,
|
||||
"""Validate the user input allows us to connect."""
|
||||
|
||||
websession = async_get_clientsession(hass)
|
||||
api = HabitipyAsync(
|
||||
conf={
|
||||
api = await hass.async_add_executor_job(
|
||||
HabitipyAsync,
|
||||
{
|
||||
"login": data[CONF_API_USER],
|
||||
"password": data[CONF_API_KEY],
|
||||
"url": data[CONF_URL] or DEFAULT_URL,
|
||||
}
|
||||
},
|
||||
)
|
||||
try:
|
||||
await api.user.get(session=websession)
|
||||
|
Loading…
x
Reference in New Issue
Block a user