uiprotect 7.14.1__py3-none-any.whl → 7.14.2__py3-none-any.whl
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/api.py +1 -15
- uiprotect/cli/__init__.py +2 -21
- uiprotect/data/bootstrap.py +2 -2
- uiprotect/data/nvr.py +3 -25
- uiprotect/utils.py +0 -2
- {uiprotect-7.14.1.dist-info → uiprotect-7.14.2.dist-info}/METADATA +3 -1
- {uiprotect-7.14.1.dist-info → uiprotect-7.14.2.dist-info}/RECORD +10 -10
- {uiprotect-7.14.1.dist-info → uiprotect-7.14.2.dist-info}/LICENSE +0 -0
- {uiprotect-7.14.1.dist-info → uiprotect-7.14.2.dist-info}/WHEEL +0 -0
- {uiprotect-7.14.1.dist-info → uiprotect-7.14.2.dist-info}/entry_points.txt +0 -0
uiprotect/api.py
CHANGED
|
@@ -82,10 +82,7 @@ TOKEN_COOKIE_MAX_EXP_SECONDS = 60
|
|
|
82
82
|
DEVICE_UPDATE_INTERVAL = 900
|
|
83
83
|
# retry timeout for thumbnails/heatmaps
|
|
84
84
|
RETRY_TIMEOUT = 10
|
|
85
|
-
|
|
86
|
-
"https://apt.artifacts.ui.com/dists/stretch/release/binary-arm64/Packages",
|
|
87
|
-
"https://apt.artifacts.ui.com/dists/bullseye/release/binary-arm64/Packages",
|
|
88
|
-
]
|
|
85
|
+
|
|
89
86
|
TYPES_BUG_MESSAGE = """There is currently a bug in UniFi Protect that makes `start` / `end` not work if `types` is not provided. This means uiprotect has to iterate over all of the events matching the filters provided to return values.
|
|
90
87
|
|
|
91
88
|
If your Protect instance has a lot of events, this request will take much longer then expected. It is recommended adding additional filters to speed the request up."""
|
|
@@ -1915,17 +1912,6 @@ class ProtectApiClient(BaseApiClient):
|
|
|
1915
1912
|
|
|
1916
1913
|
return versions
|
|
1917
1914
|
|
|
1918
|
-
async def get_release_versions(self) -> set[Version]:
|
|
1919
|
-
"""Get all release versions for UniFi Protect"""
|
|
1920
|
-
versions: set[Version] = set()
|
|
1921
|
-
for url in PROTECT_APT_URLS:
|
|
1922
|
-
try:
|
|
1923
|
-
versions |= await self._get_versions_from_api(url)
|
|
1924
|
-
except NvrError:
|
|
1925
|
-
_LOGGER.warning("Failed to retrieve release versions from online.")
|
|
1926
|
-
|
|
1927
|
-
return versions
|
|
1928
|
-
|
|
1929
1915
|
async def relative_move_ptz_camera(
|
|
1930
1916
|
self,
|
|
1931
1917
|
device_id: str,
|
uiprotect/cli/__init__.py
CHANGED
|
@@ -13,9 +13,9 @@ from rich.progress import track
|
|
|
13
13
|
|
|
14
14
|
from uiprotect.api import MetaInfo, ProtectApiClient
|
|
15
15
|
|
|
16
|
-
from ..data import
|
|
16
|
+
from ..data import WSPacket
|
|
17
17
|
from ..test_util import SampleDataGenerator
|
|
18
|
-
from ..utils import
|
|
18
|
+
from ..utils import get_local_timezone, run_async
|
|
19
19
|
from ..utils import profile_ws as profile_ws_job
|
|
20
20
|
from .aiports import app as aiports_app
|
|
21
21
|
from .base import CliContext, OutputFormatEnum
|
|
@@ -314,25 +314,6 @@ def decode_ws_msg(
|
|
|
314
314
|
typer.echo(orjson.dumps(response).decode("utf-8"))
|
|
315
315
|
|
|
316
316
|
|
|
317
|
-
@app.command()
|
|
318
|
-
def release_versions(ctx: typer.Context) -> None:
|
|
319
|
-
"""Updates the release version cache on disk."""
|
|
320
|
-
protect = cast(ProtectApiClient, ctx.obj.protect)
|
|
321
|
-
|
|
322
|
-
async def callback() -> set[Version]:
|
|
323
|
-
versions = await protect.get_release_versions()
|
|
324
|
-
await protect.close_session()
|
|
325
|
-
return versions
|
|
326
|
-
|
|
327
|
-
_setup_logger()
|
|
328
|
-
|
|
329
|
-
versions = run_async(callback())
|
|
330
|
-
output = orjson.dumps(sorted([str(v) for v in versions]))
|
|
331
|
-
|
|
332
|
-
Path(RELEASE_CACHE).write_bytes(output)
|
|
333
|
-
typer.echo(output.decode("utf-8"))
|
|
334
|
-
|
|
335
|
-
|
|
336
317
|
@app.command()
|
|
337
318
|
def create_api_key(
|
|
338
319
|
ctx: typer.Context,
|
uiprotect/data/bootstrap.py
CHANGED
|
@@ -680,5 +680,5 @@ class Bootstrap(ProtectBaseObject):
|
|
|
680
680
|
_LOGGER.debug("Successfully refresh model: %s %s", model_type, device_id)
|
|
681
681
|
|
|
682
682
|
async def get_is_prerelease(self) -> bool:
|
|
683
|
-
"""
|
|
684
|
-
return
|
|
683
|
+
"""[DEPRECATED] Always returns False. Will be removed after HA 2025.8.0."""
|
|
684
|
+
return False
|
uiprotect/data/nvr.py
CHANGED
|
@@ -15,12 +15,11 @@ from uuid import UUID
|
|
|
15
15
|
|
|
16
16
|
import aiofiles
|
|
17
17
|
import orjson
|
|
18
|
-
from aiofiles import os as aos
|
|
19
18
|
from convertertools import pop_dict_set_if_none, pop_dict_tuple
|
|
20
19
|
from pydantic.fields import PrivateAttr
|
|
21
20
|
|
|
22
21
|
from ..exceptions import BadRequest, NotAuthorized
|
|
23
|
-
from ..utils import
|
|
22
|
+
from ..utils import convert_to_datetime
|
|
24
23
|
from .base import (
|
|
25
24
|
ProtectBaseObject,
|
|
26
25
|
ProtectDeviceModel,
|
|
@@ -1217,29 +1216,8 @@ class NVR(ProtectDeviceModel):
|
|
|
1217
1216
|
return versions
|
|
1218
1217
|
|
|
1219
1218
|
async def get_is_prerelease(self) -> bool:
|
|
1220
|
-
"""
|
|
1221
|
-
|
|
1222
|
-
if self.version.is_prerelease:
|
|
1223
|
-
return True
|
|
1224
|
-
|
|
1225
|
-
# 2.6.14 is an EA version that looks like a release version
|
|
1226
|
-
cache_file_path = self._api.cache_dir / "release_cache.json"
|
|
1227
|
-
versions = await self._read_cache_file(
|
|
1228
|
-
cache_file_path,
|
|
1229
|
-
) or await self._read_cache_file(RELEASE_CACHE)
|
|
1230
|
-
if versions is None or self.version not in versions:
|
|
1231
|
-
versions = await self._api.get_release_versions()
|
|
1232
|
-
try:
|
|
1233
|
-
_LOGGER.debug("Fetching releases from APT repos...")
|
|
1234
|
-
tmp = self._api.cache_dir / "release_cache.tmp.json"
|
|
1235
|
-
await aos.makedirs(self._api.cache_dir, exist_ok=True)
|
|
1236
|
-
async with aiofiles.open(tmp, "wb") as cache_file:
|
|
1237
|
-
await cache_file.write(orjson.dumps([str(v) for v in versions]))
|
|
1238
|
-
await aos.rename(tmp, cache_file_path)
|
|
1239
|
-
except Exception:
|
|
1240
|
-
_LOGGER.warning("Failed write cache file.")
|
|
1241
|
-
|
|
1242
|
-
return self.version not in versions
|
|
1219
|
+
"""[DEPRECATED] Always returns False. Will be removed after HA 2025.8.0."""
|
|
1220
|
+
return False
|
|
1243
1221
|
|
|
1244
1222
|
async def set_smart_detections(self, value: bool) -> None:
|
|
1245
1223
|
"""Set if smart detections are enabled."""
|
uiprotect/utils.py
CHANGED
|
@@ -74,8 +74,6 @@ SNAKE_CASE_MATCH_3 = re.compile("([a-z0-9])([A-Z])")
|
|
|
74
74
|
|
|
75
75
|
_LOGGER = logging.getLogger(__name__)
|
|
76
76
|
|
|
77
|
-
RELEASE_CACHE = Path(__file__).parent / "release_cache.json"
|
|
78
|
-
|
|
79
77
|
_CREATE_TYPES = {IPv6Address, IPv4Address, UUID, Color, Decimal, Path, Version}
|
|
80
78
|
_BAD_UUID = "00000000-0000-00 0- 000-000000000000"
|
|
81
79
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: uiprotect
|
|
3
|
-
Version: 7.14.
|
|
3
|
+
Version: 7.14.2
|
|
4
4
|
Summary: Python API for Unifi Protect (Unofficial)
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: UI Protect Maintainers
|
|
@@ -241,6 +241,8 @@ unsub()
|
|
|
241
241
|
|
|
242
242
|
## TODO / Planned / Not Implemented
|
|
243
243
|
|
|
244
|
+
Switching from Protect Private API to the New Public API
|
|
245
|
+
|
|
244
246
|
Generally any feature missing from the library is planned to be done eventually / nice to have with the following exceptions
|
|
245
247
|
|
|
246
248
|
### UniFi OS Features
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
uiprotect/__init__.py,sha256=Oz6i1tonIz4QWVnEPkbielJDJ3WQdwZVgYtjY4IwGAQ,636
|
|
2
2
|
uiprotect/__main__.py,sha256=C_bHCOkv5qj6WMy-6ELoY3Y6HDhLxOa1a30CzmbZhsg,462
|
|
3
3
|
uiprotect/_compat.py,sha256=HThmb1zQZCEssCxYYbQzFhJq8zYYlVaSnIEZabKc-6U,302
|
|
4
|
-
uiprotect/api.py,sha256=
|
|
5
|
-
uiprotect/cli/__init__.py,sha256=
|
|
4
|
+
uiprotect/api.py,sha256=YcmXBQy4ktZs61U3f7RqwM7hOZ7QS99U9nlGeTYf8Z4,72447
|
|
5
|
+
uiprotect/cli/__init__.py,sha256=ANasP55kd1QJ8H0YpHV7lxlMQTiqa2iDLpR5-JmyZjk,9511
|
|
6
6
|
uiprotect/cli/aiports.py,sha256=wpEr2w_hY18CGpFiQM2Yc0FiVwG_1l2CzZhZLGNigvI,1576
|
|
7
7
|
uiprotect/cli/backup.py,sha256=ZiS7RZnJGKI8TJKLW2cOUzkRM8nyTvE5Ov_jZZGtvSM,36708
|
|
8
8
|
uiprotect/cli/base.py,sha256=5-z-IS8g9iQqhR_YbjxaJAFiMMAY_7cCtNAtvLdRCoM,7524
|
|
@@ -17,10 +17,10 @@ uiprotect/cli/sensors.py,sha256=fQtcDJCVxs4VbAqcavgBy2ABiVxAW3GXtna6_XFBp2k,8153
|
|
|
17
17
|
uiprotect/cli/viewers.py,sha256=2cyrp104ffIvgT0wYGIO0G35QMkEbFe7fSVqLwDXQYQ,2171
|
|
18
18
|
uiprotect/data/__init__.py,sha256=audwJBjxRiYdNPeYlP6iofFIOq3gyQzh6VpDsOCM2dQ,2964
|
|
19
19
|
uiprotect/data/base.py,sha256=CXIxaJCJNpavadn6uF7vlhI4wxkfD8MNBGgR-smRA7k,35401
|
|
20
|
-
uiprotect/data/bootstrap.py,sha256=
|
|
20
|
+
uiprotect/data/bootstrap.py,sha256=r0T1qD6ZFC86pWK-70kx5MxugrN31XqVxUQ6BfB78O4,23552
|
|
21
21
|
uiprotect/data/convert.py,sha256=xEN878_hm0HZZCVYGwJSxcSp2as9zpkvsemVIibReOA,2628
|
|
22
22
|
uiprotect/data/devices.py,sha256=akNyLQKCNI8SiA7oUW1cSvE-IZ9Oav8iv9PfESpjits,115839
|
|
23
|
-
uiprotect/data/nvr.py,sha256=
|
|
23
|
+
uiprotect/data/nvr.py,sha256=HnknmMmUxe1aPA0PHJZSiEwpvo1phtHBp3wXsU6v_iI,46681
|
|
24
24
|
uiprotect/data/types.py,sha256=PIf08tkkLzLPu8IHlEfv5Jqy7sdyhcbLkBgoV21Kyv0,19313
|
|
25
25
|
uiprotect/data/user.py,sha256=Del5LUmt5uCfAQMI9-kl_GaKm085oTLjxmcCrlEKXxc,10526
|
|
26
26
|
uiprotect/data/websocket.py,sha256=m4EV1Qfh08eKOihy70ycViYgEQpeNSGZQJWdtGIYJDA,6791
|
|
@@ -30,10 +30,10 @@ uiprotect/release_cache.json,sha256=NamnSFy78hOWY0DPO87J9ELFCAN6NnVquv8gQO75ZG4,
|
|
|
30
30
|
uiprotect/stream.py,sha256=ls65vMOXF4IlJ5axewFITfhcaTh_ihaFeCkCTfhy0Nk,5168
|
|
31
31
|
uiprotect/test_util/__init__.py,sha256=HlQBgIgdtrvT-gQ5OWP92LbgVr_YzsD5NFImLRonUZk,19320
|
|
32
32
|
uiprotect/test_util/anonymize.py,sha256=f-8ijU-_y9r-uAbhIPn0f0I6hzJpAkvJzc8UpWihObI,8478
|
|
33
|
-
uiprotect/utils.py,sha256=
|
|
33
|
+
uiprotect/utils.py,sha256=2fLwXN0oz9dcVTFexzLp8jj97lcYrxLZkeEUGf5ehtU,20587
|
|
34
34
|
uiprotect/websocket.py,sha256=tEyenqblNXHcjWYuf4oRP1E7buNwx6zoECMwpBr-jig,8191
|
|
35
|
-
uiprotect-7.14.
|
|
36
|
-
uiprotect-7.14.
|
|
37
|
-
uiprotect-7.14.
|
|
38
|
-
uiprotect-7.14.
|
|
39
|
-
uiprotect-7.14.
|
|
35
|
+
uiprotect-7.14.2.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
|
|
36
|
+
uiprotect-7.14.2.dist-info/METADATA,sha256=5SQTlpnGjKliDHK5OjxSuo5iQEbPyzgSzUV-4jM0NU8,11167
|
|
37
|
+
uiprotect-7.14.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
38
|
+
uiprotect-7.14.2.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
|
|
39
|
+
uiprotect-7.14.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|