parent
8b56e28838
commit
2a48159b69
2 changed files with 85 additions and 54 deletions
|
@ -12,6 +12,7 @@ from typing import TYPE_CHECKING, Any
|
|||
import aiohttp
|
||||
import async_timeout
|
||||
from hass_nabucasa import Cloud, cloud_api
|
||||
from yarl import URL
|
||||
|
||||
from homeassistant.components import persistent_notification
|
||||
from homeassistant.components.alexa import (
|
||||
|
@ -149,7 +150,7 @@ class CloudAlexaConfig(alexa_config.AbstractConfig):
|
|||
self._token_valid: datetime | None = None
|
||||
self._cur_entity_prefs = async_get_assistant_settings(hass, CLOUD_ALEXA)
|
||||
self._alexa_sync_unsub: Callable[[], None] | None = None
|
||||
self._endpoint: Any = None
|
||||
self._endpoint: str | URL | None = None
|
||||
|
||||
@property
|
||||
def enabled(self) -> bool:
|
||||
|
@ -175,7 +176,7 @@ class CloudAlexaConfig(alexa_config.AbstractConfig):
|
|||
)
|
||||
|
||||
@property
|
||||
def endpoint(self) -> Any | None:
|
||||
def endpoint(self) -> str | URL | None:
|
||||
"""Endpoint for report state."""
|
||||
if self._endpoint is None:
|
||||
raise ValueError("No endpoint available. Fetch access token first")
|
||||
|
@ -309,7 +310,7 @@ class CloudAlexaConfig(alexa_config.AbstractConfig):
|
|||
"""Invalidate access token."""
|
||||
self._token_valid = None
|
||||
|
||||
async def async_get_access_token(self) -> Any:
|
||||
async def async_get_access_token(self) -> str | None:
|
||||
"""Get an access token."""
|
||||
if self._token_valid is not None and self._token_valid > utcnow():
|
||||
return self._token
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue