uiprotect 1.10.0__py3-none-any.whl → 1.11.1__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/bootstrap.py +22 -20
- {uiprotect-1.10.0.dist-info → uiprotect-1.11.1.dist-info}/METADATA +1 -1
- {uiprotect-1.10.0.dist-info → uiprotect-1.11.1.dist-info}/RECORD +6 -6
- {uiprotect-1.10.0.dist-info → uiprotect-1.11.1.dist-info}/LICENSE +0 -0
- {uiprotect-1.10.0.dist-info → uiprotect-1.11.1.dist-info}/WHEEL +0 -0
- {uiprotect-1.10.0.dist-info → uiprotect-1.11.1.dist-info}/entry_points.txt +0 -0
uiprotect/data/bootstrap.py
CHANGED
|
@@ -8,6 +8,7 @@ from collections.abc import Iterable
|
|
|
8
8
|
from copy import deepcopy
|
|
9
9
|
from dataclasses import dataclass
|
|
10
10
|
from datetime import datetime
|
|
11
|
+
from functools import cache
|
|
11
12
|
from typing import TYPE_CHECKING, Any, cast
|
|
12
13
|
|
|
13
14
|
from aiohttp.client_exceptions import ServerDisconnectedError
|
|
@@ -191,8 +192,11 @@ class Bootstrap(ProtectBaseObject):
|
|
|
191
192
|
api: ProtectApiClient | None = data.get("api") or (
|
|
192
193
|
cls._api if isinstance(cls, ProtectBaseObject) else None
|
|
193
194
|
)
|
|
194
|
-
|
|
195
|
-
|
|
195
|
+
mac_lookup: dict[str, dict[str, str | ModelType]] = {}
|
|
196
|
+
id_lookup: dict[str, dict[str, str | ModelType]] = {}
|
|
197
|
+
data["idLookup"] = id_lookup
|
|
198
|
+
data["macLookup"] = mac_lookup
|
|
199
|
+
|
|
196
200
|
for model_type in ModelType.bootstrap_models_types_set:
|
|
197
201
|
key = model_type.devices_key # type: ignore[attr-defined]
|
|
198
202
|
items: dict[str, ProtectModel] = {}
|
|
@@ -204,16 +208,22 @@ class Bootstrap(ProtectBaseObject):
|
|
|
204
208
|
):
|
|
205
209
|
continue
|
|
206
210
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
211
|
+
id_: str = item["id"]
|
|
212
|
+
ref = {"model": model_type, "id": id_}
|
|
213
|
+
items[id_] = item
|
|
214
|
+
id_lookup[id_] = ref
|
|
210
215
|
if "mac" in item:
|
|
211
216
|
cleaned_mac = normalize_mac(item["mac"])
|
|
212
|
-
|
|
217
|
+
mac_lookup[cleaned_mac] = ref
|
|
213
218
|
data[key] = items
|
|
214
219
|
|
|
215
220
|
return super().unifi_dict_to_dict(data)
|
|
216
221
|
|
|
222
|
+
@classmethod
|
|
223
|
+
@cache
|
|
224
|
+
def _unifi_dict_remove_keys(cls) -> set[str]:
|
|
225
|
+
return {"events", "captureWsStats", "macLookup", "idLookup"}
|
|
226
|
+
|
|
217
227
|
def unifi_dict(
|
|
218
228
|
self,
|
|
219
229
|
data: dict[str, Any] | None = None,
|
|
@@ -221,15 +231,9 @@ class Bootstrap(ProtectBaseObject):
|
|
|
221
231
|
) -> dict[str, Any]:
|
|
222
232
|
data = super().unifi_dict(data=data, exclude=exclude)
|
|
223
233
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
del data["captureWsStats"]
|
|
228
|
-
if "macLookup" in data:
|
|
229
|
-
del data["macLookup"]
|
|
230
|
-
if "idLookup" in data:
|
|
231
|
-
del data["idLookup"]
|
|
232
|
-
|
|
234
|
+
for key in Bootstrap._unifi_dict_remove_keys():
|
|
235
|
+
if key in data:
|
|
236
|
+
del data[key]
|
|
233
237
|
for model_type in ModelType.bootstrap_models_types_set:
|
|
234
238
|
attr = model_type.devices_key # type: ignore[attr-defined]
|
|
235
239
|
if attr in data and isinstance(data[attr], dict):
|
|
@@ -246,8 +250,7 @@ class Bootstrap(ProtectBaseObject):
|
|
|
246
250
|
|
|
247
251
|
@property
|
|
248
252
|
def auth_user(self) -> User:
|
|
249
|
-
|
|
250
|
-
return user
|
|
253
|
+
return self._api.bootstrap.users[self.auth_user_id]
|
|
251
254
|
|
|
252
255
|
@property
|
|
253
256
|
def has_doorbell(self) -> bool:
|
|
@@ -419,14 +422,13 @@ class Bootstrap(ProtectBaseObject):
|
|
|
419
422
|
return None
|
|
420
423
|
|
|
421
424
|
# for another NVR in stack
|
|
422
|
-
nvr_id = packet.action_frame.data.get("id")
|
|
425
|
+
nvr_id: str | None = packet.action_frame.data.get("id")
|
|
423
426
|
if nvr_id and nvr_id != self.nvr.id:
|
|
424
427
|
self._create_stat(packet, None, True)
|
|
425
428
|
return None
|
|
426
429
|
|
|
427
|
-
data = self.nvr.unifi_dict_to_dict(data)
|
|
428
430
|
# nothing left to process
|
|
429
|
-
if not data:
|
|
431
|
+
if not (data := self.nvr.unifi_dict_to_dict(data)):
|
|
430
432
|
self._create_stat(packet, None, True)
|
|
431
433
|
return None
|
|
432
434
|
|
|
@@ -15,7 +15,7 @@ uiprotect/cli/sensors.py,sha256=fQtcDJCVxs4VbAqcavgBy2ABiVxAW3GXtna6_XFBp2k,8153
|
|
|
15
15
|
uiprotect/cli/viewers.py,sha256=2cyrp104ffIvgT0wYGIO0G35QMkEbFe7fSVqLwDXQYQ,2171
|
|
16
16
|
uiprotect/data/__init__.py,sha256=OcfuJl2qXfHcj_mdnrHhzZ5tEIZrw8auziX5IE7dn-I,2938
|
|
17
17
|
uiprotect/data/base.py,sha256=apIXKZHL6dbyXTT4C4lkyo4M-Nf_DwsVXoXBL5jcXVo,37574
|
|
18
|
-
uiprotect/data/bootstrap.py,sha256=
|
|
18
|
+
uiprotect/data/bootstrap.py,sha256=gDoYacz_WOIOSegGoL-kuw3WQdRcDWUYPd1BL8oBZJ8,21515
|
|
19
19
|
uiprotect/data/convert.py,sha256=8h6Il_DhMkPRDPj9F_rA2UZIlTuchS3BQD24peKpk2A,2185
|
|
20
20
|
uiprotect/data/devices.py,sha256=Nq3bOko5PFf5LvEBoD4JV8kmbq50laRdh3VHMWX7t-0,111809
|
|
21
21
|
uiprotect/data/nvr.py,sha256=XC4NO1c_Mom-hIpzj9ksKFcgKbHd6ToqWjkgzxJ1PJY,47636
|
|
@@ -30,8 +30,8 @@ uiprotect/test_util/__init__.py,sha256=d2g7afa0LSdixQ0kjEDYwafDFME_UlW2LzxpamZ2B
|
|
|
30
30
|
uiprotect/test_util/anonymize.py,sha256=f-8ijU-_y9r-uAbhIPn0f0I6hzJpAkvJzc8UpWihObI,8478
|
|
31
31
|
uiprotect/utils.py,sha256=6OLY8hNiCzk418PjJJIlFW7jjPzVt1vxBKEzBSqMeTk,18418
|
|
32
32
|
uiprotect/websocket.py,sha256=IzDPyqbzrkOMREvahN-e2zdvVD0VABSCWy6jSoCwOT0,7299
|
|
33
|
-
uiprotect-1.
|
|
34
|
-
uiprotect-1.
|
|
35
|
-
uiprotect-1.
|
|
36
|
-
uiprotect-1.
|
|
37
|
-
uiprotect-1.
|
|
33
|
+
uiprotect-1.11.1.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
|
|
34
|
+
uiprotect-1.11.1.dist-info/METADATA,sha256=fkeec2n5_8G4aBG4D3zqBu4FJM7Nle4ATE14_bm6neo,10985
|
|
35
|
+
uiprotect-1.11.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
36
|
+
uiprotect-1.11.1.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
|
|
37
|
+
uiprotect-1.11.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|