From f7dd745a7bdd79e7671734f5340179c24ca711c4 Mon Sep 17 00:00:00 2001 From: Marc Dirix Date: Sat, 16 Aug 2025 15:48:19 +0200 Subject: [PATCH 1/4] C+ align load-function to circle load-function --- plugwise_usb/nodes/circle_plus.py | 34 ++++++++++--------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/plugwise_usb/nodes/circle_plus.py b/plugwise_usb/nodes/circle_plus.py index d89603a67..f296c755d 100644 --- a/plugwise_usb/nodes/circle_plus.py +++ b/plugwise_usb/nodes/circle_plus.py @@ -38,38 +38,26 @@ async def load(self) -> bool: if self._loaded: return True if self._cache_enabled: - _LOGGER.debug("Loading Circle node %s from cache", self._node_info.mac) + _LOGGER.debug("Loading Circle+ node %s from cache", self._node_info.mac) if await self._load_from_cache(): self._loaded = True - self._setup_protocol(CIRCLE_PLUS_FIRMWARE_SUPPORT, FEATURES_CIRCLE_PLUS) - if await self.initialize(): - await self._loaded_callback(NodeEvent.LOADED, self.mac) - return True - - _LOGGER.info( - "Loading Circle+ node %s from cache failed", - self._node_info.mac, - ) - else: - _LOGGER.debug("Loading Circle+ node %s", self._node_info.mac) + if not self._loaded: + _LOGGER.debug("Retrieving Info For Circle+ node %s", self._mac_in_str) # Check if node is online - if not self._available and not await self.is_online(): - _LOGGER.warning( - "Failed to load Circle+ node %s because it is not online", - self._node_info.mac, - ) - return False - - # Get node info - if await self.node_info_update() is None: + if ( + not self._available + and not await self.is_online() + or await self.node_info_update() is None + ): _LOGGER.warning( - "Failed to load Circle+ node %s because it is not responding to information request", - self._node_info.mac, + "Failed to load Circle+ node %s because it is not online or not responding", + self._mac_in_str, ) return False self._loaded = True + self._setup_protocol(CIRCLE_PLUS_FIRMWARE_SUPPORT, FEATURES_CIRCLE_PLUS) if not await self.initialize(): return False From c9ea5b5ae6468c13f845b3eb555a040fb4786b32 Mon Sep 17 00:00:00 2001 From: autoruff Date: Sat, 16 Aug 2025 14:08:19 +0000 Subject: [PATCH 2/4] fixup: mdi_cp Python code reformatted using Ruff --- plugwise_usb/nodes/circle_plus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugwise_usb/nodes/circle_plus.py b/plugwise_usb/nodes/circle_plus.py index f296c755d..d46a74266 100644 --- a/plugwise_usb/nodes/circle_plus.py +++ b/plugwise_usb/nodes/circle_plus.py @@ -46,7 +46,7 @@ async def load(self) -> bool: # Check if node is online if ( - not self._available + not self._available and not await self.is_online() or await self.node_info_update() is None ): From b8440f3be55e09eddb64831e152d24725a3a22bf Mon Sep 17 00:00:00 2001 From: Marc Dirix Date: Mon, 18 Aug 2025 14:25:36 +0200 Subject: [PATCH 3/4] CR: use universal str representation variable to communicate mac into log output --- plugwise_usb/nodes/circle_plus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugwise_usb/nodes/circle_plus.py b/plugwise_usb/nodes/circle_plus.py index d46a74266..1cfecd9bd 100644 --- a/plugwise_usb/nodes/circle_plus.py +++ b/plugwise_usb/nodes/circle_plus.py @@ -38,7 +38,7 @@ async def load(self) -> bool: if self._loaded: return True if self._cache_enabled: - _LOGGER.debug("Loading Circle+ node %s from cache", self._node_info.mac) + _LOGGER.debug("Loading Circle+ node %s from cache", self._mac_in_str) if await self._load_from_cache(): self._loaded = True if not self._loaded: From 2bd581a9b00fa530398f5dd1a33c3a530a30093f Mon Sep 17 00:00:00 2001 From: Marc Dirix Date: Tue, 19 Aug 2025 08:15:24 +0200 Subject: [PATCH 4/4] indentation went wrong --- plugwise_usb/nodes/circle_plus.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/plugwise_usb/nodes/circle_plus.py b/plugwise_usb/nodes/circle_plus.py index 1cfecd9bd..66a52fcdb 100644 --- a/plugwise_usb/nodes/circle_plus.py +++ b/plugwise_usb/nodes/circle_plus.py @@ -42,19 +42,19 @@ async def load(self) -> bool: if await self._load_from_cache(): self._loaded = True if not self._loaded: - _LOGGER.debug("Retrieving Info For Circle+ node %s", self._mac_in_str) - - # Check if node is online - if ( - not self._available - and not await self.is_online() - or await self.node_info_update() is None - ): - _LOGGER.warning( - "Failed to load Circle+ node %s because it is not online or not responding", - self._mac_in_str, - ) - return False + _LOGGER.debug("Retrieving info for Circle+ node %s", self._mac_in_str) + + # Check if node is online + if ( + not self._available + and not await self.is_online() + or await self.node_info_update() is None + ): + _LOGGER.warning( + "Failed to load Circle+ node %s because it is not online or not responding", + self._mac_in_str, + ) + return False self._loaded = True