Fix Garmin Connect doing I/O in event loop (#34895)
This commit is contained in:
parent
b9f74f3d25
commit
58d9c96b5f
1 changed files with 4 additions and 1 deletions
|
@ -86,6 +86,7 @@ class GarminConnectData:
|
|||
|
||||
def __init__(self, hass, client):
|
||||
"""Initialize."""
|
||||
self.hass = hass
|
||||
self.client = client
|
||||
self.data = None
|
||||
|
||||
|
@ -95,7 +96,9 @@ class GarminConnectData:
|
|||
today = date.today()
|
||||
|
||||
try:
|
||||
self.data = self.client.get_stats_and_body(today.isoformat())
|
||||
self.data = await self.hass.async_add_executor_job(
|
||||
self.client.get_stats_and_body, today.isoformat()
|
||||
)
|
||||
except (
|
||||
GarminConnectAuthenticationError,
|
||||
GarminConnectTooManyRequestsError,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue