Skip to content

Commit

Permalink
Clean API only on close
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Oct 27, 2024
1 parent 68dd3a0 commit 5780b39
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions zigpy_zigate/uart.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ def __init__(self, api):
super().__init__()
self._api = api

def connection_lost(self, exc) -> None:
def connection_lost(self, exc: Exception | None) -> None:
"""Port was closed expectedly or unexpectedly."""
super().connection_lost(exc)

if self._api is not None:
self._api.connection_lost(exc)
self._api = None

def close(self):
super().close()
self._api = None

def send(self, cmd, data=b""):
"""Send data, taking care of escaping and framing"""
Expand Down

0 comments on commit 5780b39

Please sign in to comment.