pyvesync 3.0.0rc2__tar.gz → 3.1.0__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.
Files changed (62) hide show
  1. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/PKG-INFO +71 -4
  2. pyvesync-3.0.0rc2/src/pyvesync.egg-info/PKG-INFO → pyvesync-3.1.0/README.md +56 -35
  3. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/pyproject.toml +38 -2
  4. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/setup.py +0 -1
  5. pyvesync-3.1.0/src/pyvesync/__init__.py +5 -0
  6. pyvesync-3.1.0/src/pyvesync/auth.py +424 -0
  7. pyvesync-3.1.0/src/pyvesync/base_devices/__init__.py +35 -0
  8. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/base_devices/bulb_base.py +35 -37
  9. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/base_devices/fan_base.py +45 -43
  10. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/base_devices/fryer_base.py +10 -12
  11. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/base_devices/humidifier_base.py +60 -53
  12. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/base_devices/outlet_base.py +56 -44
  13. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/base_devices/purifier_base.py +66 -70
  14. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/base_devices/switch_base.py +36 -35
  15. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/base_devices/thermostat_base.py +42 -41
  16. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/base_devices/vesyncbasedevice.py +89 -106
  17. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/const.py +162 -149
  18. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/device_container.py +54 -41
  19. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/device_map.py +314 -309
  20. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/devices/vesyncbulb.py +204 -223
  21. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/devices/vesyncfan.py +43 -60
  22. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/devices/vesynchumidifier.py +154 -133
  23. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/devices/vesynckitchen.py +152 -159
  24. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/devices/vesyncoutlet.py +171 -182
  25. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/devices/vesyncpurifier.py +160 -187
  26. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/devices/vesyncswitch.py +70 -102
  27. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/devices/vesyncthermostat.py +39 -48
  28. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/base_models.py +17 -14
  29. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/bulb_models.py +15 -10
  30. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/bypass_models.py +14 -10
  31. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/fan_models.py +3 -0
  32. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/fryer_models.py +3 -0
  33. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/home_models.py +6 -4
  34. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/humidifier_models.py +8 -4
  35. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/outlet_models.py +8 -5
  36. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/purifier_models.py +12 -8
  37. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/switch_models.py +6 -2
  38. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/thermostat_models.py +29 -27
  39. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/vesync_models.py +26 -24
  40. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/utils/colors.py +32 -34
  41. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/utils/device_mixins.py +62 -67
  42. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/utils/enum_utils.py +2 -1
  43. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/utils/errors.py +330 -328
  44. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/utils/helpers.py +53 -46
  45. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/utils/logs.py +77 -69
  46. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/vesync.py +155 -199
  47. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/vesynchome.py +31 -39
  48. pyvesync-3.0.0rc2/README.md → pyvesync-3.1.0/src/pyvesync.egg-info/PKG-INFO +102 -2
  49. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync.egg-info/SOURCES.txt +1 -0
  50. pyvesync-3.1.0/src/pyvesync.egg-info/requires.txt +29 -0
  51. pyvesync-3.0.0rc2/src/pyvesync/__init__.py +0 -11
  52. pyvesync-3.0.0rc2/src/pyvesync/base_devices/__init__.py +0 -35
  53. pyvesync-3.0.0rc2/src/pyvesync.egg-info/requires.txt +0 -16
  54. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/LICENSE +0 -0
  55. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/MANIFEST.in +0 -0
  56. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/requirements.txt +0 -0
  57. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/setup.cfg +0 -0
  58. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/devices/__init__.py +0 -0
  59. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/models/__init__.py +0 -0
  60. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync/utils/__init__.py +0 -0
  61. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync.egg-info/dependency_links.txt +0 -0
  62. {pyvesync-3.0.0rc2 → pyvesync-3.1.0}/src/pyvesync.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyvesync
3
- Version: 3.0.0rc2
3
+ Version: 3.1.0
4
4
  Summary: pyvesync is a library to manage Etekcity Devices, Cosori Air Fryers, and Levoit Air Purifiers run on the VeSync app.
5
5
  Author: Mark Perdue
6
6
  Author-email: Joe Trabulsy <webdjoe@gmail.com>
@@ -17,18 +17,31 @@ Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: aiohttp>=3.8.1
19
19
  Requires-Dist: mashumaro[orjson]>=3.13.1
20
- Requires-Dist: python-dateutil>=2.8.1
21
20
  Provides-Extra: dev
22
21
  Requires-Dist: pytest; extra == "dev"
