uiprotect 6.4.0__tar.gz → 6.6.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.

Files changed (37) hide show
  1. {uiprotect-6.4.0 → uiprotect-6.6.0}/PKG-INFO +1 -1
  2. {uiprotect-6.4.0 → uiprotect-6.6.0}/pyproject.toml +3 -3
  3. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/data/bootstrap.py +8 -0
  4. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/data/devices.py +32 -0
  5. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/data/nvr.py +29 -0
  6. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/data/types.py +4 -0
  7. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/websocket.py +5 -1
  8. {uiprotect-6.4.0 → uiprotect-6.6.0}/LICENSE +0 -0
  9. {uiprotect-6.4.0 → uiprotect-6.6.0}/README.md +0 -0
  10. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/__init__.py +0 -0
  11. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/__main__.py +0 -0
  12. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/_compat.py +0 -0
  13. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/api.py +0 -0
  14. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/__init__.py +0 -0
  15. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/backup.py +0 -0
  16. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/base.py +0 -0
  17. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/cameras.py +0 -0
  18. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/chimes.py +0 -0
  19. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/doorlocks.py +0 -0
  20. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/events.py +0 -0
  21. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/lights.py +0 -0
  22. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/liveviews.py +0 -0
  23. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/nvr.py +0 -0
  24. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/sensors.py +0 -0
  25. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/cli/viewers.py +0 -0
  26. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/data/__init__.py +0 -0
  27. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/data/base.py +0 -0
  28. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/data/convert.py +0 -0
  29. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/data/user.py +0 -0
  30. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/data/websocket.py +0 -0
  31. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/exceptions.py +0 -0
  32. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/py.typed +0 -0
  33. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/release_cache.json +0 -0
  34. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/stream.py +0 -0
  35. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/test_util/__init__.py +0 -0
  36. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/test_util/anonymize.py +0 -0
  37. {uiprotect-6.4.0 → uiprotect-6.6.0}/src/uiprotect/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uiprotect
3
- Version: 6.4.0
3
+ Version: 6.6.0
4
4
  Summary: Python API for Unifi Protect (Unofficial)
5
5
  Home-page: https://github.com/uilibs/uiprotect
6
6
  Author: UI Protect Maintainers
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "uiprotect"
3
- version = "6.4.0"
3
+ version = "6.6.0"
4
4
  description = "Python API for Unifi Protect (Unofficial)"
5
5
  authors = ["UI Protect Maintainers <ui@koston.org>"]
6
6
  readme = "README.md"
@@ -50,7 +50,7 @@ propcache = ">=0.0.0"
50
50
 
51
51
  [tool.poetry.group.dev.dependencies]
52
52
  pytest = ">=7,<9"
53
- pytest-cov = ">=3,<6"
53
+ pytest-cov = ">=3,<7"
54
54
  aiosqlite = ">=0.20.0"
55
55
  asttokens = "^2.4.1"
56
56
  pytest-asyncio = ">=0.23.7,<0.25.0"
@@ -76,7 +76,7 @@ mkdocs-material-extensions = "^1.3.1"
76
76
  pymdown-extensions = "^10.8.1"
77
77
  mkdocs-git-revision-date-localized-plugin = "^1.2.6"
78
78
  mkdocs-include-markdown-plugin = "^6.1.1"
79
- mkdocstrings = ">=0.25.1,<0.27.0"
79
+ mkdocstrings = ">=0.25.1,<0.28.0"
80
80
  mkdocstrings-python = "^1.10.3"
81
81
 
82
82
  [tool.semantic_release]
@@ -98,6 +98,14 @@ CAMERA_EVENT_ATTR_MAP: dict[EventType, tuple[str, str]] = {
98
98
  "last_smart_audio_detect_event_id",
99
99
  ),
100
100
  EventType.RING: ("last_ring", "last_ring_event_id"),
101
+ EventType.NFC_CARD_SCANNED: (
102
+ "last_nfc_card_scanned",
103
+ "last_nfc_card_scanned_event_id",
104
+ ),
105
+ EventType.FINGERPRINT_IDENTIFIED: (
106
+ "last_fingerprint_identified",
107
+ "last_fingerprint_identified_event_id",
108
+ ),
101
109
  }
102
110
 
103
111
 
@@ -859,6 +859,9 @@ class CameraFeatureFlags(ProtectBaseObject):
859
859
  has_vertical_flip: bool | None = None
860
860
  # 3.0.22+
861
861
  flash_range: Any | None = None
862
+ # 4.73.71+
863
+ support_nfc: bool | None = None
864
+ has_fingerprint_sensor: bool | None = None
862
865
 
863
866
  focus: PTZRange
864
867
  pan: PTZRange
@@ -998,6 +1001,10 @@ class Camera(ProtectMotionDeviceModel):
998
1001
 
999
1002
  # not directly from UniFi
1000
1003
  last_ring_event_id: str | None = None
1004
+ last_nfc_card_scanned_event_id: str | None = None
1005
+ last_nfc_card_scanned: datetime | None = None
1006
+ last_fingerprint_identified_event_id: str | None = None
1007
+ last_fingerprint_identified: datetime | None = None
1001
1008
  last_smart_detect: datetime | None = None
1002
1009
  last_smart_audio_detect: datetime | None = None
1003
1010
  last_smart_detect_event_id: str | None = None
@@ -1018,6 +1025,10 @@ class Camera(ProtectMotionDeviceModel):
1018
1025
  def _get_excluded_changed_fields(cls) -> set[str]:
