Skip to content

Commit 2746005

Browse files
dumpfheimerChristopher Hoch
and
Christopher Hoch
authored
pass down NETWORK_COMMISSIONING_TIMEOUT to request() (#183)
Co-authored-by: Christopher Hoch <[email protected]>
1 parent 1e9f237 commit 2746005

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

zigpy_znp/api.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# All of these are in seconds
4444
STARTUP_TIMEOUT = 15
4545
AFTER_BOOTLOADER_SKIP_BYTE_DELAY = 2.5
46-
NETWORK_COMMISSIONING_TIMEOUT = 30
46+
NETWORK_COMMISSIONING_TIMEOUT = 60
4747
BOOTLOADER_PIN_TOGGLE_DELAY = 0.15
4848
CONNECT_PING_TIMEOUT = 0.50
4949
CONNECT_PROBE_TIMEOUT = 10
@@ -935,7 +935,7 @@ def wait_for_response(self, response: t.CommandBase) -> asyncio.Future:
935935
return self.wait_for_responses([response])
936936

937937
async def request(
938-
self, request: t.CommandBase, **response_params
938+
self, request: t.CommandBase, timeout: int | None = None, **response_params
939939
) -> t.CommandBase | None:
940940
"""
941941
Sends a SREQ/AREQ request and returns its SRSP (only for SREQ), failing if any
@@ -991,7 +991,9 @@ async def request(
991991
self._uart.send(frame)
992992

993993
# We should get a SRSP in a reasonable amount of time
994-
async with async_timeout.timeout(self._znp_config[conf.CONF_SREQ_TIMEOUT]):
994+
async with async_timeout.timeout(
995+
timeout or self._znp_config[conf.CONF_SREQ_TIMEOUT]
996+
):
995997
# We lock until either a sync response is seen or an error occurs
996998
response = await response_future
997999

@@ -1032,7 +1034,7 @@ async def request_callback_rsp(
10321034
if not background:
10331035
try:
10341036
async with async_timeout.timeout(timeout):
1035-
await self.request(request, **response_params)
1037+
await self.request(request, timeout=timeout, **response_params)
10361038

10371039
return await callback_rsp
10381040
finally:

0 commit comments

Comments
 (0)