Skip to content

Commit

Permalink
feat: expose the brand on the data object for backwards compat (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Jun 18, 2024
1 parent d463375 commit 1e04f18
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions yalexs/manager/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ def __init__(
self._initial_sync_task: asyncio.Task | None = None
self._error_exception_class = error_exception_class

@property
def brand(self) -> Brand:
"""Return the brand of the API."""
return self._gateway.api.brand

async def async_setup(self) -> None:
"""Async setup of august device data and activities."""
token = self._gateway.access_token
Expand Down Expand Up @@ -121,7 +126,7 @@ async def async_setup_activity_stream(self) -> None:
await self.activity_stream.async_setup()
pubnub.subscribe(self.async_pubnub_message)
self._pubnub_unsub = async_create_pubnub(
user_data["UserID"], pubnub, self._gateway.api.brand
user_data["UserID"], pubnub, self.brand
)

async def _async_initial_sync(self) -> None:
Expand Down Expand Up @@ -396,7 +401,7 @@ async def async_get_doorbell_image(
try:
return await doorbell.async_get_doorbell_image(aiohttp_session, timeout)
except ContentTokenExpired:
if self._gateway.api.brand != Brand.YALE_HOME:
if self.brand != Brand.YALE_HOME:
raise
_LOGGER.debug(
"Error fetching camera image, updating content-token from api to retry"
Expand Down

0 comments on commit 1e04f18

Please sign in to comment.