Skip to content

Commit

Permalink
Ignore ConnectionError in disconnect()
Browse files Browse the repository at this point in the history
Fixes #8
  • Loading branch information
Jalle19 committed Dec 13, 2024
1 parent 3a388a6 commit cbc0342
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions custom_components/extron/extron.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ async def connect(self):

async def disconnect(self):
self._connected = False
self._writer.close()
await self._writer.wait_closed()

# Ignore potential connection errors here, we're about to disconnect after all
try:
self._writer.close()
await self._writer.wait_closed()
except ConnectionError:
pass

async def reconnect(self):
await self.disconnect()
Expand Down

0 comments on commit cbc0342

Please sign in to comment.