uiprotect 1.7.0__py3-none-any.whl → 1.7.2__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/base.py CHANGED
@@ -66,6 +66,8 @@ if TYPE_CHECKING:
66
66
  ProtectObject = TypeVar("ProtectObject", bound="ProtectBaseObject")
67
67
  RECENT_EVENT_MAX = timedelta(seconds=30)
68
68
  EVENT_PING_INTERVAL = timedelta(seconds=3)
69
+ EVENT_PING_INTERVAL_SECONDS = EVENT_PING_INTERVAL.total_seconds()
70
+
69
71
  _LOGGER = logging.getLogger(__name__)
70
72
 
71
73
 
@@ -787,10 +789,14 @@ class ProtectModelWithId(ProtectModel):
787
789
  raise
788
790
 
789
791
  if force_emit:
790
- await self.emit_message(updated)
792
+ self._emit_message(updated)
791
793
 
792
794
  async def emit_message(self, updated: dict[str, Any]) -> None:
793
- """Emites fake WS message for ProtectApiClient to process."""
795
+ """Emits fake WS message for ProtectApiClient to process."""
796
+ self._emit_message(updated)
797
+
798
+ def _emit_message(self, updated: dict[str, Any]) -> None:
799
+ """Emits fake WS message for ProtectApiClient to process."""
794
800
  if updated == {}:
795
801
  _LOGGER.debug("Event ping callback started for %s", self.id)
796
802
 
@@ -877,9 +883,9 @@ class ProtectDeviceModel(ProtectModelWithId):
877
883
  _LOGGER.debug("Event ping timer started for %s", self.id)
878
884
  loop = asyncio.get_event_loop()
879
885
  self._callback_ping = loop.call_later(
880
- EVENT_PING_INTERVAL.total_seconds(),
881
- asyncio.create_task,
882
- self.emit_message({}),
886
+ EVENT_PING_INTERVAL_SECONDS,
887
+ self._emit_message,
888
+ {},
883
889
  )
884
890
 
885
891
  async def set_name(self, name: str | None) -> None:
@@ -353,7 +353,7 @@ class Bootstrap(ProtectBaseObject):
353
353
  if TYPE_CHECKING:
354
354
  assert isinstance(obj, Event)
355
355
  self.process_event(obj)
356
- if model_type is ModelType.NVR:
356
+ elif model_type is ModelType.NVR:
357
357
  if TYPE_CHECKING:
358
358
  assert isinstance(obj, NVR)
359
359
  self.nvr = obj
@@ -370,7 +370,7 @@ class Bootstrap(ProtectBaseObject):
370
370
  self.id_lookup[obj.id] = ref
371
371
  self.mac_lookup[normalize_mac(obj.mac)] = ref
372
372
  else:
373
- _LOGGER.debug("Unexpected bootstrap model type for add: %s", obj.model)
373
+ _LOGGER.debug("Unexpected bootstrap model type for add: %s", model_type)
374
374
  return None
375
375
 
376
376
  updated = obj.dict()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uiprotect
3
- Version: 1.7.0
3
+ Version: 1.7.2
4
4
  Summary: Python API for Unifi Protect (Unofficial)
5
5
  Home-page: https://github.com/uilibs/uiprotect
6
6
  License: MIT
@@ -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=McmQHwbb-gY2y9IjQ85HVBE6Vo0WkBzcXt6JDw5HijE,37708
18
- uiprotect/data/bootstrap.py,sha256=INRUEbLWnsEJuzlcoFlm7RAT-WPx6odje3aD092QKGo,21465
17
+ uiprotect/data/base.py,sha256=mC-Nsr9xWSy7oshIOxgo5qQCjfYZutFQWIjTY39w2sQ,37909
18
+ uiprotect/data/bootstrap.py,sha256=UxDAo8hz-Rh8XvgfYvUslrWelGFZ5JQ6bnixT4wKJR0,21468
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.7.0.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
34
- uiprotect-1.7.0.dist-info/METADATA,sha256=vzHyVx6DDhJCUu03RWBahUFumcx854dPYB_SQMwGztk,10984
35
- uiprotect-1.7.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
- uiprotect-1.7.0.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
37
- uiprotect-1.7.0.dist-info/RECORD,,
33
+ uiprotect-1.7.2.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
34
+ uiprotect-1.7.2.dist-info/METADATA,sha256=yw8NXd8D4F6yKONwFd-HxZaDrAxZ38Q7Nw_kXHn2-6Y,10984
35
+ uiprotect-1.7.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
+ uiprotect-1.7.2.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
37
+ uiprotect-1.7.2.dist-info/RECORD,,