Skip to content

Commit 07777a2

Browse files
committed
Execute allow_join_requests() after network.is_running
1 parent 0f7566f commit 07777a2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

plugwise_usb/network/__init__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,6 @@ async def discover_network_coordinator(self, load: bool = False) -> bool:
319319
):
320320
if load:
321321
return await self._load_node(self._controller.mac_coordinator)
322-
if self.accept_join_request and not self._old_acc_join_req:
323-
await self.allow_join_requests(True)
324-
self._old_acc_join_req = True
325-
if not self.accept_join_request and self._old_acc_join_req:
326-
await self.allow_join_requests(False)
327-
self._old_acc_join_req = False
328322
return True
329323

330324
return False
@@ -493,9 +487,18 @@ async def discover_nodes(self, load: bool = True) -> bool:
493487
await self.discover_network_coordinator(load=load)
494488
if not self._is_running:
495489
await self.start()
490+
496491
await self._discover_registered_nodes()
497492
if load:
498493
return await self._load_discovered_nodes()
494+
495+
if self.accept_join_request and not self._old_acc_join_req:
496+
await self.allow_join_requests(True)
497+
self._old_acc_join_req = True
498+
if not self.accept_join_request and self._old_acc_join_req:
499+
await self.allow_join_requests(False)
500+
self._old_acc_join_req = False
501+
499502
return True
500503

501504
async def stop(self) -> None:

0 commit comments

Comments
 (0)