uiprotect 1.6.0__py3-none-any.whl → 1.7.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/base.py +8 -0
- uiprotect/data/bootstrap.py +2 -2
- uiprotect/data/nvr.py +19 -12
- {uiprotect-1.6.0.dist-info → uiprotect-1.7.1.dist-info}/METADATA +1 -1
- {uiprotect-1.6.0.dist-info → uiprotect-1.7.1.dist-info}/RECORD +8 -8
- {uiprotect-1.6.0.dist-info → uiprotect-1.7.1.dist-info}/LICENSE +0 -0
- {uiprotect-1.6.0.dist-info → uiprotect-1.7.1.dist-info}/WHEEL +0 -0
- {uiprotect-1.6.0.dist-info → uiprotect-1.7.1.dist-info}/entry_points.txt +0 -0
uiprotect/data/base.py
CHANGED
|
@@ -745,6 +745,14 @@ class ProtectModelWithId(ProtectModel):
|
|
|
745
745
|
revert_on_fail: bool = True,
|
|
746
746
|
) -> None:
|
|
747
747
|
"""Saves the current device changes to UFP."""
|
|
748
|
+
_LOGGER.debug(
|
|
749
|
+
"Saving device changes for %s (%s) data_before_changes=%s updated=%s",
|
|
750
|
+
self.id,
|
|
751
|
+
self.model,
|
|
752
|
+
data_before_changes,
|
|
753
|
+
updated,
|
|
754
|
+
)
|
|
755
|
+
|
|
748
756
|
assert (
|
|
749
757
|
self._update_lock.locked()
|
|
750
758
|
), "save_device_changes should only be called when the update lock is held"
|
uiprotect/data/bootstrap.py
CHANGED
|
@@ -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
|
-
|
|
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",
|
|
373
|
+
_LOGGER.debug("Unexpected bootstrap model type for add: %s", model_type)
|
|
374
374
|
return None
|
|
375
375
|
|
|
376
376
|
updated = obj.dict()
|
uiprotect/data/nvr.py
CHANGED
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import asyncio
|
|
6
6
|
import logging
|
|
7
7
|
import zoneinfo
|
|
8
|
+
from collections.abc import Callable
|
|
8
9
|
from datetime import datetime, timedelta, tzinfo
|
|
9
10
|
from functools import cache
|
|
10
11
|
from ipaddress import IPv4Address, IPv6Address
|
|
@@ -1169,26 +1170,32 @@ class NVR(ProtectDeviceModel):
|
|
|
1169
1170
|
if message in self.doorbell_settings.custom_messages:
|
|
1170
1171
|
raise BadRequest("Custom doorbell message already exists")
|
|
1171
1172
|
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
)
|
|
1176
|
-
|
|
1177
|
-
self.doorbell_settings.custom_messages.append(DoorbellText(message))
|
|
1178
|
-
await self.save_device(data_before_changes)
|
|
1179
|
-
self.update_all_messages()
|
|
1173
|
+
await self._update_doorbell_messages(
|
|
1174
|
+
lambda: self.doorbell_settings.custom_messages.append(
|
|
1175
|
+
DoorbellText(message)
|
|
1176
|
+
),
|
|
1177
|
+
)
|
|
1180
1178
|
|
|
1181
1179
|
async def remove_custom_doorbell_message(self, message: str) -> None:
|
|
1182
1180
|
"""Removes custom doorbell message"""
|
|
1183
1181
|
if message not in self.doorbell_settings.custom_messages:
|
|
1184
1182
|
raise BadRequest("Custom doorbell message does not exists")
|
|
1185
1183
|
|
|
1184
|
+
await self._update_doorbell_messages(
|
|
1185
|
+
lambda: self.doorbell_settings.custom_messages.remove(
|
|
1186
|
+
DoorbellText(message)
|
|
1187
|
+
),
|
|
1188
|
+
)
|
|
1189
|
+
|
|
1190
|
+
async def _update_doorbell_messages(
|
|
1191
|
+
self, update_callback: Callable[[], None]
|
|
1192
|
+
) -> None:
|
|
1193
|
+
"""Updates doorbell messages and saves to Protect."""
|
|
1186
1194
|
async with self._update_lock:
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
) # yield to the event loop once we have the look to ensure websocket updates are processed
|
|
1195
|
+
# yield to the event loop once we have the lock to ensure websocket updates are processed
|
|
1196
|
+
await asyncio.sleep(0)
|
|
1190
1197
|
data_before_changes = self.dict_with_excludes()
|
|
1191
|
-
|
|
1198
|
+
update_callback()
|
|
1192
1199
|
await self.save_device(data_before_changes)
|
|
1193
1200
|
self.update_all_messages()
|
|
1194
1201
|
|
|
@@ -14,11 +14,11 @@ 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=McmQHwbb-gY2y9IjQ85HVBE6Vo0WkBzcXt6JDw5HijE,37708
|
|
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
|
-
uiprotect/data/nvr.py,sha256=
|
|
21
|
+
uiprotect/data/nvr.py,sha256=XC4NO1c_Mom-hIpzj9ksKFcgKbHd6ToqWjkgzxJ1PJY,47636
|
|
22
22
|
uiprotect/data/types.py,sha256=-hhrnPZheC81eKIJOIZIGCb-A7jOBqa0zLWsmh9_vFQ,17220
|
|
23
23
|
uiprotect/data/user.py,sha256=Wb-ZWSwIJbyUbfVuENtUYbuW-uftHNDcoMH85dvEjkw,7071
|
|
24
24
|
uiprotect/data/websocket.py,sha256=WZJVA7EfYuKYMv-9jmvGgMWXKzE9ES25SKv1NQ2eHjc,6281
|
|
@@ -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.7.1.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
|
|
34
|
+
uiprotect-1.7.1.dist-info/METADATA,sha256=eHSgWjOd86ZiGte16Nes5SRHRILMRdos-M0xWXNZpYI,10984
|
|
35
|
+
uiprotect-1.7.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
36
|
+
uiprotect-1.7.1.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
|
|
37
|
+
uiprotect-1.7.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|