Skip to content

Commit 5669f8a

Browse files
committed
Try calling allow_join_requests via create_task()
1 parent 2ee9d07 commit 5669f8a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

plugwise_usb/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def accept_join_request(self) -> bool | None:
191191
return self._network.accept_join_request
192192

193193
@accept_join_request.setter
194-
async def accept_join_request(self, state: bool) -> None:
194+
def accept_join_request(self, state: bool) -> None:
195195
"""Configure join request setting."""
196196
if not self._controller.is_connected:
197197
raise StickError(
@@ -206,7 +206,7 @@ async def accept_join_request(self, state: bool) -> None:
206206
)
207207

208208
self._network.accept_join_request = state
209-
await self._network.allow_join_requests(state)
209+
task = create_task(self._network.allow_join_requests(state))
210210

211211
async def clear_cache(self) -> None:
212212
"""Clear current cache."""

tests/test_usb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ async def test_stick_connect(self, monkeypatch: pytest.MonkeyPatch) -> None:
469469
assert stick.accept_join_request is None
470470
# test failing of join requests without active discovery
471471
with pytest.raises(pw_exceptions.StickError):
472-
await setattr(stick.accept_join_request, "attrib", True)
472+
stick.accept_join_request = True
473473
unsub_connect()
474474
await stick.disconnect()
475475
assert not stick.network_state
@@ -572,7 +572,7 @@ async def test_stick_node_discovered_subscription(
572572
await stick.connect()
573573
await stick.initialize()
574574
await stick.discover_nodes(load=False)
575-
await setattr(stick.accept_join_request, "attrib", True)
575+
stick.accept_join_request = True
576576
self.test_node_awake = asyncio.Future()
577577
unsub_awake = stick.subscribe_to_node_events(
578578
node_event_callback=self.node_awake,

0 commit comments

Comments
 (0)