pyezvizapi 1.0.2.6__tar.gz → 1.0.2.8__tar.gz

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.

Files changed (27) hide show
  1. {pyezvizapi-1.0.2.6/pyezvizapi.egg-info → pyezvizapi-1.0.2.8}/PKG-INFO +1 -1
  2. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/api_endpoints.py +1 -0
  3. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/client.py +77 -0
  4. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8/pyezvizapi.egg-info}/PKG-INFO +1 -1
  5. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/setup.py +1 -1
  6. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/LICENSE +0 -0
  7. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/LICENSE.md +0 -0
  8. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/MANIFEST.in +0 -0
  9. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/README.md +0 -0
  10. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/__init__.py +0 -0
  11. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/__main__.py +0 -0
  12. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/camera.py +0 -0
  13. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/cas.py +0 -0
  14. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/constants.py +0 -0
  15. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/exceptions.py +0 -0
  16. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/light_bulb.py +0 -0
  17. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/models.py +0 -0
  18. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/mqtt.py +0 -0
  19. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/test_cam_rtsp.py +0 -0
  20. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/test_mqtt.py +0 -0
  21. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi/utils.py +0 -0
  22. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi.egg-info/SOURCES.txt +0 -0
  23. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi.egg-info/dependency_links.txt +0 -0
  24. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi.egg-info/entry_points.txt +0 -0
  25. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi.egg-info/requires.txt +0 -0
  26. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/pyezvizapi.egg-info/top_level.txt +0 -0
  27. {pyezvizapi-1.0.2.6 → pyezvizapi-1.0.2.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyezvizapi
3
- Version: 1.0.2.6
3
+ Version: 1.0.2.8
4
4
  Summary: Pilot your Ezviz cameras
5
5
  Home-page: https://github.com/RenierM26/pyEzvizApi/
6
6
  Author: Renier Moorcroft
@@ -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"
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyezvizapi
3
- Version: 1.0.2.6
3
+ Version: 1.0.2.8
4
4
  Summary: Pilot your Ezviz cameras
5
5
  Home-page: https://github.com/RenierM26/pyEzvizApi/
6
6
  Author: Renier Moorcroft
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name='pyezvizapi',
8
- version="1.0.2.6",
8
+ version="1.0.2.8",
9
9
  license='Apache Software License 2.0',
10
10
  author='Renier Moorcroft',
11
11
  author_email='RenierM26@users.github.com',
File without changes
File without changes
File without changes
File without changes
File without changes