pyvesync 3.0.0rc2__tar.gz → 3.0.0rc3__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.
- {pyvesync-3.0.0rc2/src/pyvesync.egg-info → pyvesync-3.0.0rc3}/PKG-INFO +15 -1
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/pyproject.toml +15 -1
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/setup.py +0 -1
- pyvesync-3.0.0rc3/src/pyvesync/__init__.py +5 -0
- pyvesync-3.0.0rc3/src/pyvesync/base_devices/__init__.py +35 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/base_devices/bulb_base.py +35 -37
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/base_devices/fan_base.py +44 -41
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/base_devices/fryer_base.py +10 -12
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/base_devices/humidifier_base.py +60 -53
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/base_devices/outlet_base.py +56 -44
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/base_devices/purifier_base.py +66 -70
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/base_devices/switch_base.py +36 -35
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/base_devices/thermostat_base.py +42 -41
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/base_devices/vesyncbasedevice.py +92 -101
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/const.py +157 -148
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/device_container.py +54 -41
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/device_map.py +307 -308
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/devices/vesyncbulb.py +204 -223
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/devices/vesyncfan.py +43 -60
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/devices/vesynchumidifier.py +154 -133
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/devices/vesynckitchen.py +148 -161
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/devices/vesyncoutlet.py +171 -182
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/devices/vesyncpurifier.py +146 -185
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/devices/vesyncswitch.py +70 -102
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/devices/vesyncthermostat.py +39 -48
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/base_models.py +17 -14
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/bulb_models.py +15 -10
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/bypass_models.py +14 -10
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/fan_models.py +3 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/fryer_models.py +3 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/home_models.py +6 -4
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/humidifier_models.py +8 -4
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/outlet_models.py +8 -5
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/purifier_models.py +11 -7
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/switch_models.py +6 -2
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/thermostat_models.py +29 -27
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/vesync_models.py +26 -24
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/utils/colors.py +29 -33
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/utils/device_mixins.py +62 -67
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/utils/enum_utils.py +2 -1
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/utils/errors.py +330 -328
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/utils/helpers.py +48 -44
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/utils/logs.py +77 -69
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/vesync.py +88 -77
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/vesynchome.py +30 -40
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3/src/pyvesync.egg-info}/PKG-INFO +15 -1
- pyvesync-3.0.0rc3/src/pyvesync.egg-info/requires.txt +30 -0
- pyvesync-3.0.0rc2/src/pyvesync/__init__.py +0 -11
- pyvesync-3.0.0rc2/src/pyvesync/base_devices/__init__.py +0 -35
- pyvesync-3.0.0rc2/src/pyvesync.egg-info/requires.txt +0 -16
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/LICENSE +0 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/MANIFEST.in +0 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/README.md +0 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/requirements.txt +0 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/setup.cfg +0 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/devices/__init__.py +0 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/models/__init__.py +0 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync/utils/__init__.py +0 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync.egg-info/SOURCES.txt +0 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/src/pyvesync.egg-info/dependency_links.txt +0 -0
- {pyvesync-3.0.0rc2 → pyvesync-3.0.0rc3}/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.
|
|
3
|
+
Version: 3.0.0rc3
|
|
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>
|
|
@@ -22,13 +22,27 @@ Provides-Extra: dev
|
|
|
22
22
|
Requires-Dist: pytest; extra == "dev"
|
|
23
23
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
24
24
|
Requires-Dist: pyyaml; extra == "dev"
|
|
25
|
+
Requires-Dist: pylint; extra == "dev"
|
|
26
|
+
Requires-Dist: mypy; extra == "dev"
|
|
27
|
+
Requires-Dist: ruff; extra == "dev"
|
|
28
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
25
29
|
Requires-Dist: tox; extra == "dev"
|
|
30
|
+
Requires-Dist: requests; extra == "dev"
|
|
26
31
|
Requires-Dist: aiofiles; extra == "dev"
|
|
27
32
|
Provides-Extra: docs
|
|
28
33
|
Requires-Dist: mkdocstrings-python; extra == "docs"
|
|
29
34
|
Requires-Dist: mkdocs; extra == "docs"
|
|
35
|
+
Requires-Dist: ruff; extra == "docs"
|
|
36
|
+
Requires-Dist: Pygments; extra == "docs"
|
|
30
37
|
Requires-Dist: mkdocs-material; extra == "docs"
|
|
31
38
|
Requires-Dist: mkdocstrings; extra == "docs"
|
|
39
|
+
Requires-Dist: mkdocs-include-markdown-plugin; extra == "docs"
|
|
40
|
+
Requires-Dist: mkdocs-material-extensions; extra == "docs"
|
|
41
|
+
Requires-Dist: pymdown-extensions; extra == "docs"
|
|
42
|
+
Requires-Dist: mike; extra == "docs"
|
|
43
|
+
Requires-Dist: mkdocs-git-revision-date-localized-plugin; extra == "docs"
|
|
44
|
+
Requires-Dist: docstring-inheritance; extra == "docs"
|
|
45
|
+
Requires-Dist: mkdocs-autoref; extra == "docs"
|
|
32
46
|
Dynamic: license-file
|
|
33
47
|
|
|
34
48
|
# pyvesync [](https://pypi.python.org/pypi/pyvesync) [](https://dev.azure.com/webdjoe/pyvesync/_build/latest?definitionId=4&branchName=master) [](https://github.com/Naereen/badges/) [](https://pypi.python.org/pypi/ansicolortags/) <!-- omit in toc -->
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pyvesync"
|
|
7
|
-
version = "3.0.
|
|
7
|
+
version = "3.0.0rc3"
|
|
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"
|
|
@@ -35,14 +35,28 @@ dev = [
|
|
|
35
35
|
"pytest",
|
|
36
36
|
"pytest-cov",
|
|
37
37
|
"pyyaml",
|
|
38
|
+
"pylint",
|
|
39
|
+
"mypy",
|
|
40
|
+
"ruff",
|
|
41
|
+
"pre-commit",
|
|
38
42
|
"tox",
|
|
43
|
+
"requests",
|
|
39
44
|
"aiofiles"
|
|
40
45
|
]
|
|
41
46
|
docs = [
|
|
42
47
|
"mkdocstrings-python",
|
|
43
48
|
"mkdocs",
|
|
49
|
+
"ruff",
|
|
50
|
+
"Pygments",
|
|
44
51
|
"mkdocs-material",
|
|
45
52
|
"mkdocstrings",
|
|
53
|
+
"mkdocs-include-markdown-plugin",
|
|
54
|
+
"mkdocs-material-extensions",
|
|
55
|
+
"pymdown-extensions",
|
|
56
|
+
"mike",
|
|
57
|
+
"mkdocs-git-revision-date-localized-plugin",
|
|
58
|
+
"docstring-inheritance",
|
|
59
|
+
"mkdocs-autoref"
|
|
46
60
|
]
|
|
47
61
|
|
|
48
62
|
[tool.setuptools.packages.find]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Base devices and state classes for VeSync devices.
|
|
2
|
+
|
|
3
|
+
This module contains the base classes for VeSync devices, as well as the state classes
|
|
4
|
+
for each device type. The base classes are used to create the device objects, while the
|
|
5
|
+
state classes are used to store the current state of the device.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .bulb_base import BulbState, VeSyncBulb
|
|
9
|
+
from .fan_base import FanState, VeSyncFanBase
|
|
10
|
+
from .fryer_base import FryerState, VeSyncFryer
|
|
11
|
+
from .humidifier_base import HumidifierState, VeSyncHumidifier
|
|
12
|
+
from .outlet_base import OutletState, VeSyncOutlet
|
|
13
|
+
from .purifier_base import PurifierState, VeSyncPurifier
|
|
14
|
+
from .switch_base import SwitchState, VeSyncSwitch
|
|
15
|
+
from .vesyncbasedevice import DeviceState, VeSyncBaseDevice, VeSyncBaseToggleDevice
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
'BulbState',
|
|
19
|
+
'DeviceState',
|
|
20
|
+
'FanState',
|
|
21
|
+
'FryerState',
|
|
22
|
+
'HumidifierState',
|
|
23
|
+
'OutletState',
|
|
24
|
+
'PurifierState',
|
|
25
|
+
'SwitchState',
|
|
26
|
+
'VeSyncBaseDevice',
|
|
27
|
+
'VeSyncBaseToggleDevice',
|
|
28
|
+
'VeSyncBulb',
|
|
29
|
+
'VeSyncFanBase',
|
|
30
|
+
'VeSyncFryer',
|
|
31
|
+
'VeSyncHumidifier',
|
|
32
|
+
'VeSyncOutlet',
|
|
33
|
+
'VeSyncPurifier',
|
|
34
|
+
'VeSyncSwitch',
|
|
35
|
+
]
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"""Base classes for all VeSync bulbs."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
4
|
+
|
|
3
5
|
import logging
|
|
4
6
|
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
5
8
|
from typing_extensions import deprecated
|
|
6
9
|
|
|
7
|
-
from pyvesync.base_devices.vesyncbasedevice import
|
|
10
|
+
from pyvesync.base_devices.vesyncbasedevice import DeviceState, VeSyncBaseToggleDevice
|
|
11
|
+
from pyvesync.const import BulbFeatures
|
|
8
12
|
from pyvesync.utils.colors import HSV, RGB, Color
|
|
9
13
|
from pyvesync.utils.helpers import Converters, Validators
|
|
10
|
-
from pyvesync.const import BulbFeatures
|
|
11
14
|
|
|
12
15
|
if TYPE_CHECKING:
|
|
13
16
|
from pyvesync import VeSync
|
|
14
|
-
from pyvesync.models.vesync_models import ResponseDeviceDetailsModel
|
|
15
17
|
from pyvesync.device_map import BulbMap
|
|
18
|
+
from pyvesync.models.vesync_models import ResponseDeviceDetailsModel
|
|
16
19
|
|
|
17
20
|
|
|
18
21
|
logger = logging.getLogger(__name__)
|
|
@@ -63,18 +66,14 @@ class BulbState(DeviceState):
|
|
|
63
66
|
- [`BulbMap`][pyvesync.device_map.BulbMap]
|
|
64
67
|
"""
|
|
65
68
|
|
|
66
|
-
__slots__ = (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
def __init__(self,
|
|
75
|
-
device: VeSyncBulb,
|
|
76
|
-
details: ResponseDeviceDetailsModel,
|
|
77
|
-
feature_map: BulbMap) -> None:
|
|
69
|
+
__slots__ = ('_brightness', '_color', '_color_temp', 'color_mode', 'color_modes')
|
|
70
|
+
|
|
71
|
+
def __init__(
|
|
72
|
+
self,
|
|
73
|
+
device: VeSyncBulb,
|
|
74
|
+
details: ResponseDeviceDetailsModel,
|
|
75
|
+
feature_map: BulbMap,
|
|
76
|
+
) -> None:
|
|
78
77
|
"""Initialize VeSync Bulb State Base."""
|
|
79
78
|
super().__init__(device, details, feature_map)
|
|
80
79
|
self._exclude_serialization: list[str] = ['rgb', 'hsv']
|
|
@@ -130,14 +129,14 @@ class BulbState(DeviceState):
|
|
|
130
129
|
def brightness(self) -> int | None:
|
|
131
130
|
"""Brightness of vesync bulb 0-100."""
|
|
132
131
|
if not self.device.supports_brightness:
|
|
133
|
-
logger.warning(
|
|
132
|
+
logger.warning('Brightness not supported by this bulb')
|
|
134
133
|
return None
|
|
135
134
|
return self._brightness
|
|
136
135
|
|
|
137
136
|
@brightness.setter
|
|
138
137
|
def brightness(self, value: int | None) -> None:
|
|
139
138
|
if not self.device.supports_brightness:
|
|
140
|
-
logger.warning(
|
|
139
|
+
logger.warning('Brightness not supported by this bulb')
|
|
141
140
|
return
|
|
142
141
|
if Validators.validate_zero_to_hundred(value):
|
|
143
142
|
self._brightness = value
|
|
@@ -148,25 +147,25 @@ class BulbState(DeviceState):
|
|
|
148
147
|
def color_temp(self) -> int | None:
|
|
149
148
|
"""White color temperature of bulb in percent (0-100)."""
|
|
150
149
|
if not self.device.supports_color_temp:
|
|
151
|
-
logger.warning(
|
|
150
|
+
logger.warning('Color temperature not supported by this bulb')
|
|
152
151
|
return None
|
|
153
152
|
return self._color_temp
|
|
154
153
|
|
|
155
154
|
@color_temp.setter
|
|
156
155
|
def color_temp(self, value: int) -> None:
|
|
157
156
|
if not self.device.supports_color_temp:
|
|
158
|
-
logger.warning(
|
|
157
|
+
logger.warning('Color temperature not supported by this bulb')
|
|
159
158
|
return
|
|
160
159
|
if Validators.validate_zero_to_hundred(value):
|
|
161
160
|
self._color_temp = value
|
|
162
161
|
else:
|
|
163
|
-
logger.warning(
|
|
162
|
+
logger.warning('Color temperature must be between 0 and 100')
|
|
164
163
|
|
|
165
164
|
@property
|
|
166
165
|
def color_temp_kelvin(self) -> int | None:
|
|
167
166
|
"""Return white color temperature of bulb in Kelvin."""
|
|
168
167
|
if not self.device.supports_color_temp:
|
|
169
|
-
logger.warning(
|
|
168
|
+
logger.warning('Color temperature not supported by this bulb')
|
|
170
169
|
return None
|
|
171
170
|
if self._color_temp is not None:
|
|
172
171
|
return Converters.color_temp_pct_to_kelvin(self._color_temp)
|
|
@@ -210,10 +209,9 @@ class VeSyncBulb(VeSyncBaseToggleDevice[BulbState]):
|
|
|
210
209
|
|
|
211
210
|
__slots__ = ()
|
|
212
211
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
manager: VeSync, feature_map: BulbMap) -> None:
|
|
212
|
+
def __init__(
|
|
213
|
+
self, details: ResponseDeviceDetailsModel, manager: VeSync, feature_map: BulbMap
|
|
214
|
+
) -> None:
|
|
217
215
|
"""Initialize VeSync smart bulb base class."""
|
|
218
216
|
super().__init__(details, manager, feature_map)
|
|
219
217
|
self.state: BulbState = BulbState(self, details, feature_map)
|
|
@@ -246,9 +244,9 @@ class VeSyncBulb(VeSyncBaseToggleDevice[BulbState]):
|
|
|
246
244
|
"""
|
|
247
245
|
del hue, saturation, value
|
|
248
246
|
if not self.supports_multicolor:
|
|
249
|
-
logger.debug(
|
|
247
|
+
logger.debug('Color mode is not supported on this bulb.')
|
|
250
248
|
else:
|
|
251
|
-
logger.debug(
|
|
249
|
+
logger.debug('set_hsv not configured for %s bulb', self.device_type)
|
|
252
250
|
return False
|
|
253
251
|
|
|
254
252
|
async def set_rgb(self, red: float, green: float, blue: float) -> bool:
|
|
@@ -264,9 +262,9 @@ class VeSyncBulb(VeSyncBaseToggleDevice[BulbState]):
|
|
|
264
262
|
"""
|
|
265
263
|
del red, green, blue
|
|
266
264
|
if not self.supports_multicolor:
|
|
267
|
-
logger.debug(
|
|
265
|
+
logger.debug('Color mode is not supported on this bulb.')
|
|
268
266
|
else:
|
|
269
|
-
logger.debug(
|
|
267
|
+
logger.debug('set_rgb not configured for %s bulb', self.device_type)
|
|
270
268
|
return False
|
|
271
269
|
|
|
272
270
|
async def set_brightness(self, brightness: int) -> bool:
|
|
@@ -279,7 +277,7 @@ class VeSyncBulb(VeSyncBaseToggleDevice[BulbState]):
|
|
|
279
277
|
bool: True if successful, False otherwise.
|
|
280
278
|
"""
|
|
281
279
|
del brightness
|
|
282
|
-
logger.warning(
|
|
280
|
+
logger.warning('Brightness not supported/configured by this bulb')
|
|
283
281
|
return False
|
|
284
282
|
|
|
285
283
|
async def set_color_temp(self, color_temp: int) -> bool:
|
|
@@ -293,9 +291,9 @@ class VeSyncBulb(VeSyncBaseToggleDevice[BulbState]):
|
|
|
293
291
|
"""
|
|
294
292
|
del color_temp
|
|
295
293
|
if self.supports_color_temp:
|
|
296
|
-
logger.debug(
|
|
294
|
+
logger.debug('Color temperature is not configured on this bulb.')
|
|
297
295
|
else:
|
|
298
|
-
logger.debug(
|
|
296
|
+
logger.debug('Color temperature not supported by this bulb')
|
|
299
297
|
return False
|
|
300
298
|
|
|
301
299
|
async def set_white_mode(self) -> bool:
|
|
@@ -305,9 +303,9 @@ class VeSyncBulb(VeSyncBaseToggleDevice[BulbState]):
|
|
|
305
303
|
bool: True if successful, False otherwise.
|
|
306
304
|
"""
|
|
307
305
|
if self.supports_multicolor:
|
|
308
|
-
logger.debug(
|
|
306
|
+
logger.debug('White mode is not configured on this bulb.')
|
|
309
307
|
else:
|
|
310
|
-
logger.warning(
|
|
308
|
+
logger.warning('White mode not supported by this bulb')
|
|
311
309
|
return False
|
|
312
310
|
|
|
313
311
|
async def set_color_mode(self, color_mode: str) -> bool:
|
|
@@ -321,12 +319,12 @@ class VeSyncBulb(VeSyncBaseToggleDevice[BulbState]):
|
|
|
321
319
|
"""
|
|
322
320
|
del color_mode
|
|
323
321
|
if self.supports_multicolor:
|
|
324
|
-
logger.debug(
|
|
322
|
+
logger.debug('Color mode is not configured on this bulb.')
|
|
325
323
|
else:
|
|
326
|
-
logger.warning(
|
|
324
|
+
logger.warning('Color mode not supported by this bulb')
|
|
327
325
|
return False
|
|
328
326
|
|
|
329
|
-
@deprecated(
|
|
327
|
+
@deprecated('Use `set_white_mode` instead.')
|
|
330
328
|
async def enable_white_mode(self) -> bool:
|
|
331
329
|
"""Enable white mode if supported by bulb."""
|
|
332
330
|
return await self.set_white_mode()
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"""Fan Devices Base Class (NOT purifiers or humidifiers)."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
4
|
+
|
|
3
5
|
import logging
|
|
4
|
-
from typing import TYPE_CHECKING
|
|
5
6
|
from abc import abstractmethod
|
|
7
|
+
from typing import TYPE_CHECKING
|
|
8
|
+
|
|
6
9
|
from typing_extensions import deprecated
|
|
7
10
|
|
|
8
|
-
from pyvesync.base_devices.vesyncbasedevice import
|
|
9
|
-
from pyvesync.const import
|
|
11
|
+
from pyvesync.base_devices.vesyncbasedevice import DeviceState, VeSyncBaseToggleDevice
|
|
12
|
+
from pyvesync.const import FanFeatures, FanModes
|
|
10
13
|
|
|
11
14
|
if TYPE_CHECKING:
|
|
12
15
|
from pyvesync import VeSync
|
|
13
|
-
from pyvesync.models.vesync_models import ResponseDeviceDetailsModel
|
|
14
16
|
from pyvesync.device_map import FanMap
|
|
17
|
+
from pyvesync.models.vesync_models import ResponseDeviceDetailsModel
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
logger = logging.getLogger(__name__)
|
|
@@ -45,23 +48,23 @@ class FanState(DeviceState):
|
|
|
45
48
|
"""
|
|
46
49
|
|
|
47
50
|
__slots__ = (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
'display_set_status',
|
|
52
|
+
'display_status',
|
|
53
|
+
'displaying_type',
|
|
54
|
+
'fan_level',
|
|
55
|
+
'fan_set_level',
|
|
56
|
+
'humidity',
|
|
57
|
+
'mode',
|
|
58
|
+
'mute_set_status',
|
|
59
|
+
'mute_status',
|
|
60
|
+
'oscillation_set_status',
|
|
61
|
+
'oscillation_status',
|
|
62
|
+
'sleep_change_fan_level',
|
|
63
|
+
'sleep_fallasleep_remain',
|
|
64
|
+
'sleep_oscillation_switch',
|
|
65
|
+
'sleep_preference_type',
|
|
66
|
+
'temperature',
|
|
67
|
+
'thermal_comfort',
|
|
65
68
|
)
|
|
66
69
|
|
|
67
70
|
def __init__(
|
|
@@ -111,9 +114,9 @@ class VeSyncFanBase(VeSyncBaseToggleDevice):
|
|
|
111
114
|
"""
|
|
112
115
|
|
|
113
116
|
__slots__ = (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
'fan_levels',
|
|
118
|
+
'modes',
|
|
119
|
+
'sleep_preferences',
|
|
117
120
|
)
|
|
118
121
|
|
|
119
122
|
def __init__(
|
|
@@ -216,7 +219,7 @@ class VeSyncFanBase(VeSyncBaseToggleDevice):
|
|
|
216
219
|
"""
|
|
217
220
|
if FanModes.AUTO in self.modes:
|
|
218
221
|
return await self.set_mode(FanModes.AUTO)
|
|
219
|
-
logger.warning(
|
|
222
|
+
logger.warning('Auto mode not supported for this device.')
|
|
220
223
|
return False
|
|
221
224
|
|
|
222
225
|
async def set_advanced_sleep_mode(self) -> bool:
|
|
@@ -231,7 +234,7 @@ class VeSyncFanBase(VeSyncBaseToggleDevice):
|
|
|
231
234
|
"""
|
|
232
235
|
if FanModes.ADVANCED_SLEEP in self.modes:
|
|
233
236
|
return await self.set_mode(FanModes.ADVANCED_SLEEP)
|
|
234
|
-
logger.warning(
|
|
237
|
+
logger.warning('Advanced Sleep mode not supported for this device.')
|
|
235
238
|
return False
|
|
236
239
|
|
|
237
240
|
async def set_sleep_mode(self) -> bool:
|
|
@@ -248,7 +251,7 @@ class VeSyncFanBase(VeSyncBaseToggleDevice):
|
|
|
248
251
|
"""
|
|
249
252
|
if FanModes.ADVANCED_SLEEP in self.modes:
|
|
250
253
|
return await self.set_mode(FanModes.ADVANCED_SLEEP)
|
|
251
|
-
logger.warning(
|
|
254
|
+
logger.warning('Sleep mode not supported for this device.')
|
|
252
255
|
return False
|
|
253
256
|
|
|
254
257
|
async def set_manual_mode(self) -> bool:
|
|
@@ -263,7 +266,7 @@ class VeSyncFanBase(VeSyncBaseToggleDevice):
|
|
|
263
266
|
"""
|
|
264
267
|
if FanModes.NORMAL in self.modes:
|
|
265
268
|
return await self.set_mode(FanModes.NORMAL)
|
|
266
|
-
logger.warning(
|
|
269
|
+
logger.warning('Manual mode not supported for this device.')
|
|
267
270
|
return False
|
|
268
271
|
|
|
269
272
|
async def set_normal_mode(self) -> bool:
|
|
@@ -278,7 +281,7 @@ class VeSyncFanBase(VeSyncBaseToggleDevice):
|
|
|
278
281
|
"""
|
|
279
282
|
if FanModes.NORMAL in self.modes:
|
|
280
283
|
return await self.set_mode(FanModes.NORMAL)
|
|
281
|
-
logger.warning(
|
|
284
|
+
logger.warning('Normal mode not supported for this device.')
|
|
282
285
|
return False
|
|
283
286
|
|
|
284
287
|
async def set_turbo_mode(self) -> bool:
|
|
@@ -293,7 +296,7 @@ class VeSyncFanBase(VeSyncBaseToggleDevice):
|
|
|
293
296
|
"""
|
|
294
297
|
if FanModes.TURBO in self.modes:
|
|
295
298
|
return await self.set_mode(FanModes.TURBO)
|
|
296
|
-
logger.warning(
|
|
299
|
+
logger.warning('Turbo mode not supported for this device.')
|
|
297
300
|
return False
|
|
298
301
|
|
|
299
302
|
async def toggle_oscillation(self, toggle: bool) -> bool:
|
|
@@ -307,9 +310,9 @@ class VeSyncFanBase(VeSyncBaseToggleDevice):
|
|
|
307
310
|
"""
|
|
308
311
|
del toggle
|
|
309
312
|
if self.supports_oscillation:
|
|
310
|
-
logger.debug(
|
|
313
|
+
logger.debug('Oscillation not configured for this device.')
|
|
311
314
|
else:
|
|
312
|
-
logger.debug(
|
|
315
|
+
logger.debug('Oscillation not supported for this device.')
|
|
313
316
|
return False
|
|
314
317
|
|
|
315
318
|
async def turn_on_oscillation(self) -> bool:
|
|
@@ -332,9 +335,9 @@ class VeSyncFanBase(VeSyncBaseToggleDevice):
|
|
|
332
335
|
"""
|
|
333
336
|
del toggle
|
|
334
337
|
if self.supports_mute:
|
|
335
|
-
logger.debug(
|
|
338
|
+
logger.debug('Mute not configured for this device.')
|
|
336
339
|
else:
|
|
337
|
-
logger.debug(
|
|
340
|
+
logger.debug('Mute not supported for this device.')
|
|
338
341
|
return False
|
|
339
342
|
|
|
340
343
|
async def turn_on_mute(self) -> bool:
|
|
@@ -358,32 +361,32 @@ class VeSyncFanBase(VeSyncBaseToggleDevice):
|
|
|
358
361
|
"""
|
|
359
362
|
del toggle
|
|
360
363
|
if self.supports_displaying_type:
|
|
361
|
-
logger.debug(
|
|
364
|
+
logger.debug('Displaying type not configured for this device.')
|
|
362
365
|
else:
|
|
363
|
-
logger.debug(
|
|
366
|
+
logger.debug('Displaying type not supported for this device.')
|
|
364
367
|
return False
|
|
365
368
|
|
|
366
|
-
@deprecated(
|
|
369
|
+
@deprecated('Use `set_normal_mode` method instead')
|
|
367
370
|
async def normal_mode(self) -> bool:
|
|
368
371
|
"""Set mode to normal."""
|
|
369
372
|
return await self.set_normal_mode()
|
|
370
373
|
|
|
371
|
-
@deprecated(
|
|
374
|
+
@deprecated('Use `set_manual_mode` method instead')
|
|
372
375
|
async def manual_mode(self) -> bool:
|
|
373
376
|
"""Adapter to set mode to normal."""
|
|
374
377
|
return await self.set_normal_mode()
|
|
375
378
|
|
|
376
|
-
@deprecated(
|
|
379
|
+
@deprecated('Use `set_advanced_sleep_mode` method instead')
|
|
377
380
|
async def advanced_sleep_mode(self) -> bool:
|
|
378
381
|
"""Set advanced sleep mode."""
|
|
379
382
|
return await self.set_mode('advancedSleep')
|
|
380
383
|
|
|
381
|
-
@deprecated(
|
|
384
|
+
@deprecated('Use `set_sleep_mode` method instead')
|
|
382
385
|
async def sleep_mode(self) -> bool:
|
|
383
386
|
"""Adapter to set advanced sleep mode."""
|
|
384
387
|
return await self.set_advanced_sleep_mode()
|
|
385
388
|
|
|
386
|
-
@deprecated(
|
|
389
|
+
@deprecated('Use `set_mode` method instead')
|
|
387
390
|
async def mode_toggle(self, mode: str) -> bool:
|
|
388
391
|
"""Set mode to specified mode."""
|
|
389
392
|
return await self.set_mode(mode)
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"""Air Purifier Base Class."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
4
|
+
|
|
3
5
|
import logging
|
|
4
6
|
from typing import TYPE_CHECKING
|
|
5
7
|
|
|
6
|
-
from pyvesync.base_devices.vesyncbasedevice import
|
|
7
|
-
# from pyvesync.const import (
|
|
8
|
-
# IntFlag,
|
|
9
|
-
# StrFlag,
|
|
10
|
-
# )
|
|
8
|
+
from pyvesync.base_devices.vesyncbasedevice import DeviceState, VeSyncBaseDevice
|
|
11
9
|
|
|
12
10
|
if TYPE_CHECKING:
|
|
13
11
|
from pyvesync import VeSync
|
|
14
|
-
from pyvesync.models.vesync_models import ResponseDeviceDetailsModel
|
|
15
12
|
from pyvesync.device_map import AirFryerMap
|
|
16
|
-
|
|
13
|
+
from pyvesync.models.vesync_models import ResponseDeviceDetailsModel
|
|
17
14
|
|
|
18
15
|
|
|
19
16
|
logger = logging.getLogger(__name__)
|
|
@@ -28,10 +25,12 @@ class FryerState(DeviceState):
|
|
|
28
25
|
|
|
29
26
|
__slots__ = ()
|
|
30
27
|
|
|
31
|
-
def __init__(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
device: VeSyncFryer,
|
|
31
|
+
details: ResponseDeviceDetailsModel,
|
|
32
|
+
feature_map: AirFryerMap,
|
|
33
|
+
) -> None:
|
|
35
34
|
"""Initialize FryerState.
|
|
36
35
|
|
|
37
36
|
Args:
|
|
@@ -67,4 +66,3 @@ class VeSyncFryer(VeSyncBaseDevice):
|
|
|
67
66
|
This is a bare class as there is only one supported air fryer model.
|
|
68
67
|
"""
|
|
69
68
|
super().__init__(details, manager, feature_map)
|
|
70
|
-
# self.state: FryerState = FryerState(self, details, feature_map)
|