Skip to content

Commit

Permalink
Fix Home Assistant reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Jun 1, 2020
1 parent 565a7c0 commit dac5fda
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions custom_components/yandex_station/yandex_glagol.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ async def _connect(self, session: ClientSession):
_LOGGER.error(f"Station connect error [{e.errno}] {e}")
await asyncio.sleep(30)

except (asyncio.CancelledError, RuntimeError) as e:
if isinstance(e, RuntimeError):
assert e.args[0] == 'Session is closed', e.args

_LOGGER.debug(f"Останавливаем локальное подключение: {e}")
if not self.ws.closed:
await self.ws.close()
return

except:
_LOGGER.exception(f"Station connect")
await asyncio.sleep(30)
Expand Down

0 comments on commit dac5fda

Please sign in to comment.