23
22
  Requires-Dist: pytest-cov; extra == "dev"
24
23
  Requires-Dist: pyyaml; extra == "dev"
24
+ Requires-Dist: pylint; extra == "dev"
25
+ Requires-Dist: mypy; extra == "dev"
26
+ Requires-Dist: ruff; extra == "dev"
27
+ Requires-Dist: pre-commit; extra == "dev"
25
28
  Requires-Dist: tox; extra == "dev"
29
+ Requires-Dist: requests; extra == "dev"
26
30
  Requires-Dist: aiofiles; extra == "dev"
27
31
  Provides-Extra: docs
28
32
  Requires-Dist: mkdocstrings-python; extra == "docs"
29
33
  Requires-Dist: mkdocs; extra == "docs"
34
+ Requires-Dist: ruff; extra == "docs"
35
+ Requires-Dist: Pygments; extra == "docs"
30
36
  Requires-Dist: mkdocs-material; extra == "docs"
31
37
  Requires-Dist: mkdocstrings; extra == "docs"
38
+ Requires-Dist: mkdocs-include-markdown-plugin; extra == "docs"
39
+ Requires-Dist: mkdocs-material-extensions; extra == "docs"
40
+ Requires-Dist: pymdown-extensions; extra == "docs"
41
+ Requires-Dist: mike; extra == "docs"
42
+ Requires-Dist: mkdocs-git-revision-date-localized-plugin; extra == "docs"
43
+ Requires-Dist: docstring-inheritance; extra == "docs"
44
+ Requires-Dist: mkdocs-autoref; extra == "docs"
32
45
  Dynamic: license-file
33
46
 
34
47
  # pyvesync [![build status](https://img.shields.io/pypi/v/pyvesync.svg)](https://pypi.python.org/pypi/pyvesync) [![Build Status](https://dev.azure.com/webdjoe/pyvesync/_apis/build/status/webdjoe.pyvesync?branchName=master)](https://dev.azure.com/webdjoe/pyvesync/_build/latest?definitionId=4&branchName=master) [![Open Source? Yes!](https://badgen.net/badge/Open%20Source%20%3F/Yes%21/blue?icon=github)](https://github.com/Naereen/badges/) [![PyPI license](https://img.shields.io/pypi/l/ansicolortags.svg)](https://pypi.python.org/pypi/ansicolortags/) <!-- omit in toc -->
@@ -179,13 +192,14 @@ The VeSync signature is:
179
192
  VeSync(
180
193
  username: str,
181
194
  password: str,
195
+ country_code: str = DEFAULT_COUNTRY_CODE, # US
182
196
  session: ClientSession | None = None,
183
197
  time_zone: str = DEFAULT_TZ # America/New_York
198
+ debug: bool = False,
199
+ redact: bool = True,
184
200
  )
185
201
  ```
186
202
 
187
- The VeSync class no longer accepts a `debug` or `redact` argument. To set debug the library set `manager.debug = True` to the instance and `manager.redact = True`.
188
-
189
203
  ### Product Types
190
204
 
191
205
  There is a new nomenclature for product types that defines the device class. The
@@ -332,6 +346,59 @@ async def main():
332
346
  device.display()
333
347
 
334
348
 
349
+ if __name__ == "__main__":
350
+ asyncio.run(main())
351
+ ```
352
+
353
+ If you want to reuse your token and account_id between runs. The `VeSync.auth` object holds the credentials and helper methods to save and load credentials.
354
+
355
+ ```python
356
+ import asyncio
357
+ from pyvesync import VeSync
358
+ from pyvesync.logs import VeSyncLoginError
359
+
360
+ # VeSync is an asynchronous context manager
361
+ # VeSync(username, password, debug=False, redact=True, session=None)
362
+
363
+ async def main():
364
+ async with VeSync("user", "password") as manager:
365
+
366
+ # If credentials are stored in a file, it can be loaded
367
+ # the default location is ~/.vesync_token
368
+ await manager.load_credentials_from_file()
369
+ # or the file path can be passed
370
+ await manager.load_credentials_from_file("/path/to/token_file")
371
+
372
+ # Or credentials can be passed directly
373
+ manager.set_credentials("your_token", "your_account_id")
374
+
375
+ # No login needed
376
+ # await manager.login()
377
+
378
+ # To store credentials to a file after login
379
+ await manager.save_credentials() # Saves to default location ~/.vesync_token
380
+ # or pass a file path
381
+ await manager.save_credentials("/path/to/token_file")
382
+
383
+ # Output Credentials as JSON String
384
+ await manager.output_credentials()
385
+
386
+ await manager.update()
387
+
388
+ # Acts as a set of device instances
389
+ device_container = manager.devices
390
+
391
+ outlets = device_container.outlets # List of outlet instances
392
+ outlet = outlets[0]
393
+ await outlet.update()
394
+ await outlet.turn_off()
395
+ outlet.display()
396
+
397
+ # Iterate of entire device list
398
+ for devices in device_container:
399
+ device.display()
400
+
401
+
335
402
  if __name__ == "__main__":
336
403
  asyncio.run(main())
337
404
  ```
