uiprotect 5.2.0__py3-none-any.whl → 5.2.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/data/devices.py +32 -6
- uiprotect/utils.py +5 -0
- {uiprotect-5.2.0.dist-info → uiprotect-5.2.2.dist-info}/METADATA +1 -1
- {uiprotect-5.2.0.dist-info → uiprotect-5.2.2.dist-info}/RECORD +7 -7
- {uiprotect-5.2.0.dist-info → uiprotect-5.2.2.dist-info}/LICENSE +0 -0
- {uiprotect-5.2.0.dist-info → uiprotect-5.2.2.dist-info}/WHEEL +0 -0
- {uiprotect-5.2.0.dist-info → uiprotect-5.2.2.dist-info}/entry_points.txt +0 -0
uiprotect/data/devices.py
CHANGED
|
@@ -7,7 +7,7 @@ import logging
|
|
|
7
7
|
import warnings
|
|
8
8
|
from collections.abc import Callable
|
|
9
9
|
from datetime import datetime, timedelta
|
|
10
|
-
from functools import cache
|
|
10
|
+
from functools import cache, lru_cache
|
|
11
11
|
from ipaddress import IPv4Address
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
from typing import TYPE_CHECKING, Any, Literal, cast
|
|
@@ -25,6 +25,7 @@ from ..utils import (
|
|
|
25
25
|
convert_video_modes,
|
|
26
26
|
from_js_time,
|
|
27
27
|
serialize_point,
|
|
28
|
+
timedelta_total_seconds,
|
|
28
29
|
to_js_time,
|
|
29
30
|
utc_now,
|
|
30
31
|
)
|
|
@@ -471,6 +472,20 @@ class SmartDetectSettings(ProtectBaseObject):
|
|
|
471
472
|
"autoTrackingObjectTypes": convert_smart_types,
|
|
472
473
|
} | super().unifi_dict_conversions()
|
|
473
474
|
|
|
475
|
+
def unifi_dict(
|
|
476
|
+
self,
|
|
477
|
+
data: dict[str, Any] | None = None,
|
|
478
|
+
exclude: set[str] | None = None,
|
|
479
|
+
) -> dict[str, Any]:
|
|
480
|
+
data = super().unifi_dict(data=data, exclude=exclude)
|
|
481
|
+
if audio_types := data.get("audioTypes"):
|
|
482
|
+
# SMOKE_CMONX is not supported for audio types
|
|
483
|
+
# and should not be sent to the camera
|
|
484
|
+
data["audioTypes"] = [
|
|
485
|
+
t for t in audio_types if t != SmartDetectAudioType.SMOKE_CMONX.value
|
|
486
|
+
]
|
|
487
|
+
return data
|
|
488
|
+
|
|
474
489
|
|
|
475
490
|
class LCDMessage(ProtectBaseObject):
|
|
476
491
|
type: DoorbellMessageType
|
|
@@ -886,6 +901,15 @@ class CameraAudioSettings(ProtectBaseObject):
|
|
|
886
901
|
style: list[AudioStyle]
|
|
887
902
|
|
|
888
903
|
|
|
904
|
+
@lru_cache
|
|
905
|
+
def _chime_type_from_total_seconds(total_seconds: float) -> ChimeType:
|
|
906
|
+
if total_seconds == 0.3:
|
|
907
|
+
return ChimeType.MECHANICAL
|
|
908
|
+
if total_seconds > 0.3:
|
|
909
|
+
return ChimeType.DIGITAL
|
|
910
|
+
return ChimeType.NONE
|
|
911
|
+
|
|
912
|
+
|
|
889
913
|
class Camera(ProtectMotionDeviceModel):
|
|
890
914
|
is_deleting: bool
|
|
891
915
|
# Microphone Sensitivity
|
|
@@ -1841,11 +1865,13 @@ class Camera(ProtectMotionDeviceModel):
|
|
|
1841
1865
|
|
|
1842
1866
|
@property
|
|
1843
1867
|
def chime_type(self) -> ChimeType:
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1868
|
+
return _chime_type_from_total_seconds(
|
|
1869
|
+
timedelta_total_seconds(self.chime_duration)
|
|
1870
|
+
)
|
|
1871
|
+
|
|
1872
|
+
@property
|
|
1873
|
+
def chime_duration_seconds(self) -> float:
|
|
1874
|
+
return timedelta_total_seconds(self.chime_duration)
|
|
1849
1875
|
|
|
1850
1876
|
@property
|
|
1851
1877
|
def is_digital_chime(self) -> bool:
|
uiprotect/utils.py
CHANGED
|
@@ -670,3 +670,8 @@ def make_required_getter(ufp_required_field: str) -> Callable[[T], bool]:
|
|
|
670
670
|
if "." not in ufp_required_field:
|
|
671
671
|
return partial(get_top_level_attr_as_bool, ufp_required_field)
|
|
672
672
|
return partial(get_nested_attr_as_bool, tuple(ufp_required_field.split(".")))
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
@lru_cache
|
|
676
|
+
def timedelta_total_seconds(td: timedelta) -> float:
|
|
677
|
+
return td.total_seconds()
|
|
@@ -17,7 +17,7 @@ uiprotect/data/__init__.py,sha256=OcfuJl2qXfHcj_mdnrHhzZ5tEIZrw8auziX5IE7dn-I,29
|
|
|
17
17
|
uiprotect/data/base.py,sha256=J2ytJqWJIsFq7vXYG4gfp2c-mrj5gqa3UhmItF0MWbI,35033
|
|
18
18
|
uiprotect/data/bootstrap.py,sha256=OSPHu08p7Ys9KqEb8sq_LFufuECtF4lY7OnAYK27ngo,20454
|
|
19
19
|
uiprotect/data/convert.py,sha256=8h6Il_DhMkPRDPj9F_rA2UZIlTuchS3BQD24peKpk2A,2185
|
|
20
|
-
uiprotect/data/devices.py,sha256=
|
|
20
|
+
uiprotect/data/devices.py,sha256=0l8eiTCwacdHCmOc7qNzeUMpHLxvd6FeB7DOqZKycdA,110880
|
|
21
21
|
uiprotect/data/nvr.py,sha256=8M-62AG4q1k71eX-DaFcdO52QWG4zO9X5Voj0Tj9D5A,46598
|
|
22
22
|
uiprotect/data/types.py,sha256=3CocULpkdTgF4is1nIEDYIlwf2EOkNNM7L4kJ7NkAwM,17654
|
|
23
23
|
uiprotect/data/user.py,sha256=YvgXJKV4_y-bm0eySWz9f_ie9aR5lpVn17t9H0Pix8I,6998
|
|
@@ -28,10 +28,10 @@ uiprotect/release_cache.json,sha256=NamnSFy78hOWY0DPO87J9ELFCAN6NnVquv8gQO75ZG4,
|
|
|
28
28
|
uiprotect/stream.py,sha256=McV3XymKyjn-1uV5jdQHcpaDjqLS4zWyMASQ8ubcyb4,4924
|
|
29
29
|
uiprotect/test_util/__init__.py,sha256=Ky8mTL61nhp5II2mxTKBAsSGvNqK8U_CfKC5AGwToAI,18704
|
|
30
30
|
uiprotect/test_util/anonymize.py,sha256=f-8ijU-_y9r-uAbhIPn0f0I6hzJpAkvJzc8UpWihObI,8478
|
|
31
|
-
uiprotect/utils.py,sha256=
|
|
31
|
+
uiprotect/utils.py,sha256=O2RIiUZX4kBHq5v3L598uYe7rbhOcKTeqyYQi6rITnQ,19865
|
|
32
32
|
uiprotect/websocket.py,sha256=D5DZrMzo434ecp8toNxOB5HM193kVwYw42yEcg99yMw,8029
|
|
33
|
-
uiprotect-5.2.
|
|
34
|
-
uiprotect-5.2.
|
|
35
|
-
uiprotect-5.2.
|
|
36
|
-
uiprotect-5.2.
|
|
37
|
-
uiprotect-5.2.
|
|
33
|
+
uiprotect-5.2.2.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
|
|
34
|
+
uiprotect-5.2.2.dist-info/METADATA,sha256=QQDSk2kJVhI26UrCHznBCNmQHzfVXuxL4yuGAOK1fAI,11009
|
|
35
|
+
uiprotect-5.2.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
36
|
+
uiprotect-5.2.2.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
|
|
37
|
+
uiprotect-5.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|