pyezvizapi 1.0.2.6__py3-none-any.whl → 1.0.2.8__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 pyezvizapi might be problematic. Click here for more details.
- pyezvizapi/api_endpoints.py +1 -0
- pyezvizapi/client.py +77 -0
- {pyezvizapi-1.0.2.6.dist-info → pyezvizapi-1.0.2.8.dist-info}/METADATA +1 -1
- {pyezvizapi-1.0.2.6.dist-info → pyezvizapi-1.0.2.8.dist-info}/RECORD +9 -9
- {pyezvizapi-1.0.2.6.dist-info → pyezvizapi-1.0.2.8.dist-info}/WHEEL +0 -0
- {pyezvizapi-1.0.2.6.dist-info → pyezvizapi-1.0.2.8.dist-info}/entry_points.txt +0 -0
- {pyezvizapi-1.0.2.6.dist-info → pyezvizapi-1.0.2.8.dist-info}/licenses/LICENSE +0 -0
- {pyezvizapi-1.0.2.6.dist-info → pyezvizapi-1.0.2.8.dist-info}/licenses/LICENSE.md +0 -0
- {pyezvizapi-1.0.2.6.dist-info → pyezvizapi-1.0.2.8.dist-info}/top_level.txt +0 -0
pyezvizapi/api_endpoints.py
CHANGED
|
@@ -37,6 +37,7 @@ API_ENDPOINT_DEVICE_BASICS = "/v3/basics/v1/devices/"
|
|
|
37
37
|
|
|
38
38
|
API_ENDPOINT_DETECTION_SENSIBILITY = "/api/device/configAlgorithm"
|
|
39
39
|
API_ENDPOINT_DETECTION_SENSIBILITY_GET = "/api/device/queryAlgorithmConfig"
|
|
40
|
+
API_ENDPOINT_SENSITIVITY = "/v3/devconfig/v1/sensitivity/"
|
|
40
41
|
API_ENDPOINT_SET_DEFENCE_SCHEDULE = "/api/device/defence/plan2"
|
|
41
42
|
API_ENDPOINT_CAM_ENCRYPTKEY = "/api/device/query/encryptkey"
|
|
42
43
|
API_ENDPOINT_OFFLINE_NOTIFY = "/api/device/notify/switch"
|
pyezvizapi/client.py
CHANGED
|
@@ -46,6 +46,7 @@ from .api_endpoints import (
|
|
|
46
46
|
API_ENDPOINT_REMOTE_UNLOCK,
|
|
47
47
|
API_ENDPOINT_RETURN_PANORAMIC,
|
|
48
48
|
API_ENDPOINT_SEND_CODE,
|
|
49
|
+
API_ENDPOINT_SENSITIVITY,
|
|
49
50
|
API_ENDPOINT_SERVER_INFO,
|
|
50
51
|
API_ENDPOINT_SET_DEFENCE_SCHEDULE,
|
|
51
52
|
API_ENDPOINT_SET_LUMINANCE,
|
|
@@ -1760,6 +1761,51 @@ class EzvizClient:
|
|
|
1760
1761
|
|
|
1761
1762
|
return True
|
|
1762
1763
|
|
|
1764
|
+
def _resolve_resource_id(self, serial: str, resource_id: str | None) -> str:
|
|
1765
|
+
"""Resolve the intelligent app resource id for a given camera."""
|
|
1766
|
+
|
|
1767
|
+
if resource_id:
|
|
1768
|
+
return resource_id
|
|
1769
|
+
|
|
1770
|
+
camera = self._cameras.get(serial)
|
|
1771
|
+
if not camera:
|
|
1772
|
+
raise PyEzvizError(
|
|
1773
|
+
f"Unknown camera serial {serial}. Call load_devices/load_cameras first"
|
|
1774
|
+
)
|
|
1775
|
+
|
|
1776
|
+
resource_infos = camera.get("resourceInfos") or []
|
|
1777
|
+
for item in resource_infos:
|
|
1778
|
+
if isinstance(item, dict) and item.get("resourceId"):
|
|
1779
|
+
return cast(str, item["resourceId"])
|
|
1780
|
+
|
|
1781
|
+
legacy = camera.get("resouceid") or camera.get("resource_id")
|
|
1782
|
+
if isinstance(legacy, str) and legacy:
|
|
1783
|
+
return legacy
|
|
1784
|
+
|
|
1785
|
+
raise PyEzvizError(
|
|
1786
|
+
"Unable to determine resourceId for intelligent app operation"
|
|
1787
|
+
)
|
|
1788
|
+
|
|
1789
|
+
def set_intelligent_app_state(
|
|
1790
|
+
self,
|
|
1791
|
+
serial: str,
|
|
1792
|
+
app_name: str,
|
|
1793
|
+
enabled: bool,
|
|
1794
|
+
resource_id: str | None = None,
|
|
1795
|
+
max_retries: int = 0,
|
|
1796
|
+
) -> bool:
|
|
1797
|
+
"""Enable or disable an intelligent detection app on a camera."""
|
|
1798
|
+
|
|
1799
|
+
resolved_id = self._resolve_resource_id(serial, resource_id)
|
|
1800
|
+
action = "add" if enabled else "remove"
|
|
1801
|
+
return self.manage_intelligent_app(
|
|
1802
|
+
serial,
|
|
1803
|
+
resolved_id,
|
|
1804
|
+
app_name,
|
|
1805
|
+
action=action,
|
|
1806
|
+
max_retries=max_retries,
|
|
1807
|
+
)
|
|
1808
|
+
|
|
1763
1809
|
def flip_image(
|
|
1764
1810
|
self,
|
|
1765
1811
|
serial: str,
|
|
@@ -1952,6 +1998,37 @@ class EzvizClient:
|
|
|
1952
1998
|
|
|
1953
1999
|
return True
|
|
1954
2000
|
|
|
2001
|
+
def set_detection_sensitivity(
|
|
2002
|
+
self,
|
|
2003
|
+
serial: str,
|
|
2004
|
+
channel: int,
|
|
2005
|
+
sensitivity_type: int,
|
|
2006
|
+
value: int,
|
|
2007
|
+
max_retries: int = 0,
|
|
2008
|
+
) -> bool:
|
|
2009
|
+
"""Set detection sensitivity via v3 devconfig endpoint."""
|
|
2010
|
+
|
|
2011
|
+
if max_retries > MAX_RETRIES:
|
|
2012
|
+
raise PyEzvizError("Can't gather proper data. Max retries exceeded.")
|
|
2013
|
+
|
|
2014
|
+
if sensitivity_type == 0 and not 1 <= value <= 6:
|
|
2015
|
+
raise PyEzvizError("Detection sensitivity must be within 1..6")
|
|
2016
|
+
if sensitivity_type != 0 and not 1 <= value <= 100:
|
|
2017
|
+
raise PyEzvizError("Detection sensitivity must be within 1..100")
|
|
2018
|
+
|
|
2019
|
+
url_path = (
|
|
2020
|
+
f"{API_ENDPOINT_SENSITIVITY}{serial}/{channel}/{sensitivity_type}/{value}"
|
|
2021
|
+
)
|
|
2022
|
+
json_output = self._request_json(
|
|
2023
|
+
"PUT",
|
|
2024
|
+
url_path,
|
|
2025
|
+
retry_401=True,
|
|
2026
|
+
max_retries=max_retries,
|
|
2027
|
+
)
|
|
2028
|
+
self._ensure_ok(json_output, "Could not set detection sensitivity")
|
|
2029
|
+
|
|
2030
|
+
return True
|
|
2031
|
+
|
|
1955
2032
|
def get_detection_sensibility(
|
|
1956
2033
|
self, serial: str, type_value: str = "0", max_retries: int = 0
|
|
1957
2034
|
) -> Any:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
pyezvizapi/__init__.py,sha256=IDnIN_nfIISVwuy0cVBh4wspgAav6MuOJCQGajjyU3g,1881
|
|
2
2
|
pyezvizapi/__main__.py,sha256=9uttTuOfO22tzyomJIV8ebFJ-G-YUNDYOadZ_0AgdNA,20925
|
|
3
|
-
pyezvizapi/api_endpoints.py,sha256=
|
|
3
|
+
pyezvizapi/api_endpoints.py,sha256=Wn3FtwFChoi4wAymnVCbEtFg-8B01_gKCMc6zNa2mE8,2814
|
|
4
4
|
pyezvizapi/camera.py,sha256=Pl5oIEdrFcv1Hz5sQI1IyyJIDCMjOjQdtExgKzmLoK8,22102
|
|
5
5
|
pyezvizapi/cas.py,sha256=3zHe-_a0KchCmGeAj1of-pV6oMPRUmSCIiDqBFsTK8A,6025
|
|
6
|
-
pyezvizapi/client.py,sha256=
|
|
6
|
+
pyezvizapi/client.py,sha256=LHl00HcAO339KBYS1y4Focgr35mHYpgLiLEnNePv0_A,76202
|
|
7
7
|
pyezvizapi/constants.py,sha256=wSX5nxjZU_8zjedjoPaEjPrF1ddFptox2g_isD_Ku74,12621
|
|
8
8
|
pyezvizapi/exceptions.py,sha256=8rmxEUQdrziqMe-M1SeeRd0HtP2IDQ2xpJVj7wvOQyo,976
|
|
9
9
|
pyezvizapi/light_bulb.py,sha256=9wgycG3dTvBbrsxQjQnXal-GA8VXPsIN1m-CTtRh8i0,7797
|
|
@@ -12,10 +12,10 @@ pyezvizapi/mqtt.py,sha256=aOL-gexZgYvCCaNQ03M4vZan91d5p2Fl_qsFykn9NW4,22365
|
|
|
12
12
|
pyezvizapi/test_cam_rtsp.py,sha256=O9NHh-vcNFfnzNw8jbuhM9a_5TWfNZIMXaJP7Lmkaj4,5162
|
|
13
13
|
pyezvizapi/test_mqtt.py,sha256=Orn-fwZPJIE4G5KROMX0MRAkLwU6nLb9LUtXyb2ZCQs,4147
|
|
14
14
|
pyezvizapi/utils.py,sha256=G8gGjG0ecdN05Y0vxOHvcQMtQXgVB7nHzyvCzz66kLk,12148
|
|
15
|
-
pyezvizapi-1.0.2.
|
|
16
|
-
pyezvizapi-1.0.2.
|
|
17
|
-
pyezvizapi-1.0.2.
|
|
18
|
-
pyezvizapi-1.0.2.
|
|
19
|
-
pyezvizapi-1.0.2.
|
|
20
|
-
pyezvizapi-1.0.2.
|
|
21
|
-
pyezvizapi-1.0.2.
|
|
15
|
+
pyezvizapi-1.0.2.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
16
|
+
pyezvizapi-1.0.2.8.dist-info/licenses/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
17
|
+
pyezvizapi-1.0.2.8.dist-info/METADATA,sha256=8yaFfx3GUt93XZuBRmBOqB8jS6-skT_cz97iRWG5r_U,695
|
|
18
|
+
pyezvizapi-1.0.2.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
19
|
+
pyezvizapi-1.0.2.8.dist-info/entry_points.txt,sha256=_BSJ3eNb2H_AZkRdsv1s4mojqWn3N7m503ujvg1SudA,56
|
|
20
|
+
pyezvizapi-1.0.2.8.dist-info/top_level.txt,sha256=gMZTelIi8z7pXyTCQLLaIkxVRrDQ_lS2NEv0WgfHrHs,11
|
|
21
|
+
pyezvizapi-1.0.2.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|