@@ -1,36 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: pyvesync
3
- Version: 3.0.0rc2
4
- Summary: pyvesync is a library to manage Etekcity Devices, Cosori Air Fryers, and Levoit Air Purifiers run on the VeSync app.
5
- Author: Mark Perdue
6
- Author-email: Joe Trabulsy <webdjoe@gmail.com>
7
- License: MIT
8
- Project-URL: Home Page, https://github.com/webdjoe/pyvesync
9
- Project-URL: Documentation, https://webdjoe.github.io/pyvesync/latest/
10
- Keywords: iot,vesync,levoit,etekcity,cosori,valceno
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Intended Audience :: Developers
13
- Classifier: Natural Language :: English
14
- Classifier: Topic :: Home Automation
15
- Requires-Python: >=3.11
16
- Description-Content-Type: text/markdown
17
- License-File: LICENSE
18
- Requires-Dist: aiohttp>=3.8.1
19
- Requires-Dist: mashumaro[orjson]>=3.13.1
20
- Requires-Dist: python-dateutil>=2.8.1
21
- Provides-Extra: dev
22
- Requires-Dist: pytest; extra == "dev"
23
- Requires-Dist: pytest-cov; extra == "dev"
24
- Requires-Dist: pyyaml; extra == "dev"
25
- Requires-Dist: tox; extra == "dev"
26
- Requires-Dist: aiofiles; extra == "dev"
27
- Provides-Extra: docs
28
- Requires-Dist: mkdocstrings-python; extra == "docs"
29
- Requires-Dist: mkdocs; extra == "docs"
30
- Requires-Dist: mkdocs-material; extra == "docs"
31
- Requires-Dist: mkdocstrings; extra == "docs"
32
- Dynamic: license-file
33
-
34
1
  # pyvesync [![build status](https://img.shields.io/pypi/v/pyvesync.svg)](https://pypi.python.org/pypi/pyvesync) [![Build Status](https://dev.azure.com/webdjoe/pyvesync/_apis/build/status/webdjoe.pyvesync?branchName=master)](https://dev.azure.com/webdjoe/pyvesync/_build/latest?definitionId=4&branchName=master) [![Open Source? Yes!](https://badgen.net/badge/Open%20Source%20%3F/Yes%21/blue?icon=github)](https://github.com/Naereen/badges/) [![PyPI license](https://img.shields.io/pypi/l/ansicolortags.svg)](https://pypi.python.org/pypi/ansicolortags/) <!-- omit in toc -->
35
2
 
