pyimouapi 1.0.4__tar.gz → 1.0.4.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyimouapi
3
- Version: 1.0.4
3
+ Version: 1.0.4.2
4
4
  Summary: A package for imou open api
5
5
  Home-page: https://github.com/Imou-OpenPlatform/Py-Imou-Open-Api
6
6
  Author: Imou-OpenPlatform
@@ -0,0 +1,7 @@
1
+ from .device import ImouDeviceManager, ImouDevice, ImouChannel
2
+ from .exceptions import (
3
+ ConnectFailedException,
4
+ RequestFailedException,
5
+ InvalidAppIdOrSecretException,
6
+ )
7
+ from .openapi import ImouOpenApiClient
@@ -0,0 +1,384 @@
1
+ # API Endpoints
2
+ API_ENDPOINT_ACCESS_TOKEN = "/openapi/accessToken"
3
+ API_ENDPOINT_LIST_DEVICE_DETAILS = "/openapi/listDeviceDetailsByPage"
4
+ API_ENDPOINT_CONTROL_DEVICE_PTZ = "/openapi/controlMovePTZ"
5
+ API_ENDPOINT_MODIFY_DEVICE_ALARM_STATUS = "/openapi/modifyDeviceAlarmStatus"
6
+ API_ENDPOINT_GET_DEVICE_ALARM_PARAM = "/openapi/getDeviceAlarmParam"
7
+ API_ENDPOINT_GET_DEVICE_STATUS = "/openapi/getDeviceCameraStatus"
8
+ API_ENDPOINT_SET_DEVICE_STATUS = "/openapi/setDeviceCameraStatus"
9
+ API_ENDPOINT_GET_DEVICE_NIGHT_VISION_MODE = "/openapi/getNightVisionMode"
10
+ API_ENDPOINT_SET_DEVICE_NIGHT_VISION_MODE = "/openapi/setNightVisionMode"
11
+ API_ENDPOINT_DEVICE_STORAGE = "/openapi/deviceStorage"
12
+ API_ENDPOINT_RESTART_DEVICE = "/openapi/restartDevice"
13
+ API_ENDPOINT_BIND_DEVICE_LIVE = "/openapi/bindDeviceLive"
14
+ API_ENDPOINT_GET_DEVICE_ONLINE = "/openapi/deviceOnline"
15
+ API_ENDPOINT_GET_DEVICE_LIVE_INFO = "/openapi/getLiveStreamInfo"
16
+ API_ENDPOINT_SET_DEVICE_SNAP = "/openapi/setDeviceSnapEnhanced"
17
+ API_ENDPOINT_GET_IOT_DEVICE_PROPERTIES = "/openapi/getIotDeviceProperties"
18
+ API_ENDPOINT_SET_IOT_DEVICE_PROPERTIES = "/openapi/setIotDeviceProperties"
19
+ API_ENDPOINT_DEVICE_SD_CARD_STATUS = "/openapi/deviceSdcardStatus"
20
+ API_ENDPOINT_IOT_DEVICE_CONTROL = "/openapi/iotDeviceControl"
21
+
22
+ # error_codes
23
+ ERROR_CODE_SUCCESS = "0"
24
+ ERROR_CODE_TOKEN_OVERDUE = "TK1002"
25
+ ERROR_CODE_INVALID_SIGN = "SN1001"
26
+ ERROR_CODE_INVALID_APP = "SN1004"
27
+ ERROR_CODE_DEVICE_OFFLINE = "DV1007"
28
+ ERROR_CODE_NO_STORAGE_MEDIUM = "DV1049"
29
+ ERROR_CODE_LIVE_NOT_EXIST = "LV1002"
30
+ ERROR_CODE_LIVE_ALREADY_EXIST = "LV1001"
31
+
32
+ # params key
33
+ PARAM_APP_ID = "appId"
34
+ PARAM_APP_SECRET = "appSecret"
35
+ PARAM_SYSTEM = "system"
36
+ PARAM_ACCESS_TOKEN = "accessToken"
37
+ PARAM_CURRENT_DOMAIN = "currentDomain"
38
+ PARAM_DEVICE_ID = "deviceId"
39
+ PARAM_CHANNEL_ID = "channelId"
40
+ PARAM_VER = "ver"
41
+ PARAM_SIGN = "sign"
42
+ PARAM_TIME = "time"
43
+ PARAM_NONCE = "nonce"
44
+ PARAM_PARAMS = "params"
45
+ PARAM_ID = "id"
46
+ PARAM_RESULT = "result"
47
+ PARAM_CODE = "code"
48
+ PARAM_MSG = "msg"
49
+ PARAM_DATA = "data"
50
+ PARAM_PAGE = "page"
51
+ PARAM_PAGE_SIZE = "pageSize"
52
+ PARAM_TOKEN = "token"
53
+ PARAM_PRODUCT_ID = "productId"
54
+ PARAM_PARENT_PRODUCT_ID = "parentProductId"
55
+ PARAM_PARENT_DEVICE_ID = "parentDeviceId"
56
+ PARAM_CHANNEL_NUM = "channelNum"
57
+ PARAM_MODE = "mode"
58
+ PARAM_ENABLE_TYPE = "enableType"
59
+ PARAM_ENABLE = "enable"
60
+ PARAM_COUNT = "count"
61
+ PARAM_DEVICE_LIST = "deviceList"
62
+ PARAM_DEVICE_NAME = "deviceName"
63
+ PARAM_DEVICE_STATUS = "deviceStatus"
64
+ PARAM_DEVICE_ABILITY = "deviceAbility"
65
+ PARAM_DEVICE_VERSION = "deviceVersion"
66
+ PARAM_BRAND = "brand"
67
+ PARAM_DEVICE_MODEL = "deviceModel"
68
+ PARAM_CHANNEL_LIST = "channelList"
69
+ PARAM_CHANNEL_NAME = "channelName"
70
+ PARAM_CHANNEL_STATUS = "channelStatus"
71
+ PARAM_CHANNEL_ABILITY = "channelAbility"
72
+ PARAM_STREAM_ID = "streamId"
73
+ PARAM_OPERATION = "operation"
74
+ PARAM_DURATION = "duration"
75
+ PARAM_PROPERTIES = "properties"
76
+ PARAM_API_URL = "api_url"
77
+ PARAM_STATUS = "status"
78
+ PARAM_CURRENT_OPTION = "current_option"
79
+ PARAM_MODES = "modes"
80
+ PARAM_OPTIONS = "options"
81
+ PARAM_CHANNELS = "channels"
82
+ PARAM_USED_BYTES = "usedBytes"
83
+ PARAM_TOTAL_BYTES = "totalBytes"
84
+ PARAM_STREAMS = "streams"
85
+ PARAM_HLS = "hls"
86
+ PARAM_URL = "url"
87
+ PARAM_KEY = "key"
88
+ PARAM_DEFAULT = "default"
89
+ PARAM_UNIT = "unit"
90
+ PARAM_REF = "ref"
91
+ PARAM_CONTENT = "content"
92
+ PARAM_ON = "on"
93
+ PARAM_BUTTON_TYPE_REF = "button_type_ref"
94
+ PARAM_SENSOR_TYPE_REF = "sensor_type_ref"
95
+ PARAM_SWITCH_TYPE_REF = "switch_type_ref"
96
+ PARAM_SELECT_TYPE_REF = "select_type_ref"
97
+
98
+ PARAM_MOTION_DETECT = "motion_detect"
99
+ PARAM_STORAGE_USED = "storage_used"
100
+ PARAM_RESTART_DEVICE = "restart_device"
101
+ PARAM_NIGHT_VISION_MODE = "night_vision_mode"
102
+ PARAM_PTZ = "ptz"
103
+
104
+
105
+ # Required capacity for various switch types
106
+ SWITCH_TYPE_ABILITY = {
107
+ "motion_detect": ["MobileDetect", "MotionDetect"],
108
+ "close_camera": ["CloseCamera"],
109
+ "white_light": ["WhiteLight", "ChnWhiteLight"],
110
+ "ab_alarm_sound": ["AbAlarmSound"],
111
+ "audio_encode_control": ["AudioEncodeControl", "AudioEncodeControlV2"],
112
+ "ai_human": ["AiHuman"],
113
+ }
114
+ # Required capacity for various button types
115
+ BUTTON_TYPE_ABILITY = {
116
+ "restart_device": ["Reboot"],
117
+ "ptz_up": ["PT", "PTZ"],
118
+ "ptz_down": ["PT", "PTZ"],
119
+ "ptz_left": ["PT", "PTZ"],
120
+ "ptz_right": ["PT", "PTZ"],
121
+ }
122
+ # Required capacity for various select types
123
+ SELECT_TYPE_ABILITY = {
124
+ "night_vision_mode": ["NVM"],
125
+ }
126
+ # Required capacity for various sensor types
127
+ SENSOR_TYPE_ABILITY = {
128
+ "storage_used": ["LocalStorage", "LocalStorageEnable"],
129
+ "power": ["Electric"],
130
+ }
131
+
132
+ # Levels of capacity
133
+ ABILITY_LEVEL_TYPE = {
134
+ "MobileDetect": 2,
135
+ "MotionDetect": 2,
136
+ "PT": 2,
137
+ "PTZ": 2,
138
+ "CloseCamera": 2,
139
+ "WhiteLight": 1,
140
+ "ChnWhiteLight": 2,
141
+ "AbAlarmSound": 1,
142
+ "AudioEncodeControl": 2,
143
+ "AudioEncodeControlV2": 2,
144
+ "NVM": 2,
145
+ "LocalStorage": 1,
146
+ "LocalStorageEnable": 1,
147
+ "Reboot": 1,
148
+ "Electric": 3,
149
+ }
150
+
151
+
152
+ # The parameter values for switch
153
+ SWITCH_TYPE_ENABLE = {
154
+ "motion_detect": ["motionDetect", "mobileDetect"],
155
+ "close_camera": ["closeCamera"],
156
+ "white_light": ["whiteLight"],
157
+ "audio_encode_control": ["audioEncodeControl"],
158
+ "ab_alarm_sound": ["abAlarmSound"],
159
+ "ai_human": ["aiHuman"],
160
+ }
161
+
162
+ BUTTON_TYPE_PARAM_VALUE = {
163
+ "ptz_up": 0,
164
+ "ptz_down": 1,
165
+ "ptz_left": 2,
166
+ "ptz_right": 3,
167
+ }
168
+
169
+ THINGS_MODEL_PRODUCT_TYPE_REF = {
170
+ "z76s20l415gnhhl1": {
171
+ "button_type_ref": {
172
+ "reboot": {"ref": "2300", "type": "service"},
173
+ "mute": {"ref": "21600", "type": "service"},
174
+ },
175
+ "switch_type_ref": {
176
+ "light": {
177
+ "ref": "11400",
178
+ "type": "property",
179
+ "default": False,
180
+ }
181
+ },
182
+ "select_type_ref": {
183
+ "mode": {
184
+ "ref": "15200",
185
+ "default": 0,
186
+ "type": "property",
187
+ "options": [0, 1, 2],
188
+ },
189
+ "device_volume": {
190
+ "ref": "15400",
191
+ "default": 0,
192
+ "type": "property",
193
+ "options": [-1, 0, 1, 2],
194
+ },
195
+ },
196
+ },
197
+ "BDHCWWPX": {
198
+ "button_type_ref": {
199
+ "restart_device": {"ref": "2300", "type": "service"},
200
+ "mute": {"ref": "21600", "type": "service"},
201
+ },
202
+ "switch_type_ref": {
203
+ "light": {
204
+ "ref": "11400",
205
+ "type": "property",
206
+ "default": False,
207
+ }
208
+ },
209
+ "select_type_ref": {
210
+ "mode": {
211
+ "ref": "15200",
212
+ "default": 0,
213
+ "type": "property",
214
+ "options": [0, 1, 2],
215
+ },
216
+ "device_volume": {
217
+ "ref": "15400",
218
+ "default": 0,
219
+ "type": "property",
220
+ "options": [-1, 0, 1, 2],
221
+ },
222
+ },
223
+ },
224
+ "qfwybtpd03zxiyxi": {
225
+ "sensor_type_ref": {
226
+ "power": {
227
+ "ref": "11600",
228
+ "type": "property",
229
+ "default": 15,
230
+ "unit": "%",
231
+ }
232
+ },
233
+ },
234
+ "FNXACFDW": {
235
+ "sensor_type_ref": {
236
+ "power": {
237
+ "ref": "11600",
238
+ "type": "property",
239
+ "default": 15,
240
+ "unit": "%",
241
+ }
242
+ },
243
+ },
244
+ "o8828zgeg1g9cfuz": {
245
+ "button_type_ref": {
246
+ "mute": {"ref": "2200", "type": "service"},
247
+ },
248
+ "select_type_ref": {
249
+ "device_volume": {
250
+ "ref": "15400",
251
+ "default": 0,
252
+ "type": "property",
253
+ "options": [-1, 0, 1, 2],
254
+ },
255
+ },
256
+ },
257
+ "emi4a5sapwg0pnj0": {
258
+ "sensor_type_ref": {
259
+ "power": {
260
+ "ref": "11600",
261
+ "type": "property",
262
+ "default": 15,
263
+ "unit": "%",
264
+ }
265
+ },
266
+ "button_type_ref": {
267
+ "mute": {"ref": "2200", "type": "service"},
268
+ },
269
+ },
270
+ "BZFACWD1": {
271
+ "sensor_type_ref": {
272
+ "power": {
273
+ "ref": "11600",
274
+ "type": "property",
275
+ "default": 15,
276
+ "unit": "%",
277
+ }
278
+ },
279
+ "button_type_ref": {
280
+ "mute": {"ref": "2200", "type": "service"},
281
+ },
282
+ },
283
+ "W53ATH8Y": {
284
+ "sensor_type_ref": {
285
+ "power": {
286
+ "ref": "11600",
287
+ "type": "property",
288
+ "default": 15,
289
+ "unit": "%",
290
+ }
291
+ },
292
+ "switch_type_ref": {
293
+ "door_contact_status": {
294
+ "ref": "16300",
295
+ "type": "property",
296
+ "default": False,
297
+ }
298
+ },
299
+ },
300
+ "qlkc2jscyskjl2l0": {
301
+ "sensor_type_ref": {
302
+ "power": {
303
+ "ref": "11600",
304
+ "type": "property",
305
+ "default": 15,
306
+ "unit": "%",
307
+ }
308
+ },
309
+ "switch_type_ref": {
310
+ "door_contact_status": {
311
+ "ref": "16300",
312
+ "type": "property",
313
+ "default": False,
314
+ }
315
+ },
316
+ },
317
+ "XQA32TH3": {
318
+ "sensor_type_ref": {
319
+ "power": {
320
+ "ref": "11600",
321
+ "type": "property",
322
+ "default": 15,
323
+ "unit": "%",
324
+ }
325
+ },
326
+ },
327
+ "ilgltwx0a0x7rykg": {
328
+ "sensor_type_ref": {
329
+ "power": {
330
+ "ref": "11600",
331
+ "type": "property",
332
+ "default": 15,
333
+ "unit": "%",
334
+ }
335
+ },
336
+ },
337
+ "jp6he4js8mu0u37d": {
338
+ "sensor_type_ref": {
339
+ "power": {
340
+ "ref": "11600",
341
+ "type": "property",
342
+ "default": 15,
343
+ "unit": "%",
344
+ },
345
+ "temperature_current": {
346
+ "ref": "11700",
347
+ "type": "property",
348
+ "default": 10,
349
+ "unit": "°C",
350
+ },
351
+ "humidity_current": {
352
+ "ref": "16100",
353
+ "type": "property",
354
+ "default": 10,
355
+ "unit": "%RH",
356
+ },
357
+ },
358
+ },
359
+ "2BTLSNHP": {
360
+ "button_type_ref": {
361
+ "mute": {"ref": "2200", "type": "service"},
362
+ },
363
+ },
364
+ "zfdw8yfg3d94bbos": {
365
+ "sensor_type_ref": {
366
+ "power": {
367
+ "ref": "11600",
368
+ "type": "property",
369
+ "default": 15,
370
+ "unit": "%",
371
+ }
372
+ },
373
+ },
374
+ "1TUJJFGY": {
375
+ "sensor_type_ref": {
376
+ "power": {
377
+ "ref": "11600",
378
+ "type": "property",
379
+ "default": 15,
380
+ "unit": "%",
381
+ }
382
+ },
383
+ },
384
+ }