mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Fix Garmin Connect doing I/O in event loop (#34895)
This commit is contained in:
parent
b9f74f3d25
commit
58d9c96b5f
@ -86,6 +86,7 @@ class GarminConnectData:
|
|||||||
|
|
||||||
def __init__(self, hass, client):
|
def __init__(self, hass, client):
|
||||||
"""Initialize."""
|
"""Initialize."""
|
||||||
|
self.hass = hass
|
||||||
self.client = client
|
self.client = client
|
||||||
self.data = None
|
self.data = None
|
||||||
|
|
||||||
@ -95,7 +96,9 @@ class GarminConnectData:
|
|||||||
today = date.today()
|
today = date.today()
|
||||||
|
|
||||||
try:
|
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 (
|
except (
|
||||||
GarminConnectAuthenticationError,
|
GarminConnectAuthenticationError,
|
||||||
GarminConnectTooManyRequestsError,
|
GarminConnectTooManyRequestsError,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user