Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions zigpy_znp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# All of these are in seconds
STARTUP_TIMEOUT = 15
AFTER_BOOTLOADER_SKIP_BYTE_DELAY = 2.5
NETWORK_COMMISSIONING_TIMEOUT = 30
NETWORK_COMMISSIONING_TIMEOUT = 60
BOOTLOADER_PIN_TOGGLE_DELAY = 0.15
CONNECT_PING_TIMEOUT = 0.50
CONNECT_PROBE_TIMEOUT = 10
Expand Down Expand Up @@ -935,7 +935,7 @@ def wait_for_response(self, response: t.CommandBase) -> asyncio.Future:
return self.wait_for_responses([response])

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

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

Expand Down Expand Up @@ -1032,7 +1034,7 @@ async def request_callback_rsp(
if not background:
try:
async with async_timeout.timeout(timeout):
await self.request(request, **response_params)
await self.request(request, timeout=timeout, **response_params)

return await callback_rsp
finally:
Expand Down