pyezvizapi 1.0.1.0__tar.gz → 1.0.1.2__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 (25) hide show
  1. {pyezvizapi-1.0.1.0/pyezvizapi.egg-info → pyezvizapi-1.0.1.2}/PKG-INFO +1 -1
  2. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/README.md +6 -0
  3. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/__main__.py +20 -0
  4. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/api_endpoints.py +1 -0
  5. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/camera.py +8 -0
  6. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/client.py +45 -0
  7. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/constants.py +58 -7
  8. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2/pyezvizapi.egg-info}/PKG-INFO +1 -1
  9. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/setup.py +1 -1
  10. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/LICENSE +0 -0
  11. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/LICENSE.md +0 -0
  12. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/MANIFEST.in +0 -0
  13. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/__init__.py +0 -0
  14. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/cas.py +0 -0
  15. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/exceptions.py +0 -0
  16. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/light_bulb.py +0 -0
  17. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/mqtt.py +0 -0
  18. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/test_cam_rtsp.py +0 -0
  19. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi/utils.py +0 -0
  20. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi.egg-info/SOURCES.txt +0 -0
  21. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi.egg-info/dependency_links.txt +0 -0
  22. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi.egg-info/entry_points.txt +0 -0
  23. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi.egg-info/requires.txt +0 -0
  24. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/pyezvizapi.egg-info/top_level.txt +0 -0
  25. {pyezvizapi-1.0.1.0 → pyezvizapi-1.0.1.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyezvizapi
3
- Version: 1.0.1.0
3
+ Version: 1.0.1.2
4
4
  Summary: Pilot your Ezviz cameras
5
5
  Home-page: https://github.com/RenierM26/pyEzvizApi/
6
6
  Author: Renier Moorcroft
@@ -247,6 +247,12 @@ pyezvizapi -u em@il -p PASS light --serial D55555 status
247
247
  ```
248
248
  </details>
249
249
 
250
+ ## Remote door and gate unlock (tested on Ezviz CS-HPD7)
251
+ ```
252
+ pyezvizapi -u em@il -p PASS camera --serial BAXXXXXXX-BAYYYYYYY unlock-door
253
+ pyezvizapi -u em@il -p PASS camera --serial BAXXXXXXX-BAYYYYYYY unlock-gate
254
+ ```
255
+
250
256
  ## Running the tests
251
257
  The tox configuration is already included.
252
258
  Simply launch:
@@ -78,6 +78,8 @@ def main() -> Any:
78
78
  subparsers_camera = parser_camera.add_subparsers(dest="camera_action")
79
79
 
80
80
  subparsers_camera.add_parser("status", help="Get the status of the camera")
81
+ subparsers_camera.add_parser("unlock-door", help="Unlock the door lock")
82
+ subparsers_camera.add_parser("unlock-gate", help="Unlock the gate lock")
81
83
  parser_camera_move = subparsers_camera.add_parser("move", help="Move the camera")
82
84
  parser_camera_move.add_argument(
83
85
  "--direction",
@@ -398,6 +400,24 @@ Movement is still recorded even if do-not-disturb is enabled.",
398
400
  finally:
399
401
  client.close_session()
400
402
 
403
+ elif args.camera_action == "unlock-door":
404
+ try:
405
+ camera.door_unlock()
406
+
407
+ except Exception as exp: # pylint: disable=broad-except
408
+ print(exp)
409
+ finally:
410
+ client.close_session()
411
+
412
+ elif args.camera_action == "unlock-gate":
413
+ try:
414
+ camera.gate_unlock()
415
+
416
+ except Exception as exp: # pylint: disable=broad-except
417
+ print(exp)
418
+ finally:
419
+ client.close_session()
420
+
401
421
  elif args.camera_action == "switch":
402
422
  try:
403
423
  if args.switch == "ir":
@@ -24,6 +24,7 @@ API_ENDPOINT_CALLING_NOTIFY = "/v3/calling/"
24
24
  API_ENDPOINT_ALARMINFO_GET = "/v3/alarms/v2/advanced"
25
25
  API_ENDPOINT_V3_ALARMS = "/v3/alarms/"
26
26
  API_ENDPOINT_SET_LUMINANCE = "/v3/alarms/device/alarmLight/"
27
+ API_ENDPOINT_REMOTE_UNLOCK = "/v3/iot-feature/action/#SERIAL#/Video/1/DoorLockMgr/RemoteUnlockReq"
27
28
 
28
29
  API_ENDPOINT_DEVCONFIG_BY_KEY = "/v3/devconfig/v1/keyValue/"
29
30
  API_ENDPOINT_CAM_AUTH_CODE = "/v3/devconfig/authcode/query/"
@@ -188,6 +188,14 @@ class EzvizCamera:
188
188
  """Move camera to specified coordinates."""
189
189
  return self._client.ptz_control_coordinates(self._serial, x_axis, y_axis)
190
190
 
191
+ def door_unlock(self) -> bool:
192
+ """Unlock the door lock."""
193
+ return self._client.remote_unlock(self._serial, 2)
194
+
195
+ def gate_unlock(self) -> bool:
196
+ """Unlock the gate lock."""
197
+ return self._client.remote_unlock(self._serial, 1)
198
+
191
199
  def alarm_notify(self, enable: int) -> bool:
192
200
  """Enable/Disable camera notification when movement is detected."""
193
201
  return self._client.set_camera_defence(self._serial, enable)
@@ -38,6 +38,7 @@ from .api_endpoints import (
38
38
  API_ENDPOINT_OSD,
39
39
  API_ENDPOINT_PAGELIST,
40
40
  API_ENDPOINT_PANORAMIC_DEVICES_OPERATION,
41
+ API_ENDPOINT_REMOTE_UNLOCK,
41
42
  API_ENDPOINT_PTZCONTROL,
42
43
  API_ENDPOINT_REFRESH_SESSION_ID,
43
44
  API_ENDPOINT_RETURN_PANORAMIC,
@@ -1610,6 +1611,50 @@ class EzvizClient:
1610
1611
 
1611
1612
  return True
1612
1613
 
1614
+ def remote_unlock(self, serial: str, lock_no: int) -> bool:
1615
+ """Sends a remote command to unlock a specific lock."""
1616
+ try:
1617
+ endpoint = API_ENDPOINT_REMOTE_UNLOCK.replace("#SERIAL#", serial)
1618
+ user_id = self._token["username"]
1619
+ payload = json.dumps({
1620
+ "unLockInfo": {
1621
+ "bindCode": f"{FEATURE_CODE}{user_id}",
1622
+ "lockNo": lock_no,
1623
+ "streamToken": "",
1624
+ "userName": user_id,
1625
+ }
1626
+ })
1627
+
1628
+ headers = self._session.headers
1629
+ headers.update({"Content-Type": "application/json"})
1630
+
1631
+ req = self._session.put(
1632
+ url=f"https://{self._token['api_url']}{endpoint}",
1633
+ data=payload,
1634
+ timeout=self._timeout,
1635
+ headers=headers,
1636
+ )
1637
+
1638
+ req.raise_for_status()
1639
+
1640
+ except requests.HTTPError as err:
1641
+ raise HTTPError from err
1642
+
1643
+ try:
1644
+ json_result = req.json()
1645
+
1646
+ except ValueError as err:
1647
+ raise PyEzvizError(
1648
+ "Impossible to decode response: "
1649
+ + str(err)
1650
+ + "\nResponse was: "
1651
+ + str(req.text)
1652
+ ) from err
1653
+
1654
+ _LOGGER.debug("Result: %s", json_result)
1655
+
1656
+ return True
1657
+
1613
1658
  def login(self, sms_code: int | None = None) -> dict[Any, Any]:
1614
1659
  """Get or refresh ezviz login token."""
1615
1660
  if self._token["session_id"] and self._token["rf_session_id"]:
@@ -88,9 +88,11 @@ class DeviceSwitchType(Enum):
88
88
  class SupportExt(Enum):
89
89
  """Supported device extensions."""
90
90
 
91
+ SupportAHeadWakeupWifi = 696
91
92
  SupportAITag = 522
92
93
  SupportAbsenceReminder = 181
93
94
  SupportActiveDefense = 96
95
+ SupportAddAfterGuide = 737
94
96
  SupportAddDelDetector = 19
95
97
  SupportAddSmartChildDev = 156
96
98
  SupportAlarmInterval = 406
@@ -101,7 +103,7 @@ class SupportExt(Enum):
101
103
  SupportAntiOpen = 213
102
104
  SupportApMode = 106
103
105
  SupportAssociateDoorlockOnline = 415
104
- SupportAudioCollect = 165, 1
106
+ SupportAudioCollect = 165
105
107
  SupportAudioConfigApn = 695
106
108
  SupportAudioOnoff = 63
107
109
  SupportAutoAdjust = 45
@@ -114,7 +116,9 @@ class SupportExt(Enum):
114
116
  SupportBatteryNonPerOperateP2p = 417
115
117
  SupportBatteryNumber = 322
116
118
  SupportBellSet = 164
119
+ SupportBleConfigApn = 759
117
120
  SupportBluetooth = 58
121
+ SupportBlutoothWifiConfig = 710
118
122
  SupportBodyFaceFilter = 318
119
123
  SupportBodyFaceMarker = 319
120
124
  SupportCall = 191
@@ -131,8 +135,9 @@ class SupportExt(Enum):
131
135
  SupportCloseInfraredLight = 48
132
136
  SupportCloud = 11
133
137
  SupportCloudVersion = 12
134
- SupportConcealResource = 286, -1
138
+ SupportConcealResource = 286
135
139
  SupportCorrelationAlarm = 387
140
+ SupportCruiseTraking = 197
136
141
  SupportCustomVoice = 92
137
142
  SupportCustomVoicePlan = 222
138
143
  SupportDayNightSwitch = 238
@@ -142,11 +147,17 @@ class SupportExt(Enum):
142
147
  SupportDefaultVoice = 202
143
148
  SupportDefence = 1
144
149
  SupportDefencePlan = 3
150
+ SupportDelayLocalRecord = 636
145
151
  SupportDetectHumanCar = 224
146
152
  SupportDetectMoveHumanCar = 302
147
153
  SupportDevOfflineAlarm = 450
154
+ SupportDeviceAutoVideoLevel = 729
155
+ SupportDeviceEmptyPasswordSetting = 609
156
+ SupportDeviceGetAccountPermission = 568
148
157
  SupportDeviceIntrusionDetection = 385
149
158
  SupportDeviceLinkDevice = 593
159
+ SupportDeviceLocation = 745
160
+ SupportDevicePermissionType = 659
150
161
  SupportDeviceRevisionSetting = 499
151
162
  SupportDeviceRfSignalReport = 325
152
163
  SupportDeviceRing = 185
@@ -154,27 +165,34 @@ class SupportExt(Enum):
154
165
  SupportDevicelog = 216
155
166
  SupportDisk = 4
156
167
  SupportDiskBlackList = 367
168
+ SupportDistributionNetworkBetweenDevice = 420
157
169
  SupportDisturbMode = 217
158
170
  SupportDisturbNewMode = 292
159
171
  SupportDoorCallPlayBack = 545
160
172
  SupportDoorCallQuickReply = 544
173
+ SupportDoorLookStateShow = 690
161
174
  SupportDoorbellIndicatorLight = 242
162
175
  SupportDoorbellTalk = 101
163
- SupportEcdhV2getString = 519
176
+ SupportEcdhV2 = 519
164
177
  SupportEmojiInteraction = 573
165
178
  SupportEnStandard = 235
166
179
  SupportEncrypt = 9
180
+ SupportEnterCardDetail = 779
181
+ SupportEventVideo = 393
182
+ SupportExtremePowerSaving = 827
167
183
  SupportEzvizChime = 380
168
184
  SupportFaceFrameMark = 196
169
185
  SupportFeatureTrack = 321
170
186
  SupportFecCeilingCorrectType = 312
187
+ SupportFecDeskTopCorrectType = 666
171
188
  SupportFecWallCorrectType = 313
172
189
  SupportFilter = 360
173
190
  SupportFishEye = 91
174
191
  SupportFlashLamp = 496
175
192
  SupportFlowStatistics = 53
193
+ SupportFocusAdjust = 817
194
+ SupportFullDayRecord = 88
176
195
  SupportFullScreenPtz = 81
177
- SupportFulldayRecord = 88
178
196
  SupportGetDeviceAuthCode = 492
179
197
  SupportHorizontalPanoramic = 95
180
198
  SupportHostScreen = 240
@@ -189,7 +207,9 @@ class SupportExt(Enum):
189
207
  SupportIsapi = 145
190
208
  SupportKeyFocus = 74
191
209
  SupportKindsP2pMode = 566
192
- SupportLanguagegetString = 47
210
+ SupportLANPort = 769
211
+ SupportLanguage = 47
212
+ SupportLaserPtCtrl = 640
193
213
  SupportLightAbilityRemind = 301
194
214
  SupportLightRelate = 297
195
215
  SupportLocalConnect = 507
@@ -199,35 +219,54 @@ class SupportExt(Enum):
199
219
  SupportMicroVolumnSet = 77
200
220
  SupportMicroscope = 60
201
221
  SupportModifyChanName = 49
202
- SupportModifyDetectorguardgetString = 23
222
+ SupportModifyDetectorguard = 23
203
223
  SupportModifyDetectorname = 21
204
224
  SupportMore = 54
205
225
  SupportMotionDetection = 97
226
+ SupportMultiChannelFlip = 732
227
+ SupportMultiChannelSharedService = 720
228
+ SupportMultiChannelType = 719
206
229
  SupportMultiScreen = 17
207
230
  SupportMultiSubsys = 255
231
+ SupportMultilensPlay = 665
208
232
  SupportMusic = 67
209
233
  SupportMusicPlay = 602
210
234
  SupportNatPass = 84
235
+ SupportNeedOpenMode = 754
211
236
  SupportNetProtect = 290
212
237
  SupportNewSearchRecords = 256
238
+ SupportNewTalk = 87
239
+ SupportNewWorkMode = 687
213
240
  SupportNightVisionMode = 206
214
241
  SupportNoencriptViaAntProxy = 79
215
242
  SupportNvrEncrypt = 465
243
+ SupportOneClickReset = 738
216
244
  SupportOneKeyPatrol = 571
245
+ SupportOpticalZoom = 644
246
+ SupportOsd = 153
217
247
  SupportPaging = 249
248
+ SupportPanoramaPicListSize = 731
249
+ SupportPartAreaRecord = 615
218
250
  SupportPartialImageOptimize = 221
251
+ SupportPetHomeCharge = 805
252
+ SupportPetPlayPath = 801
253
+ SupportPetTalkChangeVoice = 639
219
254
  SupportPicInPic = 460
220
255
  SupportPirDetect = 100
221
256
  SupportPirSetting = 118
222
257
  SupportPlaybackAsyn = 375
223
258
  SupportPlaybackMaxSpeed = 610
259
+ SupportPlaybackPiP = 645
224
260
  SupportPlaybackQualityChange = 200
225
261
  SupportPlaybackSmallSpeed = 585
262
+ SupportPointLocateView = 724
263
+ SupportPoundSignShow = 699
226
264
  SupportPoweroffRecovery = 189
227
265
  SupportPreP2P = 59
228
266
  SupportPreset = 34
229
267
  SupportPresetAlarm = 72
230
268
  SupportPreviewCorrectionInOldWay = 581
269
+ SupportPreviewNoPlayback = 780
231
270
  SupportProtectionMode = 64
232
271
  SupportPtz = 154
233
272
  SupportPtz45Degree = 32
@@ -247,6 +286,7 @@ class SupportExt(Enum):
247
286
  SupportPtzZoom = 33
248
287
  SupportPtzcmdViaP2pv3 = 169
249
288
  SupportQosTalkVersion = 287
289
+ SupportQualityDisable = 660
250
290
  SupportQuickplayWay = 149
251
291
  SupportRateLimit = 65
252
292
  SupportRebootDevice = 452
@@ -256,12 +296,14 @@ class SupportExt(Enum):
256
296
  SupportRelationCamera = 117
257
297
  SupportRemindAudition = 434
258
298
  SupportRemoteAuthRandcode = 28
299
+ SupportRemoteControl = 800
259
300
  SupportRemoteOpenDoor = 592
260
301
  SupportRemoteQuiet = 55
302
+ SupportRemoteUnlock = 648
261
303
  SupportReplayChanNums = 94
262
304
  SupportReplayDownload = 260
263
305
  SupportReplaySpeed = 68
264
- SupportResolutiongetString = 16
306
+ SupportResolution = 16
265
307
  SupportRestartTime = 103
266
308
  SupportReverseDirect = 69
267
309
  SupportRingingSoundSelect = 241
@@ -273,6 +315,7 @@ class SupportExt(Enum):
273
315
  SupportSensibilityAdjust = 61
274
316
  SupportServerSideEncryption = 261
275
317
  SupportSetWireioType = 205
318
+ SupportSignalAsyn = 183
276
319
  SupportSignalCheck = 535
277
320
  SupportSimCard = 194
278
321
  SupportSleep = 62
@@ -280,6 +323,7 @@ class SupportExt(Enum):
280
323
  SupportSmartNightVision = 274
281
324
  SupportSoundLightAlarm = 214
282
325
  SupportSsl = 25
326
+ SupportStopRecordVideo = 219
283
327
  SupportSwitchLog = 187
284
328
  SupportSwitchTalkmode = 170
285
329
  SupportTalk = 2
@@ -291,6 +335,7 @@ class SupportExt(Enum):
291
335
  SupportTextToVoice = 574
292
336
  SupportTimeSchedulePlan = 209
293
337
  SupportTimezone = 46
338
+ SupportTipsVoice = 625
294
339
  SupportTracking = 198
295
340
  SupportTvEntranceOff = 578
296
341
  SupportUnLock = 78
@@ -298,6 +343,11 @@ class SupportExt(Enum):
298
343
  SupportUpgrade = 10
299
344
  SupportUploadCloudFile = 18
300
345
  SupportVerticalPanoramic = 112
346
+ SupportVideoJoint = 782
347
+ SupportVideoJointLineType = 787
348
+ SupportVideoMeeting = 818
349
+ SupportVideoMeetingEncodeType = 864
350
+ SupportVideoMeetingScreenShare = 867
301
351
  SupportVolumnSet = 75
302
352
  SupportWeixin = 24
303
353
  SupportWifi = 13
@@ -306,6 +356,7 @@ class SupportExt(Enum):
306
356
  SupportWifiLock = 541
307
357
  SupportWifiManager = 239
308
358
  SupportWifiPortal = 43
359
+ SupportWindowPtzSlider = 802
309
360
  SupportWorkModeList = 502
310
361
  SupportSensitiveUnderDefenceType = 444
311
362
  SupportDefenceTypeFull = 534
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyezvizapi
3
- Version: 1.0.1.0
3
+ Version: 1.0.1.2
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.1.0",
8
+ version="1.0.1.2",
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