uiprotect 6.4.0__py3-none-any.whl → 6.5.0__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.

@@ -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
 
uiprotect/data/devices.py CHANGED
@@ -998,6 +998,10 @@ class Camera(ProtectMotionDeviceModel):
998
998
 
999
999
  # not directly from UniFi
1000
1000
  last_ring_event_id: str | None = None
1001
+ last_nfc_card_scanned_event_id: str | None = None
1002
+ last_nfc_card_scanned: datetime | None = None
1003
+ last_fingerprint_identified_event_id: str | None = None
1004
+ last_fingerprint_identified: datetime | None = None
1001
1005
  last_smart_detect: datetime | None = None
1002
1006
  last_smart_audio_detect: datetime | None = None
1003
1007
  last_smart_detect_event_id: str | None = None
@@ -1018,6 +1022,10 @@ class Camera(ProtectMotionDeviceModel):
1018
1022
  def _get_excluded_changed_fields(cls) -> set[str]:
1019
1023
  return super()._get_excluded_changed_fields() | {
1020
1024
  "last_ring_event_id",
1025
+ "last_nfc_card_scanned",
1026
+ "last_nfc_card_scanned_event_id",
1027
+ "last_fingerprint_identified",
1028
+ "last_fingerprint_identified_event_id",
1021
1029
  "last_smart_detect",
1022
1030
  "last_smart_audio_detect",
1023
1031
  "last_smart_detect_event_id",
@@ -1086,6 +1094,10 @@ class Camera(ProtectMotionDeviceModel):
1086
1094
  pop_dict_tuple(
1087
1095
  data,
1088
1096
  (
1097
+ "lastFingerprintIdentified",
1098
+ "lastFingerprintIdentifiedEventId",
1099
+ "lastNfcCardScanned",
1100
+ "lastNfcCardScannedEventId",
1089
1101
  "lastRingEventId",
1090
1102
  "lastSmartDetect",
1091
1103
  "lastSmartAudioDetect",
@@ -1148,6 +1160,23 @@ class Camera(ProtectMotionDeviceModel):
1148
1160
  return None
1149
1161
  return self._api.bootstrap.events.get(last_smart_detect_event_id)
1150
1162
 
1163
+ @property
1164
+ def last_nfc_card_scanned_event(self) -> Event | None:
1165
+ if (
1166
+ last_nfc_card_scanned_event_id := self.last_nfc_card_scanned_event_id
1167
+ ) is None:
1168
+ return None
1169
+ return self._api.bootstrap.events.get(last_nfc_card_scanned_event_id)
1170
+
1171
+ @property
1172
+ def last_fingerprint_identified_event(self) -> Event | None:
1173
+ if (
1174
+ last_fingerprint_identified_event_id
1175
+ := self.last_fingerprint_identified_event_id
1176
+ ) is None:
1177
+ return None
1178
+ return self._api.bootstrap.events.get(last_fingerprint_identified_event_id)
1179
+
1151
1180
  @property
1152
1181
  def hdr_mode_display(self) -> Literal["auto", "off", "always"]:
1153
1182
  """Get HDR mode similar to how Protect interface works."""
uiprotect/data/nvr.py CHANGED
@@ -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",
uiprotect/data/types.py CHANGED
@@ -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,
uiprotect/websocket.py CHANGED
@@ -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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uiprotect
3
- Version: 6.4.0
3
+ Version: 6.5.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
@@ -16,11 +16,11 @@ uiprotect/cli/sensors.py,sha256=fQtcDJCVxs4VbAqcavgBy2ABiVxAW3GXtna6_XFBp2k,8153
16
16
  uiprotect/cli/viewers.py,sha256=2cyrp104ffIvgT0wYGIO0G35QMkEbFe7fSVqLwDXQYQ,2171
17
17
  uiprotect/data/__init__.py,sha256=OcfuJl2qXfHcj_mdnrHhzZ5tEIZrw8auziX5IE7dn-I,2938
18
18
  uiprotect/data/base.py,sha256=sn7IHKQN96uiZL6ImN1gdCHV97EpUmy-X7xWTUAtWsg,35054
19
- uiprotect/data/bootstrap.py,sha256=OSPHu08p7Ys9KqEb8sq_LFufuECtF4lY7OnAYK27ngo,20454
19
+ uiprotect/data/bootstrap.py,sha256=iROUw-pPdJpytaV8Dg5peOJotI7jidXJABsEzCQGid8,20704
20
20
  uiprotect/data/convert.py,sha256=8h6Il_DhMkPRDPj9F_rA2UZIlTuchS3BQD24peKpk2A,2185
21
- uiprotect/data/devices.py,sha256=O6rktT5HVKmq7KMTeDODsXYBvBKlu-J7l5-Wh-d1xCU,111345
22
- uiprotect/data/nvr.py,sha256=8M-62AG4q1k71eX-DaFcdO52QWG4zO9X5Voj0Tj9D5A,46598
23
- uiprotect/data/types.py,sha256=neimaKagTYMryaSaMS9hoqJYPHbwPi9M058HgJ9DNjM,18331
21
+ uiprotect/data/devices.py,sha256=ujgTatrg4qSSwB8_ohFi8u-8XTUxQQZPse7ir7sidak,112539
22
+ uiprotect/data/nvr.py,sha256=FGI0eIAyy3Zy9kaxcr67HxwaVCUU8wq3oZyWvoDq7Sg,47251
23
+ uiprotect/data/types.py,sha256=PA9YOEJCmh9DAlJajHh2Y6hi4aTjlQ8LhWN8ZH5x7Fc,18522
24
24
  uiprotect/data/user.py,sha256=1o5gyPHafn4lHARpoSMD_NWbo5IbzGPfiSASwqqDvWs,7002
25
25
  uiprotect/data/websocket.py,sha256=m4EV1Qfh08eKOihy70ycViYgEQpeNSGZQJWdtGIYJDA,6791
26
26
  uiprotect/exceptions.py,sha256=kgn0cRM6lTtgLza09SDa3ZiX6ue1QqHCOogQ4qu6KTQ,965
@@ -30,9 +30,9 @@ uiprotect/stream.py,sha256=MWiTRFIhUfFLPA_csSrKl5-SkUbPZ2VhDu0XW2oVr-U,4800
30
30
  uiprotect/test_util/__init__.py,sha256=Ky8mTL61nhp5II2mxTKBAsSGvNqK8U_CfKC5AGwToAI,18704
31
31
  uiprotect/test_util/anonymize.py,sha256=f-8ijU-_y9r-uAbhIPn0f0I6hzJpAkvJzc8UpWihObI,8478
32
32
  uiprotect/utils.py,sha256=jIWT7n_reL90oY91svBfQ4naRxo28qHzP5jNOL12mQE,20342
33
- uiprotect/websocket.py,sha256=xCeEGB49IIBoAh1S8dqi6e8GM-SH66joTkf1BItq9vY,8093
34
- uiprotect-6.4.0.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
35
- uiprotect-6.4.0.dist-info/METADATA,sha256=L4N3ZuvNpc0VA8mRu6pkVUWT8nxLDqnIp9C-j3NYvhY,11096
36
- uiprotect-6.4.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
37
- uiprotect-6.4.0.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
38
- uiprotect-6.4.0.dist-info/RECORD,,
33
+ uiprotect/websocket.py,sha256=tEyenqblNXHcjWYuf4oRP1E7buNwx6zoECMwpBr-jig,8191
34
+ uiprotect-6.5.0.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
35
+ uiprotect-6.5.0.dist-info/METADATA,sha256=olYKKxpBw8-Pcb3KJHKV_UP718ShAuyKf4UAUEzXp50,11096
36
+ uiprotect-6.5.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
37
+ uiprotect-6.5.0.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
38
+ uiprotect-6.5.0.dist-info/RECORD,,