1019
1026
  return super()._get_excluded_changed_fields() | {
1020
1027
  "last_ring_event_id",
1028
+ "last_nfc_card_scanned",
1029
+ "last_nfc_card_scanned_event_id",
1030
+ "last_fingerprint_identified",
1031
+ "last_fingerprint_identified_event_id",
1021
1032
  "last_smart_detect",
1022
1033
  "last_smart_audio_detect",
1023
1034
  "last_smart_detect_event_id",
@@ -1086,6 +1097,10 @@ class Camera(ProtectMotionDeviceModel):
1086
1097
  pop_dict_tuple(
1087
1098
  data,
1088
1099
  (
1100
+ "lastFingerprintIdentified",
1101
+ "lastFingerprintIdentifiedEventId",
1102
+ "lastNfcCardScanned",
1103
+ "lastNfcCardScannedEventId",
1089
1104
  "lastRingEventId",
1090
1105
  "lastSmartDetect",
1091
1106
  "lastSmartAudioDetect",
@@ -1148,6 +1163,23 @@ class Camera(ProtectMotionDeviceModel):
1148
1163
  return None
1149
1164
  return self._api.bootstrap.events.get(last_smart_detect_event_id)
1150
1165
 
1166
+ @property
1167
+ def last_nfc_card_scanned_event(self) -> Event | None:
1168
+ if (
1169
+ last_nfc_card_scanned_event_id := self.last_nfc_card_scanned_event_id
1170
+ ) is None:
1171
+ return None
1172
+ return self._api.bootstrap.events.get(last_nfc_card_scanned_event_id)
1173
+
1174
+ @property
1175
+ def last_fingerprint_identified_event(self) -> Event | None:
1176
+ if (
1177
+ last_fingerprint_identified_event_id
1178
+ := self.last_fingerprint_identified_event_id
1179
+ ) is None:
1180
+ return None
1181
+ return self._api.bootstrap.events.get(last_fingerprint_identified_event_id)
1182
+
1151
1183
  @property
1152
1184
  def hdr_mode_display(self) -> Literal["auto", "off", "always"]:
1153
1185
  """Get HDR mode similar to how Protect interface works."""
@@ -136,6 +136,32 @@ class EventThumbnailAttribute(ProtectBaseObject):
136
136
  val: str
137
137
 
138
138
 
139
+ class NfcMetadata(ProtectBaseObject):
140
+ nfc_id: str
141
+ user_id: str
142
+
143
+ @classmethod
144
+ @cache
145
+ def _get_unifi_remaps(cls) -> dict[str, str]:
146
+ return {
147
+ **super()._get_unifi_remaps(),
148
+ "nfcId": "nfc_id",
149
+ "userId": "user_id",
150
+ }
151
+
152
+
153
+ class FingerprintMetadata(ProtectBaseObject):
154
+ ulp_id: str | None = None
155
+
156
+ @classmethod
157
+ @cache
158
+ def _get_unifi_remaps(cls) -> dict[str, str]:
159
+ return {
160
+ **super()._get_unifi_remaps(),
161
+ "ulpId": "ulp_id",
162
+ }
163
+
164
+
139
165
  class EventThumbnailAttributes(ProtectBaseObject):
140
166
  color: EventThumbnailAttribute | None = None
141
167
  vehicle_type: EventThumbnailAttribute | None = None
@@ -195,6 +221,9 @@ class EventMetadata(ProtectBaseObject):
195
221
  license_plate: LicensePlateMetadata | None = None
196
222
  # requires 2.11.13+
197
223
  detected_thumbnails: list[EventDetectedThumbnail] | None = None
224
+ # requires 5.1.34+
225
+ nfc: NfcMetadata | None = None
226
+ fingerprint: FingerprintMetadata | None = None
198
227
 
199
228
  _collapse_keys: ClassVar[SetStr] = {
200
229
  "lightId",
@@ -201,6 +201,8 @@ class EventType(str, ValuesEnumMixin, enum.Enum):
201
201
  POOR_CONNECTION = "poorConnection"
202
202
  STREAM_RECOVERY = "streamRecovery"
203
203
  MOTION = "motion"
204
+ NFC_CARD_SCANNED = "nfcCardScanned"
205
+ FINGERPRINT_IDENTIFIED = "fingerprintIdentified"
204
206
  RECORDING_DELETED = "recordingDeleted"
205
207
  SMART_AUDIO_DETECT = "smartAudioDetect"
206
208
  SMART_DETECT = "smartDetectZone"
@@ -274,6 +276,8 @@ class EventType(str, ValuesEnumMixin, enum.Enum):
274
276
  def device_events() -> list[str]:
275
277
  return [
276
278
  EventType.MOTION.value,
279
+ EventType.NFC_CARD_SCANNED.value,
280
+ EventType.FINGERPRINT_IDENTIFIED.value,
277
281
  EventType.RING.value,
278
282
  EventType.SMART_DETECT.value,
279
283
  EventType.SMART_AUDIO_DETECT.value,
@@ -10,6 +10,7 @@ from enum import Enum
10
10
  from http import HTTPStatus
11
11
  from typing import Any, Optional
12
12
 
13
+ import aiohttp
13
14
  from aiohttp import (
14
15
  ClientError,
15
16
  ClientSession,
@@ -125,7 +126,10 @@ class Websocket:
125
126
  # catch any and all errors for Websocket so we can clean up correctly
126
127
  try:
127
128
  self._ws_connection = await session.ws_connect(
128
- url, ssl=self.verify, headers=self._headers, timeout=self.timeout
129
+ url,
130
+ ssl=self.verify,
131
+ headers=self._headers,
132
+ timeout=aiohttp.ClientWSTimeout(ws_close=self.timeout),
129
133
  )
130
134
  while True:
131
135
  msg = await self._ws_connection.receive(self.receive_timeout)
File without changes
File without changes