Skip to content

Commit cbc0342

Browse files
committed
Ignore ConnectionError in disconnect()
Fixes #8
1 parent 3a388a6 commit cbc0342

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

custom_components/extron/extron.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ async def connect(self):
6969

7070
async def disconnect(self):
7171
self._connected = False
72-
self._writer.close()
73-
await self._writer.wait_closed()
72+
73+
# Ignore potential connection errors here, we're about to disconnect after all
74+
try:
75+
self._writer.close()
76+
await self._writer.wait_closed()
77+
except ConnectionError:
78+
pass
7479

7580
async def reconnect(self):
7681
await self.disconnect()

0 commit comments

Comments
 (0)