36
3
  pyvesync is a library to manage VeSync compatible [smart home devices](#supported-devices)
@@ -179,13 +146,14 @@ The VeSync signature is:
179
146
  VeSync(
180
147
  username: str,
181
148
  password: str,
149
+ country_code: str = DEFAULT_COUNTRY_CODE, # US
182
150
  session: ClientSession | None = None,
183
151
  time_zone: str = DEFAULT_TZ # America/New_York
152
+ debug: bool = False,
153
+ redact: bool = True,
184
154
  )
185
155
  ```
186
156
 
187
- The VeSync class no longer accepts a `debug` or `redact` argument. To set debug the library set `manager.debug = True` to the instance and `manager.redact = True`.
188
-
189
157
  ### Product Types
190
158
 
191
159
  There is a new nomenclature for product types that defines the device class. The
@@ -332,6 +300,59 @@ async def main():
332
300
  device.display()
333
301
 
334
302
 
303
+ if __name__ == "__main__":
304
+ asyncio.run(main())
305
+ ```
306
+
307
+ If you want to reuse your token and account_id between runs. The `VeSync.auth` object holds the credentials and helper methods to save and load credentials.
308
+
309
+ ```python
310
+ import asyncio
311
+ from pyvesync import VeSync
312
+ from pyvesync.logs import VeSyncLoginError
313
+
314
+ # VeSync is an asynchronous context manager
315
+ # VeSync(username, password, debug=False, redact=True, session=None)
316
+
317
+ async def main():
318
+ async with VeSync("user", "password") as manager:
319
+
320
+ # If credentials are stored in a file, it can be loaded
321
+ # the default location is ~/.vesync_token
322
+ await manager.load_credentials_from_file()
323
+ # or the file path can be passed
324
+ await manager.load_credentials_from_file("/path/to/token_file")
325
+
326
+ # Or credentials can be passed directly
327
+ manager.set_credentials("your_token", "your_account_id")
328
+
329
+ # No login needed
330
+ # await manager.login()
331
+
332
+ # To store credentials to a file after login
333
+ await manager.save_credentials() # Saves to default location ~/.vesync_token
334
+ # or pass a file path
335
+ await manager.save_credentials("/path/to/token_file")
336
+
337
+ # Output Credentials as JSON String
338
+ await manager.output_credentials()
339
+
340
+ await manager.update()
341
+
342
+ # Acts as a set of device instances
343
+ device_container = manager.devices
344
+
345
+ outlets = device_container.outlets # List of outlet instances
346
+ outlet = outlets[0]
347
+ await outlet.update()
348
+ await outlet.turn_off()
349
+ outlet.display()
350
+
351
+ # Iterate of entire device list
352
+ for devices in device_container:
353
+ device.display()
354
+
355
+
335
356
  if __name__ == "__main__":
336
357
  asyncio.run(main())
337
358
  ```
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyvesync"
7
- version = "3.0.0rc2"
7
+ version = "3.1.0"
8
8
  description = "pyvesync is a library to manage Etekcity Devices, Cosori Air Fryers, and Levoit Air Purifiers run on the VeSync app."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -23,7 +23,6 @@ classifiers = [
23
23
  dependencies = [
24
24
  "aiohttp>=3.8.1",
25
25
  "mashumaro[orjson]>=3.13.1",
26
- "python-dateutil>=2.8.1"
27
26
  ]
28
27
 
29
28
  [project.urls]
@@ -35,14 +34,28 @@ dev = [
35
34
  "pytest",
36
35
  "pytest-cov",
37
36
  "pyyaml",
37
+ "pylint",
38
+ "mypy",
39
+ "ruff",
40
+ "pre-commit",
38
41
  "tox",
42
+ "requests",
39
43
  "aiofiles"
40
44
  ]
41
45
  docs = [
42
46
  "mkdocstrings-python",
43
47
  "mkdocs",
48
+ "ruff",
49
+ "Pygments",
44
50
  "mkdocs-material",
45
51
  "mkdocstrings",
52
+ "mkdocs-include-markdown-plugin",
53
+ "mkdocs-material-extensions",
54
+ "pymdown-extensions",
55
+ "mike",
56
+ "mkdocs-git-revision-date-localized-plugin",
57
+ "docstring-inheritance",
58
+ "mkdocs-autoref"
46
59
  ]
47
60
 
48
61
  [tool.setuptools.packages.find]
@@ -56,6 +69,29 @@ norecursedirs = ["*.egg-info", ".git", ".tox", "dist", "build", "venv"]
56
69
  pythonpath = "src"
57
70
  log_cli = true
58
71
 
72
+ [tool.coverage.run]
73
+ branch = true
74
+ omit = [
75
+ "test/*",
76
+ "src/tests/*",
77
+ "testing_scripts/*"
78
+ ]
79
+
80
+ [tool.coverage.report]
81
+ exclude_also = [
82
+ 'pragma: no cover',
83
+ 'if self\\.debug',
84
+ "def __repr__",
85
+ "def __str__",
86
+ "def __eq__",
87
+ "def __hash__",
88
+ "def firmware_update",
89
+ "def get_config",
90
+ "raise AssertionError",
91
+ "raise NotImplementedError",
92
+ "@(abc\\.)?abstractmethod",
93
+ ]
94
+
59
95
  [tool.pylint.MAIN]
60
96
  persistent = false
61
97
  ignore-paths = ["^test\\.*$"]
@@ -2,5 +2,4 @@
2
2
 
3
3
  from setuptools import setup
4
4
 
5
-
6
5
  setup()
@@ -0,0 +1,5 @@
1
+ """VeSync API Library."""
2
+
3
+ from pyvesync.vesync import VeSync
4
+
5
+ __all__ = ['VeSync']