Skip to content

Commit

Permalink
Handle relays too
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Feb 3, 2025
1 parent f8feaea commit 7f94970
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions bellows/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import asyncio
from collections import defaultdict, deque
import contextlib
from datetime import datetime, timezone
import logging
import os
Expand Down Expand Up @@ -946,9 +947,10 @@ async def send_packet(self, packet: zigpy.types.ZigbeePacket) -> None:
)
finally:
if route_status_handler_future is not None:
self._request_status_handlers[packet.dst.address].remove(
route_status_handler_future
)
with contextlib.suppress(ValueError):
self._request_status_handlers[packet.dst.address].remove(
route_status_handler_future
)

async def permit(self, time_s: int = 60, node: t.EmberNodeId = None) -> None:
"""Permit joining."""
Expand Down Expand Up @@ -1067,6 +1069,12 @@ def handle_route_record(
)
self.handle_relays(nwk=nwk, relays=relays)

handlers = self._request_status_handlers[nwk]
if not handlers:
return

handlers.popleft().set_result(None)

def handle_route_error(self, status: t.sl_Status, nwk: t.EmberNodeId) -> None:
LOGGER.debug("Processing route error: status=%s, nwk=%s", status, nwk)

Expand Down

0 comments on commit 7f94970

Please sign in to comment.