uiprotect 3.7.0__py3-none-any.whl → 3.8.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.
- uiprotect/api.py +0 -1
- uiprotect/data/base.py +1 -1
- uiprotect/data/bootstrap.py +19 -16
- uiprotect/utils.py +8 -5
- {uiprotect-3.7.0.dist-info → uiprotect-3.8.0.dist-info}/METADATA +1 -1
- {uiprotect-3.7.0.dist-info → uiprotect-3.8.0.dist-info}/RECORD +9 -9
- {uiprotect-3.7.0.dist-info → uiprotect-3.8.0.dist-info}/LICENSE +0 -0
- {uiprotect-3.7.0.dist-info → uiprotect-3.8.0.dist-info}/WHEEL +0 -0
- {uiprotect-3.7.0.dist-info → uiprotect-3.8.0.dist-info}/entry_points.txt +0 -0
uiprotect/api.py
CHANGED
uiprotect/data/base.py
CHANGED
|
@@ -647,7 +647,7 @@ class ProtectModelWithId(ProtectModel):
|
|
|
647
647
|
await self._update_sync.event.wait()
|
|
648
648
|
self._update_sync.event.clear()
|
|
649
649
|
return
|
|
650
|
-
except (TimeoutError, asyncio.TimeoutError
|
|
650
|
+
except (TimeoutError, asyncio.TimeoutError):
|
|
651
651
|
async with self._update_sync.lock:
|
|
652
652
|
# Important! Now that we have the lock, we yield to the event loop so any
|
|
653
653
|
# updates from the websocket are processed before we generate the diff
|
uiprotect/data/bootstrap.py
CHANGED
|
@@ -560,34 +560,38 @@ class Bootstrap(ProtectBaseObject):
|
|
|
560
560
|
model_type, action, data, ignore_stats, is_ping_back
|
|
561
561
|
)
|
|
562
562
|
except (ValidationError, ValueError) as err:
|
|
563
|
-
self._handle_ws_error(action, err)
|
|
563
|
+
self._handle_ws_error(action_action, model_type, action, err)
|
|
564
564
|
|
|
565
565
|
_LOGGER.debug(
|
|
566
566
|
"Unexpected bootstrap model type deviceadoptedfor update: %s", model_key
|
|
567
567
|
)
|
|
568
568
|
return None
|
|
569
569
|
|
|
570
|
-
def _handle_ws_error(
|
|
570
|
+
def _handle_ws_error(
|
|
571
|
+
self,
|
|
572
|
+
action_action: str,
|
|
573
|
+
model_type: ModelType,
|
|
574
|
+
action: dict[str, Any],
|
|
575
|
+
err: Exception,
|
|
576
|
+
) -> None:
|
|
571
577
|
msg = ""
|
|
572
|
-
|
|
573
|
-
|
|
578
|
+
device_id: str = action["id"]
|
|
579
|
+
if model_type is ModelType.EVENT:
|
|
580
|
+
msg = f"Validation error processing event: {device_id}. Ignoring event."
|
|
574
581
|
else:
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
msg = f"{action['action']} packet caused invalid state. Unable to refresh device."
|
|
583
|
-
else:
|
|
584
|
-
msg = f"{action['action']} packet caused invalid state. Refreshing device: {model_type} {device_id}"
|
|
582
|
+
task = asyncio.create_task(self.refresh_device(model_type, device_id))
|
|
583
|
+
self._refresh_tasks.add(task)
|
|
584
|
+
task.add_done_callback(self._refresh_tasks.discard)
|
|
585
|
+
msg = (
|
|
586
|
+
f"{action_action} packet caused invalid state. "
|
|
587
|
+
f"Refreshing device: {model_type} {device_id}"
|
|
588
|
+
)
|
|
585
589
|
_LOGGER.debug("%s Error: %s", msg, err)
|
|
586
590
|
|
|
587
591
|
async def refresh_device(self, model_type: ModelType, device_id: str) -> None:
|
|
588
592
|
"""Refresh a device in the bootstrap."""
|
|
589
593
|
try:
|
|
590
|
-
if model_type
|
|
594
|
+
if model_type is ModelType.NVR:
|
|
591
595
|
device: ProtectModelWithId = await self._api.get_nvr()
|
|
592
596
|
else:
|
|
593
597
|
device = await self._api.get_device(model_type, device_id)
|
|
@@ -595,7 +599,6 @@ class Bootstrap(ProtectBaseObject):
|
|
|
595
599
|
ValidationError,
|
|
596
600
|
TimeoutError,
|
|
597
601
|
asyncio.TimeoutError,
|
|
598
|
-
asyncio.CancelledError,
|
|
599
602
|
ClientError,
|
|
600
603
|
ServerDisconnectedError,
|
|
601
604
|
):
|
uiprotect/utils.py
CHANGED
|
@@ -201,11 +201,14 @@ def to_camel_case(name: str) -> str:
|
|
|
201
201
|
return name
|
|
202
202
|
|
|
203
203
|
|
|
204
|
+
_EMPTY_UUID = UUID("0" * 32)
|
|
205
|
+
|
|
206
|
+
|
|
204
207
|
def convert_unifi_data(value: Any, field: ModelField) -> Any:
|
|
205
208
|
"""Converts value from UFP data into pydantic field class"""
|
|
206
209
|
type_ = field.type_
|
|
207
210
|
|
|
208
|
-
if type_
|
|
211
|
+
if type_ is Any:
|
|
209
212
|
return value
|
|
210
213
|
|
|
211
214
|
shape = field.shape
|
|
@@ -222,7 +225,7 @@ def convert_unifi_data(value: Any, field: ModelField) -> Any:
|
|
|
222
225
|
return ip_address(value)
|
|
223
226
|
except ValueError:
|
|
224
227
|
return value
|
|
225
|
-
if type_
|
|
228
|
+
if type_ is datetime:
|
|
226
229
|
return from_js_time(value)
|
|
227
230
|
if type_ in _CREATE_TYPES or _is_enum_type(type_):
|
|
228
231
|
# cannot do this check too soon because some types cannot be used in isinstance
|
|
@@ -230,8 +233,8 @@ def convert_unifi_data(value: Any, field: ModelField) -> Any:
|
|
|
230
233
|
return value
|
|
231
234
|
# handle edge case for improperly formatted UUIDs
|
|
232
235
|
# 00000000-0000-00 0- 000-000000000000
|
|
233
|
-
if type_
|
|
234
|
-
|
|
236
|
+
if type_ is UUID and value == _BAD_UUID:
|
|
237
|
+
return _EMPTY_UUID
|
|
235
238
|
return type_(value)
|
|
236
239
|
|
|
237
240
|
return value
|
|
@@ -574,7 +577,7 @@ def log_event(event: Event) -> None:
|
|
|
574
577
|
)
|
|
575
578
|
smart_settings = camera.smart_detect_settings
|
|
576
579
|
for smart_type in event.smart_detect_types:
|
|
577
|
-
is_audio = event.type
|
|
580
|
+
is_audio = event.type is EventType.SMART_AUDIO_DETECT
|
|
578
581
|
if is_audio:
|
|
579
582
|
if smart_type.audio_type is None:
|
|
580
583
|
return
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
uiprotect/__init__.py,sha256=UdpRSSLSy7pdDfTKf0zRIfy6KRGt_Jv-fMzYWgibbG4,686
|
|
2
2
|
uiprotect/__main__.py,sha256=C_bHCOkv5qj6WMy-6ELoY3Y6HDhLxOa1a30CzmbZhsg,462
|
|
3
|
-
uiprotect/api.py,sha256=
|
|
3
|
+
uiprotect/api.py,sha256=8zfSeqDKArG2pbvImqibQx4HrMi_y06fYXrgcwYztCc,67585
|
|
4
4
|
uiprotect/cli/__init__.py,sha256=1MO8rJmjjAsfVx2x01gn5DJo8B64xdPGo6gRVJbWd18,8868
|
|
5
5
|
uiprotect/cli/backup.py,sha256=ZiS7RZnJGKI8TJKLW2cOUzkRM8nyTvE5Ov_jZZGtvSM,36708
|
|
6
6
|
uiprotect/cli/base.py,sha256=k-_qGuNT7br0iV0KE5F4wYXF75iyLLjBEckTqxC71xM,7591
|
|
@@ -14,8 +14,8 @@ uiprotect/cli/nvr.py,sha256=TwxEg2XT8jXAbOqv6gc7KFXELKadeItEDYweSL4_-e8,4260
|
|
|
14
14
|
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
|
-
uiprotect/data/base.py,sha256=
|
|
18
|
-
uiprotect/data/bootstrap.py,sha256=
|
|
17
|
+
uiprotect/data/base.py,sha256=fSD5H3jAp8M-0VbvOsFkohJwbzuUaytQxxF4nbWOVKg,35122
|
|
18
|
+
uiprotect/data/bootstrap.py,sha256=DQ25j2h3AZWv52kM0dF8_kU73INmZDEMiEvSoE_CvZQ,20981
|
|
19
19
|
uiprotect/data/convert.py,sha256=8h6Il_DhMkPRDPj9F_rA2UZIlTuchS3BQD24peKpk2A,2185
|
|
20
20
|
uiprotect/data/devices.py,sha256=DrHjLmIbkOneWSMoqN6W8EL9zdspY8YM2RM8_dHA2RI,110185
|
|
21
21
|
uiprotect/data/nvr.py,sha256=kPEfFNi_gQHLBEA1JOgTjfnDb6BuPDDjZy6PMzLPR60,46749
|
|
@@ -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=whiOUb5LfDLNT3AQG6ISiKtAqO2JnhCIdFavhWDK46M,18718
|
|
30
30
|
uiprotect/test_util/anonymize.py,sha256=f-8ijU-_y9r-uAbhIPn0f0I6hzJpAkvJzc8UpWihObI,8478
|
|
31
|
-
uiprotect/utils.py,sha256=
|
|
31
|
+
uiprotect/utils.py,sha256=G0WkMXpCky2Cc4jynFDFFxAcVaZX4F01OXKa6cx9pho,20121
|
|
32
32
|
uiprotect/websocket.py,sha256=D5DZrMzo434ecp8toNxOB5HM193kVwYw42yEcg99yMw,8029
|
|
33
|
-
uiprotect-3.
|
|
34
|
-
uiprotect-3.
|
|
35
|
-
uiprotect-3.
|
|
36
|
-
uiprotect-3.
|
|
37
|
-
uiprotect-3.
|
|
33
|
+
uiprotect-3.8.0.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
|
|
34
|
+
uiprotect-3.8.0.dist-info/METADATA,sha256=AEGF6orwjbmm9wVo992183me_Rhl5Nyk6Uz0BNaETlA,10969
|
|
35
|
+
uiprotect-3.8.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
36
|
+
uiprotect-3.8.0.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
|
|
37
|
+
uiprotect-3.8.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|