uiprotect 1.12.1__tar.gz → 1.13.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of uiprotect might be problematic. Click here for more details.
- {uiprotect-1.12.1 → uiprotect-1.13.0}/PKG-INFO +1 -1
- {uiprotect-1.12.1 → uiprotect-1.13.0}/pyproject.toml +1 -1
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/api.py +6 -8
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/websocket.py +6 -5
- {uiprotect-1.12.1 → uiprotect-1.13.0}/LICENSE +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/README.md +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/__init__.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/__main__.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/__init__.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/backup.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/base.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/cameras.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/chimes.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/doorlocks.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/events.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/lights.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/liveviews.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/nvr.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/sensors.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/cli/viewers.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/data/__init__.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/data/base.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/data/bootstrap.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/data/convert.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/data/devices.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/data/nvr.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/data/types.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/data/user.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/data/websocket.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/exceptions.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/py.typed +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/release_cache.json +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/stream.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/test_util/__init__.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/test_util/anonymize.py +0 -0
- {uiprotect-1.12.1 → uiprotect-1.13.0}/src/uiprotect/utils.py +0 -0
|
@@ -228,6 +228,7 @@ class BaseApiClient:
|
|
|
228
228
|
|
|
229
229
|
@property
|
|
230
230
|
def ws_url(self) -> str:
|
|
231
|
+
"""Get Websocket URL."""
|
|
231
232
|
url = f"wss://{self._host}"
|
|
232
233
|
if self._port != 443:
|
|
233
234
|
url += f":{self._port}"
|
|
@@ -267,7 +268,7 @@ class BaseApiClient:
|
|
|
267
268
|
|
|
268
269
|
if self._websocket is None:
|
|
269
270
|
self._websocket = Websocket(
|
|
270
|
-
self.
|
|
271
|
+
self.get_websocket_url,
|
|
271
272
|
_auth,
|
|
272
273
|
verify=self._verify_ssl,
|
|
273
274
|
timeout=self._ws_timeout,
|
|
@@ -626,9 +627,6 @@ class BaseApiClient:
|
|
|
626
627
|
self._websocket = None
|
|
627
628
|
|
|
628
629
|
websocket = await self.get_websocket()
|
|
629
|
-
# important to make sure WS URL is always current
|
|
630
|
-
websocket.url = self.ws_url
|
|
631
|
-
|
|
632
630
|
if not websocket.is_connected:
|
|
633
631
|
self._last_ws_status = False
|
|
634
632
|
with contextlib.suppress(
|
|
@@ -638,6 +636,10 @@ class BaseApiClient:
|
|
|
638
636
|
):
|
|
639
637
|
await websocket.connect()
|
|
640
638
|
|
|
639
|
+
def get_websocket_url(self) -> str:
|
|
640
|
+
"""Get Websocket URL."""
|
|
641
|
+
return self.ws_url
|
|
642
|
+
|
|
641
643
|
async def async_disconnect_ws(self) -> None:
|
|
642
644
|
"""Disconnect from Websocket."""
|
|
643
645
|
if self._websocket is None:
|
|
@@ -861,10 +863,6 @@ class ProtectApiClient(BaseApiClient):
|
|
|
861
863
|
models=self._subscribed_models,
|
|
862
864
|
ignore_stats=self._ignore_stats,
|
|
863
865
|
)
|
|
864
|
-
# update websocket URL after every message to ensure the latest last_update_id
|
|
865
|
-
if self._websocket is not None:
|
|
866
|
-
self._websocket.url = self.ws_url
|
|
867
|
-
|
|
868
866
|
if processed_message is None:
|
|
869
867
|
return
|
|
870
868
|
|
|
@@ -45,7 +45,7 @@ class Websocket:
|
|
|
45
45
|
|
|
46
46
|
def __init__(
|
|
47
47
|
self,
|
|
48
|
-
|
|
48
|
+
get_url: Callable[[], str],
|
|
49
49
|
auth_callback: CALLBACK_TYPE,
|
|
50
50
|
*,
|
|
51
51
|
timeout: int = 30,
|
|
@@ -53,7 +53,7 @@ class Websocket:
|
|
|
53
53
|
verify: bool = True,
|
|
54
54
|
) -> None:
|
|
55
55
|
"""Init Websocket."""
|
|
56
|
-
self.
|
|
56
|
+
self.get_url = get_url
|
|
57
57
|
self.timeout_interval = timeout
|
|
58
58
|
self.backoff = backoff
|
|
59
59
|
self.verify = verify
|
|
@@ -85,14 +85,15 @@ class Websocket:
|
|
|
85
85
|
return True
|
|
86
86
|
|
|
87
87
|
async def _websocket_loop(self, start_event: asyncio.Event) -> None:
|
|
88
|
-
|
|
88
|
+
url = self.get_url()
|
|
89
|
+
_LOGGER.debug("Connecting WS to %s", url)
|
|
89
90
|
self._headers = await self._auth(self._should_reset_auth)
|
|
90
91
|
|
|
91
92
|
session = self._get_session()
|
|
92
93
|
# catch any and all errors for Websocket so we can clean up correctly
|
|
93
94
|
try:
|
|
94
95
|
self._ws_connection = await session.ws_connect(
|
|
95
|
-
|
|
96
|
+
url,
|
|
96
97
|
ssl=None if self.verify else False,
|
|
97
98
|
headers=self._headers,
|
|
98
99
|
)
|
|
@@ -104,7 +105,7 @@ class Websocket:
|
|
|
104
105
|
break
|
|
105
106
|
self._reset_timeout()
|
|
106
107
|
except ClientError:
|
|
107
|
-
_LOGGER.exception("Websocket disconnect error: %s",
|
|
108
|
+
_LOGGER.exception("Websocket disconnect error: %s", url)
|
|
108
109
|
finally:
|
|
109
110
|
_LOGGER.debug("Websocket disconnected")
|
|
110
111
|
self._increase_failure()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|