diff --git a/pyproject.toml b/pyproject.toml index ee0ac9e2..faf76fcc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ readme = "README.md" license = {text = "GPL-3.0"} requires-python = ">=3.8" dependencies = [ - "zigpy>=0.60.2", + "zigpy>=0.69.0", "async_timeout", "voluptuous", "coloredlogs", diff --git a/tests/conftest.py b/tests/conftest.py index 1a2f730f..274478af 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -129,13 +129,16 @@ def __repr__(self): return f"<{type(self).__name__} to {self.protocol}>" -def config_for_port_path(path): - return conf.CONFIG_SCHEMA( - { - conf.CONF_DEVICE: {conf.CONF_DEVICE_PATH: path}, - zigpy.config.CONF_NWK_BACKUP_ENABLED: False, - } - ) +def config_for_port_path(path, apply_schema: bool = True): + config = { + conf.CONF_DEVICE: {conf.CONF_DEVICE_PATH: path}, + zigpy.config.CONF_NWK_BACKUP_ENABLED: False, + } + + if apply_schema: + return conf.CONFIG_SCHEMA(config) + + return config @pytest.fixture @@ -272,10 +275,14 @@ def inner( server_config=None, **kwargs, ): - default = config_for_port_path(FAKE_SERIAL_PORT) - - client_config = merge_dicts(default, client_config or {}) - server_config = merge_dicts(default, server_config or {}) + client_config = merge_dicts( + config_for_port_path(FAKE_SERIAL_PORT, apply_schema=False), + client_config or {}, + ) + server_config = merge_dicts( + config_for_port_path(FAKE_SERIAL_PORT), + server_config or {}, + ) app = ControllerApplication(client_config) diff --git a/tests/tools/test_network_backup_restore.py b/tests/tools/test_network_backup_restore.py index 646265dd..380759a8 100644 --- a/tests/tools/test_network_backup_restore.py +++ b/tests/tools/test_network_backup_restore.py @@ -1,4 +1,5 @@ import json +import asyncio import dataclasses import pytest @@ -293,6 +294,7 @@ async def test_nwk_frame_counter_zstack30(make_connected_znp): await security.write_nwk_frame_counter(znp, 0xAABBCCDD) assert (await security.read_nwk_frame_counter(znp)) == 0xAABBCCDD + await asyncio.sleep(0.1) async def test_nwk_frame_counter_zstack33(make_connected_znp): @@ -333,6 +335,7 @@ async def test_nwk_frame_counter_zstack33(make_connected_znp): await security.write_nwk_frame_counter(znp, 0x98765432) assert (await security.read_nwk_frame_counter(znp)) == 0x98765432 + await asyncio.sleep(0.1) def ieee_and_key(text) -> zigpy.state.Key: diff --git a/zigpy_znp/tools/energy_scan.py b/zigpy_znp/tools/energy_scan.py index 3eb0fb85..64385e21 100644 --- a/zigpy_znp/tools/energy_scan.py +++ b/zigpy_znp/tools/energy_scan.py @@ -17,7 +17,7 @@ async def perform_energy_scan(radio_path, num_scans=None): LOGGER.info("Starting up zigpy-znp") - config = ControllerApplication.SCHEMA({"device": {"path": radio_path}}) + config = {"device": {"path": radio_path}} app = ControllerApplication(config) await app.connect() diff --git a/zigpy_znp/zigbee/application.py b/zigpy_znp/zigbee/application.py index 75103754..b0c263ed 100644 --- a/zigpy_znp/zigbee/application.py +++ b/zigpy_znp/zigbee/application.py @@ -931,7 +931,7 @@ async def send_packet(self, packet: zigpy.types.ZigbeePacket) -> None: # Don't release the concurrency-limiting semaphore until we are done trying. # There is no point in allowing requests to take turns getting buffer errors. try: - async with self._limit_concurrency(): + async with self._limit_concurrency(priority=packet.priority): for attempt in range(REQUEST_MAX_RETRIES): try: # ZDO requests do not generate `AF.DataConfirm` messages diff --git a/zigpy_znp/zigbee/device.py b/zigpy_znp/zigbee/device.py index f6c7a4c6..401baacc 100644 --- a/zigpy_znp/zigbee/device.py +++ b/zigpy_znp/zigbee/device.py @@ -3,6 +3,7 @@ import logging import zigpy.zdo +import zigpy.types import zigpy.device import zigpy.application @@ -22,7 +23,7 @@ def manufacturer(self): def model(self): return "Coordinator" - def request( + async def request( self, profile, cluster, @@ -31,22 +32,25 @@ def request( sequence, data, expect_reply=True, - # Extend the default timeout timeout=2 * zigpy.device.APS_REPLY_TIMEOUT, use_ieee=False, + ask_for_ack: bool | None = None, + priority: int = zigpy.types.PacketPriority.NORMAL, ): """ Normal `zigpy.device.Device:request` except its default timeout is longer. """ - return super().request( - profile, - cluster, - src_ep, - dst_ep, - sequence, - data, + return await super().request( + profile=profile, + cluster=cluster, + src_ep=src_ep, + dst_ep=dst_ep, + sequence=sequence, + data=data, expect_reply=expect_reply, timeout=timeout, use_ieee=use_ieee, + ask_for_ack=ask_for_ack, + priority=priority, )