From 256c0d870b13c73ac9e56c92178518c5f1d40982 Mon Sep 17 00:00:00 2001 From: Mick Vleeshouwer Date: Wed, 7 Oct 2020 10:23:51 +0200 Subject: [PATCH] Improve debug logging in DataUpdateCoordinator (#290) --- custom_components/tahoma/coordinator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/custom_components/tahoma/coordinator.py b/custom_components/tahoma/coordinator.py index f4c2584b0..13547bebc 100644 --- a/custom_components/tahoma/coordinator.py +++ b/custom_components/tahoma/coordinator.py @@ -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: @@ -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() @@ -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