uiprotect 0.12.0__py3-none-any.whl → 0.13.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.

@@ -131,26 +131,34 @@ def _process_sensor_event(event: Event) -> None:
131
131
  event.sensor.last_value_event_id = event.id
132
132
 
133
133
 
134
+ _CAMERA_SMART_AND_LINE_EVENTS = {
135
+ EventType.SMART_DETECT,
136
+ EventType.SMART_DETECT_LINE,
137
+ }
138
+ _CAMERA_SMART_AUDIO_EVENT = EventType.SMART_AUDIO_DETECT
139
+
140
+
134
141
  def _process_camera_event(event: Event) -> None:
135
- if event.camera is None:
142
+ if (camera := event.camera) is None:
136
143
  return
137
144
 
138
- dt_attr, event_attr = CAMERA_EVENT_ATTR_MAP[event.type]
139
- dt = getattr(event.camera, dt_attr)
145
+ event_type = event.type
146
+ dt_attr, event_attr = CAMERA_EVENT_ATTR_MAP[event_type]
147
+ dt = getattr(camera, dt_attr)
140
148
  if dt is None or event.start >= dt or (event.end is not None and event.end >= dt):
141
- setattr(event.camera, event_attr, event.id)
142
- setattr(event.camera, dt_attr, event.start)
143
- if event.type in {EventType.SMART_DETECT, EventType.SMART_DETECT_LINE}:
149
+ setattr(camera, event_attr, event.id)
150
+ setattr(camera, dt_attr, event.start)
151
+ if event_type in _CAMERA_SMART_AND_LINE_EVENTS:
144
152
  for smart_type in event.smart_detect_types:
145
- event.camera.last_smart_detect_event_ids[smart_type] = event.id
146
- event.camera.last_smart_detects[smart_type] = event.start
147
- elif event.type == EventType.SMART_AUDIO_DETECT:
153
+ camera.last_smart_detect_event_ids[smart_type] = event.id
154
+ camera.last_smart_detects[smart_type] = event.start
155
+ elif event_type is _CAMERA_SMART_AUDIO_EVENT:
148
156
  for smart_type in event.smart_detect_types:
149
157
  audio_type = smart_type.audio_type
150
158
  if audio_type is None:
151
159
  continue
152
- event.camera.last_smart_audio_detect_event_ids[audio_type] = event.id
153
- event.camera.last_smart_audio_detects[audio_type] = event.start
160
+ camera.last_smart_audio_detect_event_ids[audio_type] = event.id
161
+ camera.last_smart_audio_detects[audio_type] = event.start
154
162
 
155
163
 
156
164
  @dataclass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uiprotect
3
- Version: 0.12.0
3
+ Version: 0.13.0
4
4
  Summary: Python API for Unifi Protect (Unofficial)
5
5
  Home-page: https://github.com/uilibs/uiprotect
6
6
  License: MIT
@@ -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=ex-UC9CJUtzxMFqtYokSiXM8pNHVBqCzq7r8WrEf1Mw,37178
18
- uiprotect/data/bootstrap.py,sha256=RcqIiIk8z5QKDMnrWB7ZZDlBouesx2xQGN02wEl-B9s,21416
18
+ uiprotect/data/bootstrap.py,sha256=bev4mrf8LHhh4ZfTP-g_3ZrB1ZPf_dtLl82QvyqOkE0,21543
19
19
  uiprotect/data/convert.py,sha256=rOQplUMIdTMD2SbAx_iI9BNPDscnhDvyRVLEMDhtADg,2047
20
20
  uiprotect/data/devices.py,sha256=LHVBT8ihMAZen7gIlQNbiYxukRrBpi_TNKNmV_5R6Xc,111705
21
21
  uiprotect/data/nvr.py,sha256=OJso6oewA_jY7ovKbD2U2Onp1GqheT5bCW0F6dC53DQ,47570
@@ -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=ItYUrIhCbvdvIO3Q_MI9jQFnFs5OouqfsO_SXWeQZPM,18389
32
32
  uiprotect/websocket.py,sha256=iMTdchymaCgVHsmY1bRbxkcymqt6WQircIHYNxCu178,7289
33
- uiprotect-0.12.0.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
34
- uiprotect-0.12.0.dist-info/METADATA,sha256=13ADAWhiHnb4kCgVFsioRdR_pYLaGG4vDYQzdDfIcU0,10985
35
- uiprotect-0.12.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
- uiprotect-0.12.0.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
37
- uiprotect-0.12.0.dist-info/RECORD,,
33
+ uiprotect-0.13.0.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
34
+ uiprotect-0.13.0.dist-info/METADATA,sha256=iHv0Q0WVlQshNOYhj9owHz_07fWNB4gWhQzt7Lw3Xpk,10985
35
+ uiprotect-0.13.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
+ uiprotect-0.13.0.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
37
+ uiprotect-0.13.0.dist-info/RECORD,,