pyezvizapi 1.0.1.6__tar.gz → 1.0.1.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.
- {pyezvizapi-1.0.1.6/pyezvizapi.egg-info → pyezvizapi-1.0.1.8}/PKG-INFO +2 -2
- pyezvizapi-1.0.1.8/README.md +259 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/pyezvizapi/__init__.py +15 -2
- pyezvizapi-1.0.1.8/pyezvizapi/__main__.py +602 -0
- pyezvizapi-1.0.1.8/pyezvizapi/camera.py +640 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/pyezvizapi/cas.py +36 -43
- pyezvizapi-1.0.1.8/pyezvizapi/client.py +2001 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/pyezvizapi/constants.py +9 -2
- pyezvizapi-1.0.1.8/pyezvizapi/exceptions.py +33 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/pyezvizapi/light_bulb.py +80 -31
- pyezvizapi-1.0.1.8/pyezvizapi/models.py +103 -0
- pyezvizapi-1.0.1.8/pyezvizapi/mqtt.py +616 -0
- pyezvizapi-1.0.1.8/pyezvizapi/test_cam_rtsp.py +135 -0
- pyezvizapi-1.0.1.8/pyezvizapi/test_mqtt.py +135 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/pyezvizapi/utils.py +28 -2
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8/pyezvizapi.egg-info}/PKG-INFO +2 -2
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/pyezvizapi.egg-info/SOURCES.txt +2 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/setup.py +2 -2
- pyezvizapi-1.0.1.6/README.md +0 -303
- pyezvizapi-1.0.1.6/pyezvizapi/__main__.py +0 -479
- pyezvizapi-1.0.1.6/pyezvizapi/camera.py +0 -270
- pyezvizapi-1.0.1.6/pyezvizapi/client.py +0 -2545
- pyezvizapi-1.0.1.6/pyezvizapi/exceptions.py +0 -33
- pyezvizapi-1.0.1.6/pyezvizapi/mqtt.py +0 -259
- pyezvizapi-1.0.1.6/pyezvizapi/test_cam_rtsp.py +0 -149
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/LICENSE +0 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/LICENSE.md +0 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/MANIFEST.in +0 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/pyezvizapi/api_endpoints.py +0 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/pyezvizapi.egg-info/dependency_links.txt +0 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/pyezvizapi.egg-info/entry_points.txt +0 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/pyezvizapi.egg-info/requires.txt +0 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/pyezvizapi.egg-info/top_level.txt +0 -0
- {pyezvizapi-1.0.1.6 → pyezvizapi-1.0.1.8}/setup.cfg +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyezvizapi
|
|
3
|
-
Version: 1.0.1.
|
|
3
|
+
Version: 1.0.1.8
|
|
4
4
|
Summary: Pilot your Ezviz cameras
|
|
5
5
|
Home-page: https://github.com/RenierM26/pyEzvizApi/
|
|
6
6
|
Author: Renier Moorcroft
|
|
7
7
|
Author-email: RenierM26@users.github.com
|
|
8
8
|
License: Apache Software License 2.0
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
License-File: LICENSE.md
|
|
12
12
|
Requires-Dist: requests
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Ezviz PyPi
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Pilot your Ezviz cameras (and light bulbs) with this module. It is used by:
|
|
8
|
+
|
|
9
|
+
- The official Ezviz integration in Home Assistant
|
|
10
|
+
- The EZVIZ (Beta) custom integration for Home Assistant
|
|
11
|
+
|
|
12
|
+
You can also use it directly from the command line for quick checks and scripting.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- Inspect device and connection status in table or JSON form
|
|
17
|
+
- Control cameras: PTZ, privacy/sleep/audio/IR/state LEDs, alarm settings
|
|
18
|
+
- Control light bulbs: toggle, status, brightness and color temperature
|
|
19
|
+
- Dump raw pagelist and device infos JSON for exploration/debugging
|
|
20
|
+
- Reuse a saved session token (no credentials needed after first login)
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
From PyPI:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install pyezvizapi
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
After installation, a `pyezvizapi` command is available on your PATH.
|
|
31
|
+
|
|
32
|
+
### Dependencies (development/local usage)
|
|
33
|
+
|
|
34
|
+
If you are running from a clone of this repository or using the helper scripts directly, ensure these packages are available:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install requests paho-mqtt pycryptodome pandas
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# See available commands and options
|
|
44
|
+
pyezvizapi --help
|
|
45
|
+
|
|
46
|
+
# First-time login and save token for reuse
|
|
47
|
+
pyezvizapi -u YOUR_EZVIZ_USERNAME -p YOUR_EZVIZ_PASSWORD --save-token devices status
|
|
48
|
+
|
|
49
|
+
# Subsequent runs can reuse the saved token (no credentials needed)
|
|
50
|
+
pyezvizapi devices status --json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## CLI Authentication
|
|
54
|
+
|
|
55
|
+
- Username/password: `-u/--username` and `-p/--password`
|
|
56
|
+
- Token file: `--token-file` (defaults to `ezviz_token.json` in the current directory)
|
|
57
|
+
- Save token: `--save-token` writes the current token after login
|
|
58
|
+
- MFA: The CLI prompts for a code if required by your account
|
|
59
|
+
- Region: `-r/--region` overrides the default region (`apiieu.ezvizlife.com`)
|
|
60
|
+
|
|
61
|
+
Examples:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# First-time login and save token locally
|
|
65
|
+
pyezvizapi -u YOUR_EZVIZ_USERNAME -p YOUR_EZVIZ_PASSWORD --save-token devices status
|
|
66
|
+
|
|
67
|
+
# Reuse saved token (no credentials)
|
|
68
|
+
pyezvizapi devices status --json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Output Modes
|
|
72
|
+
|
|
73
|
+
- Default: human-readable tables (for list/status views)
|
|
74
|
+
- JSON: add `--json` for easy parsing and editor-friendly exploration
|
|
75
|
+
|
|
76
|
+
## CLI Commands
|
|
77
|
+
|
|
78
|
+
All commands are subcommands of the module runner:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pyezvizapi <command> [options]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### devices
|
|
85
|
+
|
|
86
|
+
- Actions: `device`, `status`, `switch`, `connection`
|
|
87
|
+
- Examples:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Table view
|
|
91
|
+
pyezvizapi devices status
|
|
92
|
+
|
|
93
|
+
# JSON view
|
|
94
|
+
pyezvizapi devices status --json
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Sample table columns include:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
name | status | device_category | device_sub_category | sleep | privacy | audio | ir_led | state_led | local_ip | local_rtsp_port | battery_level | alarm_schedules_enabled | alarm_notify | Motion_Trigger
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The CLI also computes a `switch_flags` map for each device (all switch states by name, e.g. `privacy`, `sleep`, `sound`, `infrared_light`, `light`, etc.).
|
|
104
|
+
|
|
105
|
+
### camera
|
|
106
|
+
|
|
107
|
+
Requires `--serial`.
|
|
108
|
+
|
|
109
|
+
- Actions: `status`, `move`, `move_coords`, `unlock-door`, `unlock-gate`, `switch`, `alarm`, `select`
|
|
110
|
+
- Examples:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Camera status
|
|
114
|
+
pyezvizapi camera --serial ABC123 status
|
|
115
|
+
|
|
116
|
+
# PTZ move
|
|
117
|
+
pyezvizapi camera --serial ABC123 move --direction up --speed 5
|
|
118
|
+
|
|
119
|
+
# Move by coordinates
|
|
120
|
+
pyezvizapi camera --serial ABC123 move_coords --x 0.4 --y 0.6
|
|
121
|
+
|
|
122
|
+
# Switch setters
|
|
123
|
+
pyezvizapi camera --serial ABC123 switch --switch privacy --enable 1
|
|
124
|
+
|
|
125
|
+
# Alarm settings (push notify, sound level, do-not-disturb)
|
|
126
|
+
pyezvizapi camera --serial ABC123 alarm --notify 1 --sound 2 --do_not_disturb 0
|
|
127
|
+
|
|
128
|
+
# Battery camera work mode
|
|
129
|
+
pyezvizapi camera --serial ABC123 select --battery_work_mode POWER_SAVE
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### devices_light
|
|
133
|
+
|
|
134
|
+
- Actions: `status`
|
|
135
|
+
- Example:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pyezvizapi devices_light status
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### home_defence_mode
|
|
142
|
+
|
|
143
|
+
Set global defence mode for the account/home.
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
pyezvizapi home_defence_mode --mode HOME_MODE
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### mqtt
|
|
150
|
+
|
|
151
|
+
Connect to Ezviz MQTT push notifications using the current session token. Use `--debug` to see connection details.
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
pyezvizapi mqtt
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
#### MQTT push test script (standalone)
|
|
158
|
+
|
|
159
|
+
For quick experimentation, a small helper script is included which can use a saved token file or prompt for credentials with MFA and save the session token:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# With a previously saved token file
|
|
163
|
+
python config/custom_components/ezviz_cloud/pyezvizapi/test_mqtt.py --token-file ezviz_token.json
|
|
164
|
+
|
|
165
|
+
# Interactive login, then save token for next time
|
|
166
|
+
python config/custom_components/ezviz_cloud/pyezvizapi/test_mqtt.py --save-token
|
|
167
|
+
|
|
168
|
+
# Explicit credentials (not recommended for shared terminals)
|
|
169
|
+
python config/custom_components/ezviz_cloud/pyezvizapi/test_mqtt.py -u USER -p PASS --save-token
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### pagelist
|
|
173
|
+
|
|
174
|
+
Dump the complete raw pagelist JSON. Great for exploring unknown fields in an editor (e.g. Notepad++).
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
pyezvizapi pagelist > pagelist.json
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### device_infos
|
|
181
|
+
|
|
182
|
+
Dump the processed device infos mapping (what the integration consumes). Optionally filter to one serial:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# All devices
|
|
186
|
+
pyezvizapi device_infos > device_infos.json
|
|
187
|
+
|
|
188
|
+
# Single device
|
|
189
|
+
pyezvizapi device_infos --serial ABC123 > ABC123.json
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Remote door and gate unlock (CS-HPD7)
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
pyezvizapi camera --serial BAXXXXXXX-BAYYYYYYY unlock-door
|
|
196
|
+
pyezvizapi camera --serial BAXXXXXXX-BAYYYYYYY unlock-gate
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## RTSP authentication test (Basic → Digest)
|
|
200
|
+
|
|
201
|
+
Validate RTSP credentials by issuing a DESCRIBE request. Falls back from Basic to Digest auth automatically.
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
python -c "from config.custom_components.ezviz_cloud.pyezvizapi.test_cam_rtsp import TestRTSPAuth as T; T('<IP>', '<USER>', '<PASS>', '/Streaming/Channels/101').main()"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
On success, the script prints a confirmation. On failure it raises one of:
|
|
208
|
+
|
|
209
|
+
- `InvalidHost`: Hostname/IP or port issue
|
|
210
|
+
- `AuthTestResultFailed`: Invalid credentials
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
Please format with Ruff and check typing with mypy.
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
ruff check .
|
|
218
|
+
mypy config/custom_components/ezviz_cloud/pyezvizapi
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Run style fixes where possible:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
ruff check --fix config/custom_components/ezviz_cloud/pyezvizapi
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Run tests with tox:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
tox
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Side Notes
|
|
234
|
+
|
|
235
|
+
There is no official API documentation. Much of this is based on reverse-engineering the Ezviz mobile app (Android/iOS). Some regions operate on separate endpoints; US example: `apiius.ezvizlife.com`.
|
|
236
|
+
|
|
237
|
+
Example:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
pyezvizapi -u username@domain.com -p PASS@123 -r apius.ezvizlife.com devices status
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
For advanced troubleshooting or new feature research, MITM proxy tools like mitmproxy/Charles/Fiddler can be used to inspect traffic from the app (see community guides for SSL unpinning and WSA usage).
|
|
244
|
+
|
|
245
|
+
## Contributing
|
|
246
|
+
|
|
247
|
+
Contributions are welcome — the API surface is large and there are many improvements possible.
|
|
248
|
+
|
|
249
|
+
## Versioning
|
|
250
|
+
|
|
251
|
+
We follow SemVer when publishing the library. See repository tags for released versions.
|
|
252
|
+
|
|
253
|
+
## License
|
|
254
|
+
|
|
255
|
+
Apache 2.0 — see `LICENSE.md`.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
Draft versions: 0.0.x
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Top-level package for the Ezviz Cloud API helpers.
|
|
2
|
+
|
|
3
|
+
This package provides a small, typed API surface around Ezviz cloud
|
|
4
|
+
endpoints tailored for Home Assistant and light scripting. The
|
|
5
|
+
submodules contain focused functionality (client, camera/light models,
|
|
6
|
+
MQTT push, CAS, utilities) and this package exports the most useful
|
|
7
|
+
symbols for convenient imports.
|
|
8
|
+
"""
|
|
2
9
|
|
|
3
10
|
from .camera import EzvizCamera
|
|
4
11
|
from .cas import EzvizCAS
|
|
@@ -28,7 +35,8 @@ from .exceptions import (
|
|
|
28
35
|
PyEzvizError,
|
|
29
36
|
)
|
|
30
37
|
from .light_bulb import EzvizLightBulb
|
|
31
|
-
from .
|
|
38
|
+
from .models import EzvizDeviceRecord, build_device_records_map
|
|
39
|
+
from .mqtt import EzvizToken, MQTTClient, MqttData, ServiceUrls
|
|
32
40
|
from .test_cam_rtsp import TestRTSPAuth
|
|
33
41
|
|
|
34
42
|
__all__ = [
|
|
@@ -46,16 +54,21 @@ __all__ = [
|
|
|
46
54
|
"EzvizCAS",
|
|
47
55
|
"EzvizCamera",
|
|
48
56
|
"EzvizClient",
|
|
57
|
+
"EzvizDeviceRecord",
|
|
49
58
|
"EzvizLightBulb",
|
|
59
|
+
"EzvizToken",
|
|
50
60
|
"HTTPError",
|
|
51
61
|
"IntelligentDetectionSmartApp",
|
|
52
62
|
"InvalidHost",
|
|
53
63
|
"InvalidURL",
|
|
54
64
|
"MQTTClient",
|
|
55
65
|
"MessageFilterType",
|
|
66
|
+
"MqttData",
|
|
56
67
|
"NightVisionMode",
|
|
57
68
|
"PyEzvizError",
|
|
69
|
+
"ServiceUrls",
|
|
58
70
|
"SoundMode",
|
|
59
71
|
"SupportExt",
|
|
60
72
|
"TestRTSPAuth",
|
|
73
|
+
"build_device_records_map",
|
|
61
74
|
]
|