diff --git a/tests/test_application.py b/tests/test_application.py index cd3da3c..d2b068d 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -323,10 +323,8 @@ def test_tx_confirm_dup(app, caplog): assert "probably duplicate response" in caplog.text -def test_tx_confirm_unexpcted(app, caplog): +def test_tx_confirm_unexpcted(app): app.handle_tx_confirm(123, 0x00) - assert any(r.levelname == "WARNING" for r in caplog.records) - assert "Unexpected transmit confirm for request id" in caplog.text async def test_reset_watchdog(app): diff --git a/tests/test_send_receive.py b/tests/test_send_receive.py index 853bc39..f336803 100644 --- a/tests/test_send_receive.py +++ b/tests/test_send_receive.py @@ -206,3 +206,10 @@ async def test_send_packet_deliver_failure(app, tx_packet): # noqa: F811 await app.send_packet(tx_packet) assert "Failed to deliver" in str(e) + + +async def test_send_packet_no_ack_ignores_deliver_failure(app, tx_packet): # noqa: F811 + tx_packet.tx_options &= ~zigpy_t.TransmitOptions.ACK + with patch_data_request(app, fail_deliver=True): + await app.send_packet(tx_packet) + assert len(app._pending_requests) == 0 diff --git a/zigpy_deconz/zigbee/application.py b/zigpy_deconz/zigbee/application.py index 652200f..4907b27 100644 --- a/zigpy_deconz/zigbee/application.py +++ b/zigpy_deconz/zigbee/application.py @@ -583,14 +583,14 @@ async def send_packet(self, packet): raise zigpy.exceptions.DeliveryError( f"Failed to enqueue packet: {ex!r}", ex.status ) - - async with asyncio_timeout(SEND_CONFIRM_TIMEOUT): - status = await future - - if status != TXStatus.SUCCESS: - raise zigpy.exceptions.DeliveryError( - f"Failed to deliver packet: {status!r}", status - ) + if tx_options & t.DeconzTransmitOptions.USE_APS_ACKS: + async with asyncio_timeout(SEND_CONFIRM_TIMEOUT): + status = await future + + if status != TXStatus.SUCCESS: + raise zigpy.exceptions.DeliveryError( + f"Failed to deliver packet: {status!r}", status + ) finally: del self._pending_requests[req_id] @@ -602,8 +602,8 @@ def handle_tx_confirm(self, req_id, status): try: future = self._pending_requests[req_id] except KeyError: - LOGGER.warning( - "Unexpected transmit confirm for request id %s, Status: %s", + LOGGER.debug( + "Transmit confirm for request id %s, Status: %s", req_id, status, )