Skip to content

Commit

Permalink
Improve debug logging in DataUpdateCoordinator (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
iMicknl committed Oct 7, 2020
1 parent dfb8909 commit 256c0d8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion custom_components/tahoma/coordinator.py
Expand Up @@ -53,6 +53,10 @@ def __init__(
self.devices: Dict[str, Device] = {d.deviceurl: d for d in devices}
self.executions: Dict[str, Dict[str, str]] = {}

_LOGGER.debug(
"Initialized DataUpdateCoordinator with %s interval.", str(update_interval)
)

async def _async_update_data(self) -> Dict[str, Device]:
"""Fetch TaHoma data via event listener."""
try:
Expand All @@ -61,7 +65,8 @@ async def _async_update_data(self) -> Dict[str, Device]:
raise UpdateFailed("invalid_auth") from exception
except TooManyRequestsException as exception:
raise UpdateFailed("too_many_requests") from exception
except (ServerDisconnectedError, NotAuthenticatedException):
except (ServerDisconnectedError, NotAuthenticatedException) as exception:
_LOGGER.debug(exception)
self.executions = {}
await self.client.login()
self.devices = await self._get_devices()
Expand Down Expand Up @@ -127,6 +132,7 @@ async def _async_update_data(self) -> Dict[str, Device]:

async def _get_devices(self) -> Dict[str, Device]:
"""Fetch devices."""
_LOGGER.debug("Fetching all devices and state via /setup/devices")
return {d.deviceurl: d for d in await self.client.get_devices(refresh=True)}

@staticmethod
Expand Down

0 comments on commit 256c0d8

Please sign in to comment.