mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Fix websocket connection bug/errant logic in Ambient PWS (#34217)
This commit is contained in:
parent
0b90ebf91e
commit
5faa9795b0
@ -350,12 +350,17 @@ class AmbientStation:
|
|||||||
|
|
||||||
async def _attempt_connect(self):
|
async def _attempt_connect(self):
|
||||||
"""Attempt to connect to the socket (retrying later on fail)."""
|
"""Attempt to connect to the socket (retrying later on fail)."""
|
||||||
try:
|
|
||||||
|
async def connect(timestamp=None):
|
||||||
|
"""Connect."""
|
||||||
await self.client.websocket.connect()
|
await self.client.websocket.connect()
|
||||||
|
|
||||||
|
try:
|
||||||
|
await connect()
|
||||||
except WebsocketError as err:
|
except WebsocketError as err:
|
||||||
_LOGGER.error("Error with the websocket connection: %s", err)
|
_LOGGER.error("Error with the websocket connection: %s", err)
|
||||||
self._ws_reconnect_delay = min(2 * self._ws_reconnect_delay, 480)
|
self._ws_reconnect_delay = min(2 * self._ws_reconnect_delay, 480)
|
||||||
async_call_later(self._hass, self._ws_reconnect_delay, self.ws_connect)
|
async_call_later(self._hass, self._ws_reconnect_delay, connect)
|
||||||
|
|
||||||
async def ws_connect(self):
|
async def ws_connect(self):
|
||||||
"""Register handlers and connect to the websocket."""
|
"""Register handlers and connect to the websocket."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user