Skip to content

Commit

Permalink
Merge pull request #9 from NitorCreations/disconnect-fix
Browse files Browse the repository at this point in the history
Ignore ConnectionError in disconnect()
  • Loading branch information
Jalle19 authored Dec 13, 2024
2 parents 3a388a6 + cbc0342 commit 16943b3
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 16943b3

Please sign in to comment.