Fix august untracked task (#88107)
parent
3d8e8293d6
commit
d0a9d65875
|
@ -87,7 +87,9 @@ async def async_setup_august(
|
||||||
await august_gateway.async_refresh_access_token_if_needed()
|
await august_gateway.async_refresh_access_token_if_needed()
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
data = hass.data[DOMAIN][config_entry.entry_id] = AugustData(hass, august_gateway)
|
data = hass.data[DOMAIN][config_entry.entry_id] = AugustData(
|
||||||
|
hass, config_entry, august_gateway
|
||||||
|
)
|
||||||
await data.async_setup()
|
await data.async_setup()
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
||||||
|
@ -120,9 +122,10 @@ def _async_trigger_ble_lock_discovery(
|
||||||
class AugustData(AugustSubscriberMixin):
|
class AugustData(AugustSubscriberMixin):
|
||||||
"""August data object."""
|
"""August data object."""
|
||||||
|
|
||||||
def __init__(self, hass, august_gateway):
|
def __init__(self, hass, config_entry, august_gateway):
|
||||||
"""Init August data object."""
|
"""Init August data object."""
|
||||||
super().__init__(hass, MIN_TIME_BETWEEN_DETAIL_UPDATES)
|
super().__init__(hass, MIN_TIME_BETWEEN_DETAIL_UPDATES)
|
||||||
|
self._config_entry = config_entry
|
||||||
self._hass = hass
|
self._hass = hass
|
||||||
self._august_gateway = august_gateway
|
self._august_gateway = august_gateway
|
||||||
self.activity_stream = None
|
self.activity_stream = None
|
||||||
|
@ -188,7 +191,9 @@ class AugustData(AugustSubscriberMixin):
|
||||||
# Do not prevent setup as the sync can timeout
|
# Do not prevent setup as the sync can timeout
|
||||||
# but it is not a fatal error as the lock
|
# but it is not a fatal error as the lock
|
||||||
# will recover automatically when it comes back online.
|
# will recover automatically when it comes back online.
|
||||||
asyncio.create_task(self._async_initial_sync())
|
self._config_entry.async_on_unload(
|
||||||
|
asyncio.create_task(self._async_initial_sync()).cancel
|
||||||
|
)
|
||||||
|
|
||||||
async def _async_initial_sync(self):
|
async def _async_initial_sync(self):
|
||||||
"""Attempt to request an initial sync."""
|
"""Attempt to request an initial sync."""
|
||||||
|
|
Loading…
Reference in New Issue