Fix lingering timer in cloud (#92498)
This commit is contained in:
parent
7987b00d89
commit
628236209b
2 changed files with 7 additions and 3 deletions
|
@ -16,7 +16,7 @@ from homeassistant.components.alexa import (
|
||||||
smart_home as alexa_smart_home,
|
smart_home as alexa_smart_home,
|
||||||
)
|
)
|
||||||
from homeassistant.components.google_assistant import smart_home as ga
|
from homeassistant.components.google_assistant import smart_home as ga
|
||||||
from homeassistant.core import Context, HomeAssistant, callback
|
from homeassistant.core import Context, HassJob, HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.event import async_call_later
|
from homeassistant.helpers.event import async_call_later
|
||||||
from homeassistant.util.aiohttp import MockRequest, serialize_response
|
from homeassistant.util.aiohttp import MockRequest, serialize_response
|
||||||
|
@ -150,10 +150,12 @@ class CloudClient(Interface):
|
||||||
),
|
),
|
||||||
err,
|
err,
|
||||||
)
|
)
|
||||||
async_call_later(self._hass, 30, enable_alexa)
|
async_call_later(self._hass, 30, enable_alexa_job)
|
||||||
except (alexa_errors.NoTokenAvailable, alexa_errors.RequireRelink):
|
except (alexa_errors.NoTokenAvailable, alexa_errors.RequireRelink):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
enable_alexa_job = HassJob(enable_alexa, cancel_on_shutdown=True)
|
||||||
|
|
||||||
async def enable_google(_):
|
async def enable_google(_):
|
||||||
"""Enable Google."""
|
"""Enable Google."""
|
||||||
gconf = await self.get_google_config()
|
gconf = await self.get_google_config()
|
||||||
|
|
|
@ -139,7 +139,9 @@ def async_enable_report_state(hass: HomeAssistant, google_config: AbstractConfig
|
||||||
|
|
||||||
unsub = async_track_state_change(hass, MATCH_ALL, async_entity_state_listener)
|
unsub = async_track_state_change(hass, MATCH_ALL, async_entity_state_listener)
|
||||||
|
|
||||||
unsub = async_call_later(hass, INITIAL_REPORT_DELAY, initial_report)
|
unsub = async_call_later(
|
||||||
|
hass, INITIAL_REPORT_DELAY, HassJob(initial_report, cancel_on_shutdown=True)
|
||||||
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def unsub_all():
|
def unsub_all():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue