uiprotect 5.1.0__py3-none-any.whl → 5.2.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.

@@ -4,7 +4,6 @@ from __future__ import annotations
4
4
 
5
5
  import asyncio
6
6
  import logging
7
- from copy import deepcopy
8
7
  from dataclasses import dataclass
9
8
  from datetime import datetime
10
9
  from typing import TYPE_CHECKING, Any
@@ -399,7 +398,7 @@ class Bootstrap(ProtectBaseObject):
399
398
  return None
400
399
 
401
400
  old_nvr = self.nvr.copy()
402
- self.nvr = self.nvr.update_from_dict(deepcopy(data))
401
+ self.nvr = self.nvr.update_from_dict(data)
403
402
 
404
403
  return WSSubscriptionMessage(
405
404
  action=WSAction.UPDATE,
@@ -455,7 +454,7 @@ class Bootstrap(ProtectBaseObject):
455
454
  return None
456
455
 
457
456
  old_obj = obj.copy()
458
- obj = obj.update_from_dict(deepcopy(data))
457
+ obj = obj.update_from_dict(data)
459
458
 
460
459
  if model_type is ModelType.EVENT:
461
460
  if TYPE_CHECKING:
uiprotect/data/devices.py CHANGED
@@ -471,6 +471,20 @@ class SmartDetectSettings(ProtectBaseObject):
471
471
  "autoTrackingObjectTypes": convert_smart_types,
472
472
  } | super().unifi_dict_conversions()
473
473
 
474
+ def unifi_dict(
475
+ self,
476
+ data: dict[str, Any] | None = None,
477
+ exclude: set[str] | None = None,
478
+ ) -> dict[str, Any]:
479
+ data = super().unifi_dict(data=data, exclude=exclude)
480
+ if audio_types := data.get("audioTypes"):
481
+ # SMOKE_CMONX is not supported for audio types
482
+ # and should not be sent to the camera
483
+ data["audioTypes"] = [
484
+ t for t in audio_types if t != SmartDetectAudioType.SMOKE_CMONX.value
485
+ ]
486
+ return data
487
+
474
488
 
475
489
  class LCDMessage(ProtectBaseObject):
476
490
  type: DoorbellMessageType
@@ -1090,11 +1104,12 @@ class Camera(ProtectMotionDeviceModel):
1090
1104
  return updated
1091
1105
 
1092
1106
  def update_from_dict(self, data: dict[str, Any]) -> Camera:
1093
- # a message in the past is actually a singal to wipe the message
1094
- reset_at = data.get("lcd_message", {}).get("reset_at")
1095
- if reset_at is not None:
1096
- reset_at = from_js_time(reset_at)
1097
- if utc_now() > reset_at:
1107
+ # a message in the past is actually a signal to wipe the message
1108
+ if (reset_at := data.get("lcd_message", {}).get("reset_at")) is not None:
1109
+ if utc_now() > from_js_time(reset_at):
1110
+ # Important: Make a copy of the data before modifying it
1111
+ # since unifi_dict_to_dict will otherwise report incorrect changes
1112
+ data = data.copy()
1098
1113
  data["lcd_message"] = None
1099
1114
 
1100
1115
  return super().update_from_dict(data)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uiprotect
3
- Version: 5.1.0
3
+ Version: 5.2.1
4
4
  Summary: Python API for Unifi Protect (Unofficial)
5
5
  Home-page: https://github.com/uilibs/uiprotect
6
6
  Author: UI Protect Maintainers
@@ -15,9 +15,9 @@ 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=J2ytJqWJIsFq7vXYG4gfp2c-mrj5gqa3UhmItF0MWbI,35033
18
- uiprotect/data/bootstrap.py,sha256=l1r2eHsjdE6subYAllvdaXOs26-dQDcnrDBxF2fenbI,20500
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=GdoDXVkiIvJQExoe8km94cdLkdESJzhsiWquBswBaqA,109917
20
+ uiprotect/data/devices.py,sha256=qWHcz2MmdE2JjoVow6DFJFG5EOUcu--rq6uRXO1ta88,110584
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
@@ -30,8 +30,8 @@ uiprotect/test_util/__init__.py,sha256=Ky8mTL61nhp5II2mxTKBAsSGvNqK8U_CfKC5AGwTo
30
30
  uiprotect/test_util/anonymize.py,sha256=f-8ijU-_y9r-uAbhIPn0f0I6hzJpAkvJzc8UpWihObI,8478
31
31
  uiprotect/utils.py,sha256=9ny9-GMn5Fpnxaw9i769VTIDp4ntfgiCCItqJYWepns,19769
32
32
  uiprotect/websocket.py,sha256=D5DZrMzo434ecp8toNxOB5HM193kVwYw42yEcg99yMw,8029
33
- uiprotect-5.1.0.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
34
- uiprotect-5.1.0.dist-info/METADATA,sha256=OQVQsAbczGehKhrGAdgPEVikjg7I4hYWNdhRIyE-WJw,11009
35
- uiprotect-5.1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
- uiprotect-5.1.0.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
37
- uiprotect-5.1.0.dist-info/RECORD,,
33
+ uiprotect-5.2.1.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
34
+ uiprotect-5.2.1.dist-info/METADATA,sha256=vRcQPpNodMaeIMJJ3DzBi0ir46vmLkc4HHpIDSKUFvY,11009
35
+ uiprotect-5.2.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
+ uiprotect-5.2.1.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
37
+ uiprotect-5.2.1.dist-info/RECORD,,