diff --git a/bellows/zigbee/application.py b/bellows/zigbee/application.py index 1bd0271c..45ee6af7 100644 --- a/bellows/zigbee/application.py +++ b/bellows/zigbee/application.py @@ -991,8 +991,15 @@ async def send_packet(self, packet: zigpy.types.ZigbeePacket) -> None: aps_frame.groupId = t.uint16_t(0x0000) if self.config[zigpy.config.CONF_SOURCE_ROUTING]: - # Source routing uses address discovery to discover routes - aps_frame.options |= t.EmberApsOption.APS_OPTION_ENABLE_ADDRESS_DISCOVERY + # Concentrator/source-routing uses address discovery; also keep AODV + # route discovery as a fallback for destinations that aren't yet in + # the NCP's source-route table (e.g. immediately after startup, + # before the first MTORR has propagated). Mirrors what + # zigbee-herdsman's ember adapter does for the same reason. + aps_frame.options |= ( + t.EmberApsOption.APS_OPTION_ENABLE_ADDRESS_DISCOVERY + | t.EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY + ) elif zigpy.types.TransmitOptions.FORCE_ROUTE_DISCOVERY in packet.tx_options: # Forcing route discovery requires retrying aps_frame.options |= t.EmberApsOption.APS_OPTION_FORCE_ROUTE_DISCOVERY diff --git a/tests/test_application.py b/tests/test_application.py index 018dd632..861ef4cf 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -879,6 +879,7 @@ async def test_send_packet_unicast_source_route(make_app, packet): options=( t.EmberApsOption.APS_OPTION_RETRY | t.EmberApsOption.APS_OPTION_ENABLE_ADDRESS_DISCOVERY + | t.EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY ), ) @@ -909,6 +910,7 @@ async def test_send_packet_unicast_manual_source_route(make_app, packet): options=( t.EmberApsOption.APS_OPTION_RETRY | t.EmberApsOption.APS_OPTION_ENABLE_ADDRESS_DISCOVERY + | t.EmberApsOption.APS_OPTION_ENABLE_ROUTE_DISCOVERY ), )