Skip to content

Commit 9f2479e

Browse files
committed
fix coderabitai
1 parent 3bdb00b commit 9f2479e

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

plugwise_usb/network/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ async def _load_node(self, mac: str) -> bool:
484484
return True
485485
return False
486486

487-
async def _discover_stragglers(self) -> None:
487+
async def _load_stragglers(self) -> None:
488488
"""Retry failed load operation."""
489489
await sleep(60)
490490
while not self._load_discovered_nodes():

plugwise_usb/network/cache.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, cache_root_dir: str = "") -> None:
2020
self._nodetypes: dict[str, NodeType] = {}
2121

2222
@property
23-
def nodetypes(self) -> dict[str, NodeType | None]:
23+
def nodetypes(self) -> dict[str, NodeType]:
2424
"""Cached network information."""
2525
return self._nodetypes
2626

@@ -68,3 +68,7 @@ async def update_nodetypes(self, mac: str, node_type: NodeType | None) -> None:
6868
)
6969
self._nodetypes[mac] = node_type
7070
await self.save_cache()
71+
72+
def get_nodetype(self, mac: str) -> NodeType:
73+
"""Return NodeType from cache."""
74+
return self._nodetypes.get(mac)

plugwise_usb/network/registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ async def update_network_registration(
160160
if current_type is not None:
161161
return
162162
if self._network_cache is not None:
163-
node_type = self._network_cache._nodetypes.get(mac)
163+
node_type = self._network_cache.get_nodetype(mac)
164164

165165
self._registry[address] = (mac, node_type)
166166
if node_type is not None:

plugwise_usb/nodes/circle.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -896,10 +896,7 @@ async def load(self) -> bool:
896896
return False
897897

898898
# Get node info
899-
if (
900-
self.skip_update(self._node_info, 30)
901-
and await self.node_info_update() is None
902-
):
899+
if await self.node_info_update() is None:
903900
_LOGGER.debug(
904901
"Failed to load Circle node %s because it is not responding to information request",
905902
self._mac_in_str,

plugwise_usb/nodes/node.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,9 @@ async def is_online(self) -> bool:
589589
_LOGGER.debug("No response to ping for %s", self.mac)
590590
return False
591591
if not self._initialized:
592-
await self.initialize()
592+
if not await self.initialize():
593+
_LOGGER.debug("Node %s failed to initialize after ping", self.mac)
594+
return False
593595
return True
594596

595597
async def ping_update(

0 commit comments

Comments
 (0)