From b41c9f4ece9dfce3a09f8eab2a4c1a72aee1254e Mon Sep 17 00:00:00 2001 From: TheJulianJES Date: Mon, 4 May 2026 06:16:25 +0200 Subject: [PATCH] Fix `xncp_set_manual_source_route` keyword arguments The send-packet path called `xncp_set_manual_source_route` with `nwk=`/ `relays=` (the kwargs of the sibling `set_source_route`), but the XNCP wrapper takes `destination=`/`route=`. On firmware that advertises the `MANUAL_SOURCE_ROUTE` feature with manual source routing enabled, this raised `TypeError` instead of installing the route. The existing test mocked the method against the wrong spec (`set_source_route`), so the bad kwargs validated and the bug went unnoticed. Re-spec the mock against `xncp_set_manual_source_route` so the assertion checks the real signature. --- bellows/zigbee/application.py | 4 ++-- tests/test_application.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bellows/zigbee/application.py b/bellows/zigbee/application.py index 1bd0271c..f64254ac 100644 --- a/bellows/zigbee/application.py +++ b/bellows/zigbee/application.py @@ -1042,8 +1042,8 @@ async def send_packet(self, packet: zigpy.types.ZigbeePacket) -> None: ] ): await self._ezsp.xncp_set_manual_source_route( - nwk=packet.dst.address, - relays=packet.source_route, + destination=packet.dst.address, + route=packet.source_route, ) else: await self._ezsp.set_source_route( diff --git a/tests/test_application.py b/tests/test_application.py index 018dd632..9170747b 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -899,7 +899,7 @@ async def test_send_packet_unicast_manual_source_route(make_app, packet): app._ezsp._xncp_features |= FirmwareFeatures.MANUAL_SOURCE_ROUTE app._ezsp.xncp_set_manual_source_route = AsyncMock( - return_value=None, spec=app._ezsp._protocol.set_source_route + return_value=None, spec=app._ezsp.xncp_set_manual_source_route ) packet.source_route = [0x0001, 0x0002] @@ -913,8 +913,8 @@ async def test_send_packet_unicast_manual_source_route(make_app, packet): ) app._ezsp.xncp_set_manual_source_route.assert_called_once_with( - nwk=packet.dst.address, - relays=[0x0001, 0x0002], + destination=packet.dst.address, + route=[0x0001, 0x0002], )