Skip to content

Commit 1ac3c1a

Browse files
committed
Implement no_stick_response work-around for NodeAddRequest
1 parent 5c234e4 commit 1ac3c1a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

plugwise_usb/connection/sender.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ async def write_request_to_port(self, request: PlugwiseRequest) -> None:
8383
self._transport.write(serialized_data)
8484
request.start_response_timeout()
8585

86+
if request.no_stick_response:
87+
self._stick_response.cancel()
88+
self._stick_lock.release()
89+
self._processed_msgs += 1
90+
8691
# Wait for USB stick to accept request
8792
try:
8893
async with timeout(STICK_TIME_OUT):

plugwise_usb/messages/requests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ def __init__(
108108
self._response_future: Future[PlugwiseResponse] = self._loop.create_future()
109109
self._waiting_for_response = False
110110

111+
self.no_stick_response = False
112+
111113

112114
def __repr__(self) -> str:
113115
"""Convert request into writable str."""
@@ -426,6 +428,8 @@ def __init__(
426428
accept_value = 1 if accept else 0
427429
self._args.append(Int(accept_value, length=2))
428430

431+
self.no_stick_response = True
432+
429433
async def send(self) -> NodeRejoinResponse | None:
430434
"""Send request."""
431435
result = await self._send_request()

0 commit comments

Comments
 (0)