Skip to content

Commit 1e975d8

Browse files
committed
Update __init__.py
1 parent da5f919 commit 1e975d8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugwise_usb/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from __future__ import annotations
88

9-
from asyncio import get_running_loop
9+
from asyncio import create_task, get_running_loop
1010
from collections.abc import Callable, Coroutine
1111
from functools import wraps
1212
import logging
@@ -198,12 +198,15 @@ def accept_join_request(self, state: bool) -> None:
198198
"Cannot accept joining node"
199199
+ " without an active USB-Stick connection."
200200
)
201+
201202
if self._network is None or not self._network.is_running:
202203
raise StickError(
203204
"Cannot accept joining node"
204205
+ "without node discovery be activated. Call discover() first."
205206
)
207+
206208
self._network.accept_join_request = state
209+
_ = create_task(self._network.allow_join_requests(state))
207210

208211
async def clear_cache(self) -> None:
209212
"""Clear current cache."""
@@ -362,3 +365,4 @@ async def disconnect(self) -> None:
362365
if self._network is not None:
363366
await self._network.stop()
364367
await self._controller.disconnect_from_stick()
368+

0 commit comments

Comments
 (0)