Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions zigpy_ziggurat/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class ControllerApplication(zigpy.application.ControllerApplication):
def __init__(self, config: dict[str, Any]) -> None:
super().__init__(config)
self._api: ZigguratApi | None = None
self._start_time: datetime | None = None

async def connect(self) -> None:
# The device path is either the WebSocket URL of a ziggurat server or the
Expand All @@ -128,6 +129,8 @@ async def connect(self) -> None:
await api.request(p.Reset(hard=t.Bool(False)))

async def disconnect(self) -> None:
self._start_time = None

if self._api is not None:
try:
await self._api.disconnect()
Expand Down Expand Up @@ -863,9 +866,9 @@ async def send_packet(self, packet: t.ZigbeePacket) -> None:

# Within the network startup period, provide route hints to the
# stack to reduce routing congestion
if (
device is not None
and datetime.now(timezone.utc) - self._start_time
if device is not None and (
self._start_time is None
or datetime.now(timezone.utc) - self._start_time
< ROUTE_HINT_DURATION
):
Comment thread
puddly marked this conversation as resolved.
maybe_relays = self.build_source_route_to(device)
Expand Down