Fix Alexa Report State (#26305)

* Fix Alexa Report State

* Forgot to save a file
This commit is contained in:
Paulus Schoutsen authored and Andrew Sayre committed 2019-08-30 20:34:40 -05:00
1 parent 37a3d5fd85
commit 7b05ede297
6 files changed
+81 -10

No files matched your search

@@ -7,6 +7,7 @@ import aiohttp
import async_timeout
from hass_nabucasa import cloud_api
from homeassistant.core import callback
from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES
from homeassistant.helpers import entity_registry
from homeassistant.helpers.event import async_call_later
@@ -95,9 +96,14 @@ class AlexaConfig(alexa_config.AbstractConfig):
entity_config = entity_configs.get(entity_id, {})
return entity_config.get(PREF_SHOULD_EXPOSE, DEFAULT_SHOULD_EXPOSE)
@callback
def async_invalidate_access_token(self):
"""Invalidate access token."""
self._token_valid = None
async def async_get_access_token(self):
"""Get an access token."""
if self._token_valid is not None and self._token_valid < utcnow():
if self._token_valid is not None and self._token_valid > utcnow():
return self._token
resp = await cloud_api.async_alexa_access_token(self._cloud)