Skip to content

Commit 84d7f9e

Browse files
committed
Increase the response-timeout to 45 seconds
based on an observed response-time of 30 seconds
1 parent 2359d9c commit 84d7f9e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

plugwise_usb/connection/sender.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from collections.abc import Callable
2222
import logging
2323

24-
from ..constants import STICK_TIME_OUT
24+
from ..constants import NODE_TIME_OUT
2525
from ..exceptions import StickError
2626
from ..messages.requests import PlugwiseRequest
2727
from ..messages.responses import StickResponse, StickResponseType
@@ -86,18 +86,18 @@ async def write_request_to_port(self, request: PlugwiseRequest) -> None:
8686

8787
# Wait for USB stick to accept request
8888
try:
89-
async with timeout(STICK_TIME_OUT):
89+
async with timeout(NODE_TIME_OUT):
9090
response: StickResponse = await self._stick_response
9191
except TimeoutError:
9292
_LOGGER.warning(
9393
"USB-Stick did not respond within %s seconds after writing %s",
94-
STICK_TIME_OUT,
94+
NODE_TIME_OUT,
9595
request,
9696
)
9797
request.assign_error(
9898
BaseException(
9999
StickError(
100-
f"USB-Stick did not respond within {STICK_TIME_OUT} seconds after writing {request}"
100+
f"USB-Stick did not respond within {NODE_TIME_OUT} seconds after writing {request}"
101101
)
102102
)
103103
)

plugwise_usb/constants.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131

3232
# Max timeout in seconds
3333
STICK_TIME_OUT: Final = 11 # Stick responds with timeout messages within 10s.
34-
NODE_TIME_OUT: Final = 15 # In bigger networks a response from a node could take up a while, so lets use 15 seconds.
34+
# In bigger networks a response from a node could take up a while
35+
NODE_TIME_OUT: Final = 45
36+
# A delayed response being received after 30 secs so lets use 45 seconds.
37+
# @bouwew: NodeJoinAckResponse to a NodeAddRequest
38+
3539
MAX_RETRIES: Final = 3
3640
SUPPRESS_INITIALIZATION_WARNINGS: Final = 10 # Minutes to suppress (expected) communication warning messages after initialization
3741

0 commit comments

Comments
 (0)