pyvesync 3.5.0__tar.gz → 3.5.1__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.5.0/src/pyvesync.egg-info → pyvesync-3.5.1}/PKG-INFO +1 -1
- {pyvesync-3.5.0 → pyvesync-3.5.1}/pyproject.toml +1 -1
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/base_devices/fryer_base.py +58 -7
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/const.py +57 -6
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/device_container.py +1 -1
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/device_map.py +47 -16
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/devices/vesynchumidifier.py +1 -1
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/devices/vesynckitchen.py +160 -27
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/fryer_models.py +6 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/utils/logs.py +1 -1
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/vesync.py +41 -36
- {pyvesync-3.5.0 → pyvesync-3.5.1/src/pyvesync.egg-info}/PKG-INFO +1 -1
- {pyvesync-3.5.0 → pyvesync-3.5.1}/LICENSE +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/MANIFEST.in +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/README.md +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/requirements.txt +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/setup.cfg +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/setup.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/__init__.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/auth.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/base_devices/__init__.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/base_devices/bulb_base.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/base_devices/fan_base.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/base_devices/humidifier_base.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/base_devices/outlet_base.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/base_devices/purifier_base.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/base_devices/switch_base.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/base_devices/thermostat_base.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/base_devices/vesyncbasedevice.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/devices/__init__.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/devices/vesyncbulb.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/devices/vesyncfan.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/devices/vesyncoutlet.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/devices/vesyncpurifier.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/devices/vesyncswitch.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/devices/vesyncthermostat.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/__init__.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/base_models.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/bulb_models.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/bypass_models.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/fan_models.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/home_models.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/humidifier_models.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/outlet_models.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/purifier_models.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/switch_models.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/thermostat_models.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/models/vesync_models.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/py.typed +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/utils/__init__.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/utils/colors.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/utils/device_mixins.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/utils/enum_utils.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/utils/errors.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/utils/helpers.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync/vesynchome.py +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync.egg-info/SOURCES.txt +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync.egg-info/dependency_links.txt +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/src/pyvesync.egg-info/requires.txt +0 -0
- {pyvesync-3.5.0 → pyvesync-3.5.1}/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.5.
|
|
3
|
+
Version: 3.5.1
|
|
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>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pyvesync"
|
|
7
|
-
version = "3.5.
|
|
7
|
+
version = "3.5.1"
|
|
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"
|
|
@@ -19,6 +19,7 @@ from pyvesync.const import (
|
|
|
19
19
|
AirFryerFeatures,
|
|
20
20
|
AirFryerModeConfig,
|
|
21
21
|
AirFryerPresetRecipe,
|
|
22
|
+
AirFryerSyncType,
|
|
22
23
|
AirFryerTempLimits,
|
|
23
24
|
TemperatureUnits,
|
|
24
25
|
TimeUnits,
|
|
@@ -1062,7 +1063,8 @@ class VeSyncFryer(VeSyncBaseDevice[FryerState]):
|
|
|
1062
1063
|
"""Return a recipe's cook and preheat times as whole seconds.
|
|
1063
1064
|
|
|
1064
1065
|
The cook time must be at least one API time unit (1 second, or
|
|
1065
|
-
60 seconds on minute-based fryers).
|
|
1066
|
+
60 seconds on minute-based fryers). A mode that declares ``time_limits``
|
|
1067
|
+
also requires its range and step. On fryers with the ``PREHEAT``
|
|
1066
1068
|
feature the preheat time, if given, must be 0 or at least one unit.
|
|
1067
1069
|
Other fryers drop it with a debug log.
|
|
1068
1070
|
|
|
@@ -1074,6 +1076,19 @@ class VeSyncFryer(VeSyncBaseDevice[FryerState]):
|
|
|
1074
1076
|
None when not given or not supported), or None (after a warning)
|
|
1075
1077
|
if either is not valid.
|
|
1076
1078
|
"""
|
|
1079
|
+
mode = self.get_cook_mode(recipe.cook_mode)
|
|
1080
|
+
if (
|
|
1081
|
+
mode is not None
|
|
1082
|
+
and mode.time_limits is not None
|
|
1083
|
+
and not mode.time_limits.accepts(recipe.cook_time)
|
|
1084
|
+
):
|
|
1085
|
+
logger.warning(
|
|
1086
|
+
'Cook time %s is outside the limits or steps of %s for %s',
|
|
1087
|
+
recipe.cook_time,
|
|
1088
|
+
mode.api_mode,
|
|
1089
|
+
self.device_name,
|
|
1090
|
+
)
|
|
1091
|
+
return None
|
|
1077
1092
|
minimum = self.convert_time_for_state(1)
|
|
1078
1093
|
try:
|
|
1079
1094
|
cook_time = int(recipe.cook_time)
|
|
@@ -1185,8 +1200,9 @@ class VeSyncFryer(VeSyncBaseDevice[FryerState]):
|
|
|
1185
1200
|
) -> bool:
|
|
1186
1201
|
"""Stop (Pause) the current cooking or preheating session.
|
|
1187
1202
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1203
|
+
Supported by the CS137/CS158 (``VeSyncAirFryer158``) and dual fryers
|
|
1204
|
+
with the ``RESUMABLE`` feature (CAF-DC111S-AEU); other fryers return
|
|
1205
|
+
False without a request. The command is always sent:
|
|
1190
1206
|
the preheat stop when the last known state is a preheat phase,
|
|
1191
1207
|
otherwise the cook stop. Every successful command sets the state to
|
|
1192
1208
|
the phase it sent, so the next command picks the matching one.
|
|
@@ -1207,8 +1223,9 @@ class VeSyncFryer(VeSyncBaseDevice[FryerState]):
|
|
|
1207
1223
|
) -> bool:
|
|
1208
1224
|
"""Resume a paused cooking or preheating session.
|
|
1209
1225
|
|
|
1210
|
-
|
|
1211
|
-
|
|
1226
|
+
Supported by the CS137/CS158 (``VeSyncAirFryer158``) and dual fryers
|
|
1227
|
+
with the ``RESUMABLE`` feature (CAF-DC111S-AEU); other fryers return
|
|
1228
|
+
False without a request. The command is always sent:
|
|
1212
1229
|
the preheat resume when the last known state is a preheat phase,
|
|
1213
1230
|
otherwise the cook resume. The remaining time carries over, so a
|
|
1214
1231
|
resume while running does not restart the countdown.
|
|
@@ -1247,8 +1264,9 @@ class VeSyncFryer(VeSyncBaseDevice[FryerState]):
|
|
|
1247
1264
|
cook_time (int): The cooking time in seconds, at least 1 (60 on
|
|
1248
1265
|
the CS137/CS158, whose API uses minutes and truncates to whole
|
|
1249
1266
|
minutes). A shorter time returns False without a request.
|
|
1250
|
-
|
|
1251
|
-
|
|
1267
|
+
A mode's ``time_limits``, where declared, also apply; a time
|
|
1268
|
+
outside them returns False without a request. Other modes have
|
|
1269
|
+
no upper limit.
|
|
1252
1270
|
cook_temp (int): The cooking temperature, in ``temp_unit``.
|
|
1253
1271
|
temp_unit (TemperatureUnits | str | None): The unit of
|
|
1254
1272
|
``cook_temp``; defaults to the device's current ``temp_unit``.
|
|
@@ -1275,6 +1293,39 @@ class VeSyncFryer(VeSyncBaseDevice[FryerState]):
|
|
|
1275
1293
|
logger.warning('set_mode method not implemented for base fryer class.')
|
|
1276
1294
|
return False
|
|
1277
1295
|
|
|
1296
|
+
async def set_chamber_modes(
|
|
1297
|
+
self,
|
|
1298
|
+
chamber_1: AirFryerPresetRecipe,
|
|
1299
|
+
chamber_2: AirFryerPresetRecipe | None = None,
|
|
1300
|
+
*,
|
|
1301
|
+
sync_type: AirFryerSyncType = AirFryerSyncType.SYNC,
|
|
1302
|
+
) -> bool:
|
|
1303
|
+
"""Start a recipe in each chamber, or one recipe in both.
|
|
1304
|
+
|
|
1305
|
+
Only fryers with the ``CHAMBER_MODES`` feature implement this. Both
|
|
1306
|
+
recipes are checked before any request, as in
|
|
1307
|
+
``set_mode_from_recipe()``, so an invalid second recipe does not start
|
|
1308
|
+
the first. On success both chamber states are set locally from the
|
|
1309
|
+
request; call ``update()`` for the device's reported state.
|
|
1310
|
+
|
|
1311
|
+
Args:
|
|
1312
|
+
chamber_1 (AirFryerPresetRecipe): Recipe for chamber 1 with
|
|
1313
|
+
``SYNC`` or ``OFF``, or the recipe for both chambers with
|
|
1314
|
+
``MATCH``.
|
|
1315
|
+
chamber_2 (AirFryerPresetRecipe | None): Recipe for chamber 2.
|
|
1316
|
+
Required with ``SYNC`` and ``OFF``; must be None with ``MATCH``.
|
|
1317
|
+
sync_type (AirFryerSyncType): ``SYNC`` for separate recipes that
|
|
1318
|
+
finish together, ``OFF`` for separate recipes that each run on
|
|
1319
|
+
their own time, or ``MATCH`` for identical settings.
|
|
1320
|
+
|
|
1321
|
+
Returns:
|
|
1322
|
+
bool: True if the command was successful. An unsupported fryer or
|
|
1323
|
+
an invalid combination returns False without a request.
|
|
1324
|
+
"""
|
|
1325
|
+
del chamber_1, chamber_2, sync_type
|
|
1326
|
+
logger.debug('Separate chamber modes are not configured for %s', self.device_name)
|
|
1327
|
+
return False
|
|
1328
|
+
|
|
1278
1329
|
async def set_mode_from_recipe(
|
|
1279
1330
|
self,
|
|
1280
1331
|
recipe: AirFryerPresetRecipe,
|
|
@@ -872,6 +872,46 @@ class AirFryerTempLimits:
|
|
|
872
872
|
step: int
|
|
873
873
|
|
|
874
874
|
|
|
875
|
+
@dataclass(frozen=True)
|
|
876
|
+
class AirFryerTimeLimits:
|
|
877
|
+
"""Cook time limits of one cook mode, in seconds (APK time range and precision).
|
|
878
|
+
|
|
879
|
+
Attributes:
|
|
880
|
+
min_seconds (int): Shortest time the mode accepts.
|
|
881
|
+
max_seconds (int): Longest time the mode accepts.
|
|
882
|
+
step_seconds (int): Allowed increment from the minimum. A time off the
|
|
883
|
+
step is rejected, not rounded.
|
|
884
|
+
"""
|
|
885
|
+
|
|
886
|
+
min_seconds: int
|
|
887
|
+
max_seconds: int
|
|
888
|
+
step_seconds: int
|
|
889
|
+
|
|
890
|
+
def accepts(self, seconds: float | str) -> bool:
|
|
891
|
+
"""Return whether a cook time is within the range and on a step.
|
|
892
|
+
|
|
893
|
+
Args:
|
|
894
|
+
seconds (float | str): Requested time. A whole number given as a
|
|
895
|
+
float or string counts; a fraction or a boolean does not.
|
|
896
|
+
|
|
897
|
+
Returns:
|
|
898
|
+
bool: Whether the mode accepts the time.
|
|
899
|
+
"""
|
|
900
|
+
if isinstance(seconds, bool):
|
|
901
|
+
return False
|
|
902
|
+
try:
|
|
903
|
+
value = float(seconds)
|
|
904
|
+
except (TypeError, ValueError):
|
|
905
|
+
return False
|
|
906
|
+
if not value.is_integer():
|
|
907
|
+
return False
|
|
908
|
+
whole = int(value)
|
|
909
|
+
return (
|
|
910
|
+
self.min_seconds <= whole <= self.max_seconds
|
|
911
|
+
and (whole - self.min_seconds) % self.step_seconds == 0
|
|
912
|
+
)
|
|
913
|
+
|
|
914
|
+
|
|
875
915
|
@dataclass(frozen=True)
|
|
876
916
|
class AirFryerModeConfig:
|
|
877
917
|
"""One APK preset: its request values, default time and temperatures.
|
|
@@ -880,13 +920,15 @@ class AirFryerModeConfig:
|
|
|
880
920
|
api_mode (str): Mode string sent to and reported by the API.
|
|
881
921
|
recipe_id (int): Preset recipe ID sent with the mode.
|
|
882
922
|
recipe_name (str): Preset label sent as the recipe name.
|
|
883
|
-
cook_time (int): Default cook time in seconds. Not a limit
|
|
884
|
-
|
|
923
|
+
cook_time (int): Default cook time in seconds. Not a limit; see
|
|
924
|
+
``time_limits``.
|
|
885
925
|
temp_c (AirFryerTempLimits): Celsius limits.
|
|
886
926
|
temp_f (AirFryerTempLimits): Fahrenheit limits.
|
|
887
927
|
default_temp_c (int): Default temperature in Celsius.
|
|
888
928
|
default_temp_f (int): Default temperature in Fahrenheit.
|
|
889
929
|
recipe_type (int): Preset recipe type, 3 for every APK preset.
|
|
930
|
+
time_limits (AirFryerTimeLimits | None): Cook time limits. None applies
|
|
931
|
+
only the general minimum, with no upper limit or step.
|
|
890
932
|
"""
|
|
891
933
|
|
|
892
934
|
api_mode: str
|
|
@@ -898,6 +940,7 @@ class AirFryerModeConfig:
|
|
|
898
940
|
default_temp_c: int
|
|
899
941
|
default_temp_f: int
|
|
900
942
|
recipe_type: int = AIRFRYER_PRESET_RECIPE_TYPE
|
|
943
|
+
time_limits: AirFryerTimeLimits | None = None
|
|
901
944
|
|
|
902
945
|
def limits(self, temp_unit: TemperatureUnits) -> AirFryerTempLimits:
|
|
903
946
|
"""Return the limits in the given unit.
|
|
@@ -1070,9 +1113,15 @@ class AirFryerFeatures(Features):
|
|
|
1070
1113
|
PREHEAT: The fryer accepts a preheat phase (``preheat_time``).
|
|
1071
1114
|
DUAL_CHAMBER: Two chambers; adds ``CHAMBER_2`` and ``BOTH`` to
|
|
1072
1115
|
``supported_chambers``.
|
|
1073
|
-
RESUMABLE:
|
|
1116
|
+
RESUMABLE: ``stop()`` / ``resume()`` pause and resume a cook. Declared
|
|
1117
|
+
on the CS137/CS158 and the CAF-DC111S-AEU; ``VeSyncDualAirFryer``
|
|
1118
|
+
refuses both without it.
|
|
1074
1119
|
WHOLE_CHAMBER: Single merged basket with the divider removed
|
|
1075
1120
|
(workChamber 3); adds ``WHOLE`` to ``supported_chambers``.
|
|
1121
|
+
CHAMBER_MODES: ``set_chamber_modes()`` is available: separate recipes
|
|
1122
|
+
in Sync, or one recipe in both chambers in Match.
|
|
1123
|
+
COOK_CONFIG_SHAKE_TIME: ``startMultiCook`` cook configs include
|
|
1124
|
+
``shakeTime``. Other dual-chamber fryers leave it out.
|
|
1076
1125
|
"""
|
|
1077
1126
|
|
|
1078
1127
|
DUAL_BLAZE = 'dual_blaze'
|
|
@@ -1080,6 +1129,8 @@ class AirFryerFeatures(Features):
|
|
|
1080
1129
|
DUAL_CHAMBER = 'dual_chamber'
|
|
1081
1130
|
RESUMABLE = 'resumable'
|
|
1082
1131
|
WHOLE_CHAMBER = 'whole_chamber'
|
|
1132
|
+
CHAMBER_MODES = 'chamber_modes'
|
|
1133
|
+
COOK_CONFIG_SHAKE_TIME = 'cook_config_shake_time'
|
|
1083
1134
|
|
|
1084
1135
|
|
|
1085
1136
|
class AirFryerCookStatus(StrEnum):
|
|
@@ -1104,9 +1155,9 @@ class AirFryerCookStatus(StrEnum):
|
|
|
1104
1155
|
APPOINTING: Delayed start scheduled; waiting to start (CS158
|
|
1105
1156
|
``appointing``).
|
|
1106
1157
|
HOLD: Sync cook: this chamber waits so both chambers finish
|
|
1107
|
-
together (
|
|
1108
|
-
wait, and the total time remaining includes the cook. Both
|
|
1109
|
-
down only while the other chamber cooks.
|
|
1158
|
+
together (dual-chamber fryers, ``hold``). The remaining cook time
|
|
1159
|
+
is the wait, and the total time remaining includes the cook. Both
|
|
1160
|
+
count down only while the other chamber cooks.
|
|
1110
1161
|
"""
|
|
1111
1162
|
|
|
1112
1163
|
COOKING = 'cooking'
|
|
@@ -159,7 +159,7 @@ class DeviceContainer(_DeviceContainerBase):
|
|
|
159
159
|
device_features = get_device_config(device.deviceType)
|
|
160
160
|
if device_features is None:
|
|
161
161
|
logger.debug('Device type %s not found in device map', device.deviceType)
|
|
162
|
-
logger.debug('Device info: \n %s', device.to_json(
|
|
162
|
+
logger.debug('Device info: \n %s', device.to_json())
|
|
163
163
|
return None
|
|
164
164
|
dev_class = device_features.class_name
|
|
165
165
|
dev_module = device_features.module
|
|
@@ -75,6 +75,7 @@ from pyvesync.const import (
|
|
|
75
75
|
AirFryerPresetRecipe,
|
|
76
76
|
AirFryerPresets,
|
|
77
77
|
AirFryerTempLimits,
|
|
78
|
+
AirFryerTimeLimits,
|
|
78
79
|
BulbFeatures,
|
|
79
80
|
ColorMode,
|
|
80
81
|
EnergyIntervals,
|
|
@@ -1483,7 +1484,8 @@ _P583S_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1483
1484
|
|
|
1484
1485
|
# APK i61.C67928f0 (TF101S) presets without Dry, shared with the TF102S
|
|
1485
1486
|
# (i61.C67932h0). One captured startMultiCook verifies the request shape
|
|
1486
|
-
# for all of them (maintainer, 2026-11-03).
|
|
1487
|
+
# for all of them (maintainer, 2026-11-03). Time limits are the app's picker
|
|
1488
|
+
# (N() tables); no capture or report tests them on these models.
|
|
1487
1489
|
_TF10X_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
1488
1490
|
AirFryerCookModes.AIRFRY: AirFryerModeConfig(
|
|
1489
1491
|
api_mode='AirFry',
|
|
@@ -1494,6 +1496,7 @@ _TF10X_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1494
1496
|
temp_f=AirFryerTempLimits(min_temp=250, max_temp=400, step=5),
|
|
1495
1497
|
default_temp_c=200,
|
|
1496
1498
|
default_temp_f=390,
|
|
1499
|
+
time_limits=AirFryerTimeLimits(min_seconds=60, max_seconds=3600, step_seconds=60),
|
|
1497
1500
|
),
|
|
1498
1501
|
AirFryerCookModes.ROAST: AirFryerModeConfig(
|
|
1499
1502
|
api_mode='Roast',
|
|
@@ -1504,6 +1507,9 @@ _TF10X_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1504
1507
|
temp_f=AirFryerTempLimits(min_temp=250, max_temp=400, step=5),
|
|
1505
1508
|
default_temp_c=190,
|
|
1506
1509
|
default_temp_f=375,
|
|
1510
|
+
time_limits=AirFryerTimeLimits(
|
|
1511
|
+
min_seconds=60, max_seconds=14400, step_seconds=60
|
|
1512
|
+
),
|
|
1507
1513
|
),
|
|
1508
1514
|
AirFryerCookModes.BAKE: AirFryerModeConfig(
|
|
1509
1515
|
api_mode='Bake',
|
|
@@ -1514,6 +1520,9 @@ _TF10X_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1514
1520
|
temp_f=AirFryerTempLimits(min_temp=175, max_temp=400, step=5),
|
|
1515
1521
|
default_temp_c=160,
|
|
1516
1522
|
default_temp_f=320,
|
|
1523
|
+
time_limits=AirFryerTimeLimits(
|
|
1524
|
+
min_seconds=60, max_seconds=14400, step_seconds=60
|
|
1525
|
+
),
|
|
1517
1526
|
),
|
|
1518
1527
|
AirFryerCookModes.GRILL: AirFryerModeConfig(
|
|
1519
1528
|
api_mode='Grill',
|
|
@@ -1524,6 +1533,7 @@ _TF10X_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1524
1533
|
temp_f=AirFryerTempLimits(min_temp=400, max_temp=465, step=5),
|
|
1525
1534
|
default_temp_c=240,
|
|
1526
1535
|
default_temp_f=465,
|
|
1536
|
+
time_limits=AirFryerTimeLimits(min_seconds=60, max_seconds=1800, step_seconds=60),
|
|
1527
1537
|
),
|
|
1528
1538
|
AirFryerCookModes.REHEAT: AirFryerModeConfig(
|
|
1529
1539
|
api_mode='Reheat',
|
|
@@ -1534,6 +1544,7 @@ _TF10X_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1534
1544
|
temp_f=AirFryerTempLimits(min_temp=105, max_temp=400, step=5),
|
|
1535
1545
|
default_temp_c=165,
|
|
1536
1546
|
default_temp_f=330,
|
|
1547
|
+
time_limits=AirFryerTimeLimits(min_seconds=60, max_seconds=3600, step_seconds=60),
|
|
1537
1548
|
),
|
|
1538
1549
|
}
|
|
1539
1550
|
|
|
@@ -1549,21 +1560,31 @@ _TF101S_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1549
1560
|
temp_f=AirFryerTempLimits(min_temp=95, max_temp=205, step=5),
|
|
1550
1561
|
default_temp_c=55,
|
|
1551
1562
|
default_temp_f=130,
|
|
1563
|
+
time_limits=AirFryerTimeLimits(
|
|
1564
|
+
min_seconds=1800, max_seconds=172800, step_seconds=1800
|
|
1565
|
+
),
|
|
1552
1566
|
),
|
|
1553
1567
|
}
|
|
1554
1568
|
|
|
1555
1569
|
|
|
1556
|
-
|
|
1570
|
+
# ``hold`` is the chamber that waits during a Sync cook, and ``cookEnd`` a finished
|
|
1571
|
+
# cook. The DC111S reports both (``hold`` captured, ``cookEnd`` in the PR #564 hardware
|
|
1572
|
+
# test). For the TF101S and TF102S they come only from the APK, whose status handling
|
|
1573
|
+
# has no model check.
|
|
1574
|
+
_DUAL_STATUS_MAP: MappingProxyType[str, AirFryerCookStatus] = MappingProxyType(
|
|
1557
1575
|
{
|
|
1558
1576
|
'standby': AirFryerCookStatus.STANDBY,
|
|
1559
1577
|
'ready': AirFryerCookStatus.READY,
|
|
1560
1578
|
'cooking': AirFryerCookStatus.COOKING,
|
|
1561
1579
|
'cookStop': AirFryerCookStatus.COOK_STOP,
|
|
1562
1580
|
'pullOut': AirFryerCookStatus.PULL_OUT,
|
|
1581
|
+
'hold': AirFryerCookStatus.HOLD,
|
|
1582
|
+
'cookEnd': AirFryerCookStatus.COOK_END,
|
|
1563
1583
|
}
|
|
1564
1584
|
)
|
|
1565
1585
|
|
|
1566
|
-
# APK i61.C114379l (DC111SEUConfig) presets
|
|
1586
|
+
# APK i61.C114379l (DC111SEUConfig) presets, with its time ranges and steps.
|
|
1587
|
+
# Shake is off for every mode.
|
|
1567
1588
|
_DC111S_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
1568
1589
|
AirFryerCookModes.AIRFRY: AirFryerModeConfig(
|
|
1569
1590
|
api_mode='AirFry',
|
|
@@ -1574,6 +1595,7 @@ _DC111S_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1574
1595
|
temp_f=AirFryerTempLimits(min_temp=250, max_temp=450, step=5),
|
|
1575
1596
|
default_temp_c=195,
|
|
1576
1597
|
default_temp_f=385,
|
|
1598
|
+
time_limits=AirFryerTimeLimits(min_seconds=60, max_seconds=3600, step_seconds=60),
|
|
1577
1599
|
),
|
|
1578
1600
|
AirFryerCookModes.BAKE: AirFryerModeConfig(
|
|
1579
1601
|
api_mode='Bake',
|
|
@@ -1584,6 +1606,7 @@ _DC111S_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1584
1606
|
temp_f=AirFryerTempLimits(min_temp=260, max_temp=400, step=5),
|
|
1585
1607
|
default_temp_c=165,
|
|
1586
1608
|
default_temp_f=330,
|
|
1609
|
+
time_limits=AirFryerTimeLimits(min_seconds=60, max_seconds=3600, step_seconds=60),
|
|
1587
1610
|
),
|
|
1588
1611
|
AirFryerCookModes.ROAST: AirFryerModeConfig(
|
|
1589
1612
|
api_mode='Roast',
|
|
@@ -1594,6 +1617,7 @@ _DC111S_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1594
1617
|
temp_f=AirFryerTempLimits(min_temp=350, max_temp=450, step=5),
|
|
1595
1618
|
default_temp_c=220,
|
|
1596
1619
|
default_temp_f=425,
|
|
1620
|
+
time_limits=AirFryerTimeLimits(min_seconds=60, max_seconds=3600, step_seconds=60),
|
|
1597
1621
|
),
|
|
1598
1622
|
AirFryerCookModes.GRILL: AirFryerModeConfig(
|
|
1599
1623
|
api_mode='Grill',
|
|
@@ -1604,6 +1628,7 @@ _DC111S_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1604
1628
|
temp_f=AirFryerTempLimits(min_temp=320, max_temp=450, step=5),
|
|
1605
1629
|
default_temp_c=230,
|
|
1606
1630
|
default_temp_f=450,
|
|
1631
|
+
time_limits=AirFryerTimeLimits(min_seconds=60, max_seconds=3600, step_seconds=60),
|
|
1607
1632
|
),
|
|
1608
1633
|
AirFryerCookModes.REHEAT: AirFryerModeConfig(
|
|
1609
1634
|
api_mode='Reheat',
|
|
@@ -1614,6 +1639,7 @@ _DC111S_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1614
1639
|
temp_f=AirFryerTempLimits(min_temp=105, max_temp=400, step=5),
|
|
1615
1640
|
default_temp_c=165,
|
|
1616
1641
|
default_temp_f=330,
|
|
1642
|
+
time_limits=AirFryerTimeLimits(min_seconds=60, max_seconds=3600, step_seconds=60),
|
|
1617
1643
|
),
|
|
1618
1644
|
AirFryerCookModes.DRY: AirFryerModeConfig(
|
|
1619
1645
|
api_mode='Dry',
|
|
@@ -1624,6 +1650,9 @@ _DC111S_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1624
1650
|
temp_f=AirFryerTempLimits(min_temp=100, max_temp=200, step=5),
|
|
1625
1651
|
default_temp_c=55,
|
|
1626
1652
|
default_temp_f=130,
|
|
1653
|
+
time_limits=AirFryerTimeLimits(
|
|
1654
|
+
min_seconds=1800, max_seconds=86400, step_seconds=1800
|
|
1655
|
+
),
|
|
1627
1656
|
),
|
|
1628
1657
|
AirFryerCookModes.PROOF: AirFryerModeConfig(
|
|
1629
1658
|
api_mode='Proof',
|
|
@@ -1634,17 +1663,12 @@ _DC111S_COOK_MODES: dict[str, AirFryerModeConfig] = {
|
|
|
1634
1663
|
temp_f=AirFryerTempLimits(min_temp=90, max_temp=115, step=1),
|
|
1635
1664
|
default_temp_c=30,
|
|
1636
1665
|
default_temp_f=90,
|
|
1666
|
+
time_limits=AirFryerTimeLimits(
|
|
1667
|
+
min_seconds=900, max_seconds=43200, step_seconds=900
|
|
1668
|
+
),
|
|
1637
1669
|
),
|
|
1638
1670
|
}
|
|
1639
1671
|
|
|
1640
|
-
# The DC111S also reports ``hold`` for the chamber that waits during a Sync cook.
|
|
1641
|
-
_DC111S_STATUS_MAP: MappingProxyType[str, AirFryerCookStatus] = MappingProxyType(
|
|
1642
|
-
{
|
|
1643
|
-
**_TF10X_STATUS_MAP,
|
|
1644
|
-
'hold': AirFryerCookStatus.HOLD,
|
|
1645
|
-
}
|
|
1646
|
-
)
|
|
1647
|
-
|
|
1648
1672
|
|
|
1649
1673
|
air_fryer_modules: list[AirFryerMap] = [
|
|
1650
1674
|
AirFryerMap(
|
|
@@ -1780,7 +1804,7 @@ air_fryer_modules: list[AirFryerMap] = [
|
|
|
1780
1804
|
default_cook_mode=AirFryerCookModes.AIRFRY,
|
|
1781
1805
|
default_preset=AirFryerPresets.air_fry,
|
|
1782
1806
|
time_units=TimeUnits.SECONDS,
|
|
1783
|
-
status_map=
|
|
1807
|
+
status_map=_DUAL_STATUS_MAP,
|
|
1784
1808
|
),
|
|
1785
1809
|
AirFryerMap(
|
|
1786
1810
|
# APK i61.C67932h0 (TF102SEUConfig): the TF101S presets without Dry.
|
|
@@ -1799,11 +1823,13 @@ air_fryer_modules: list[AirFryerMap] = [
|
|
|
1799
1823
|
default_cook_mode=AirFryerCookModes.AIRFRY,
|
|
1800
1824
|
default_preset=AirFryerPresets.air_fry,
|
|
1801
1825
|
time_units=TimeUnits.SECONDS,
|
|
1802
|
-
status_map=
|
|
1826
|
+
status_map=_DUAL_STATUS_MAP,
|
|
1803
1827
|
),
|
|
1804
1828
|
AirFryerMap(
|
|
1805
1829
|
# APK i61.C114379l (DC111SEUConfig): upper (1) and lower (2) chambers,
|
|
1806
|
-
# no whole-basket mode. Same multi-chamber API as the TF101S
|
|
1830
|
+
# no whole-basket mode. Same multi-chamber API as the TF101S, but its
|
|
1831
|
+
# cook configs send shakeTime 0: PR #536 tested it on hardware, the
|
|
1832
|
+
# capture shows code 0, and APK C42441q1.s1 sets it.
|
|
1807
1833
|
class_name='VeSyncDualAirFryer',
|
|
1808
1834
|
module=vesynckitchen,
|
|
1809
1835
|
dev_types=['CAF-DC111S-AEU'],
|
|
@@ -1812,12 +1838,17 @@ air_fryer_modules: list[AirFryerMap] = [
|
|
|
1812
1838
|
model_display='CAF-DC111S-AEU',
|
|
1813
1839
|
model_name='Turbo Tower Pro Smart Air Fryer',
|
|
1814
1840
|
temp_unit=TemperatureUnits.CELSIUS,
|
|
1815
|
-
features=[
|
|
1841
|
+
features=[
|
|
1842
|
+
AirFryerFeatures.DUAL_CHAMBER,
|
|
1843
|
+
AirFryerFeatures.CHAMBER_MODES,
|
|
1844
|
+
AirFryerFeatures.COOK_CONFIG_SHAKE_TIME,
|
|
1845
|
+
AirFryerFeatures.RESUMABLE,
|
|
1846
|
+
],
|
|
1816
1847
|
cook_modes=_DC111S_COOK_MODES,
|
|
1817
1848
|
default_cook_mode=AirFryerCookModes.AIRFRY,
|
|
1818
1849
|
default_preset=AirFryerPresets.air_fry,
|
|
1819
1850
|
time_units=TimeUnits.SECONDS,
|
|
1820
|
-
status_map=
|
|
1851
|
+
status_map=_DUAL_STATUS_MAP,
|
|
1821
1852
|
),
|
|
1822
1853
|
]
|
|
1823
1854
|
"""List of ['AirFryerMap'][pyvesync.device_map.AirFryerMap] configuration
|
|
@@ -923,7 +923,7 @@ class VeSyncHumid1000S(VeSyncHumid200300S):
|
|
|
923
923
|
return False
|
|
924
924
|
|
|
925
925
|
payload_data = {'levelIdx': 0, 'virtualLevel': level, 'levelType': 'mist'}
|
|
926
|
-
r_dict = await self.call_bypassv2_api('
|
|
926
|
+
r_dict = await self.call_bypassv2_api('setVirtualLevel', payload_data)
|
|
927
927
|
r = Helpers.process_dev_response(logger, 'set_mist_level', self, r_dict)
|
|
928
928
|
if r is None:
|
|
929
929
|
return False
|
|
@@ -28,6 +28,7 @@ from pyvesync.const import (
|
|
|
28
28
|
AirFryer158Command,
|
|
29
29
|
AirFryerChamber,
|
|
30
30
|
AirFryerCookStatus,
|
|
31
|
+
AirFryerFeatures,
|
|
31
32
|
AirFryerPresetRecipe,
|
|
32
33
|
AirFryerSyncType,
|
|
33
34
|
ConnectionStatus,
|
|
@@ -714,8 +715,9 @@ class VeSyncDualAirFryer(BypassV2Mixin, VeSyncFryer):
|
|
|
714
715
|
|
|
715
716
|
During a Sync cook with different times, the DC111S reports the chamber
|
|
716
717
|
that waits to start as ``AirFryerCookStatus.HOLD``. Its wait counts down
|
|
717
|
-
only while the other chamber is cooking.
|
|
718
|
-
|
|
718
|
+
only while the other chamber is cooking. ``set_chamber_modes()`` starts
|
|
719
|
+
a Sync cook with different settings per chamber, on fryers with the
|
|
720
|
+
``CHAMBER_MODES`` feature; other fryers need the app or the fryer for that.
|
|
719
721
|
|
|
720
722
|
The device has no preheat, pause, or resume API: ``preheat_time`` and a
|
|
721
723
|
recipe's ``preheat_time`` are ignored, and ``stop()`` / ``resume()``
|
|
@@ -735,8 +737,9 @@ class VeSyncDualAirFryer(BypassV2Mixin, VeSyncFryer):
|
|
|
735
737
|
sync_chambers (bool): Read-only. True only for the app's Sync mode
|
|
736
738
|
(``syncType`` 2). Set by ``update()``; a successful
|
|
737
739
|
``set_mode()`` / ``set_mode_from_recipe()`` sets it True for
|
|
738
|
-
``BOTH`` and False for any other chamber,
|
|
739
|
-
it False
|
|
740
|
+
``BOTH`` and False for any other chamber, a successful
|
|
741
|
+
``set_chamber_modes()`` sets it True for ``SYNC`` and False
|
|
742
|
+
otherwise, and ``end(BOTH)`` sets it False.
|
|
740
743
|
work_chamber (AirFryerChamber | None): Read-only. Chamber the device
|
|
741
744
|
reports as active (``workChamber``); None when idle. Set by
|
|
742
745
|
``update()``. A successful ``WHOLE`` start sets ``WHOLE``, any other
|
|
@@ -943,6 +946,79 @@ class VeSyncDualAirFryer(BypassV2Mixin, VeSyncFryer):
|
|
|
943
946
|
self._set_reported_work_chamber(None)
|
|
944
947
|
return True
|
|
945
948
|
|
|
949
|
+
async def _pause_or_resume(
|
|
950
|
+
self, chamber: AirFryerChamber | int, method: str, name: str
|
|
951
|
+
) -> list[FryerState] | None:
|
|
952
|
+
"""Send pauseWork / resumeWork for a chamber.
|
|
953
|
+
|
|
954
|
+
Returns the affected chamber states on success, None otherwise.
|
|
955
|
+
"""
|
|
956
|
+
member = self._validate_chamber(chamber)
|
|
957
|
+
if member is None:
|
|
958
|
+
return None
|
|
959
|
+
if AirFryerFeatures.RESUMABLE not in self.features:
|
|
960
|
+
logger.info('%s not supported by this fryer.', name)
|
|
961
|
+
return None
|
|
962
|
+
if member == AirFryerChamber.WHOLE:
|
|
963
|
+
logger.info('%s is not supported for the whole basket.', name)
|
|
964
|
+
return None
|
|
965
|
+
resp = await self.call_bypassv2_api(
|
|
966
|
+
payload_method=method,
|
|
967
|
+
data={'chamber': int(member)},
|
|
968
|
+
payload_update=dict(BYPASSV2_SUB_DEVICE_PAYLOAD),
|
|
969
|
+
)
|
|
970
|
+
if Helpers.process_dev_response(logger, name, self, resp) is None:
|
|
971
|
+
return None
|
|
972
|
+
if member == AirFryerChamber.BOTH:
|
|
973
|
+
return [self.state_chamber_1, self.state_chamber_2]
|
|
974
|
+
return [self._chamber_state(member)]
|
|
975
|
+
|
|
976
|
+
async def stop(
|
|
977
|
+
self, chamber: AirFryerChamber | int = AirFryerChamber.CHAMBER_1
|
|
978
|
+
) -> bool:
|
|
979
|
+
"""Pause cooking in a chamber (``pauseWork``).
|
|
980
|
+
|
|
981
|
+
Needs the ``RESUMABLE`` feature. ``BOTH`` pauses both chambers in one
|
|
982
|
+
request. During a Sync cook the other chamber's ``HOLD`` wait stops
|
|
983
|
+
counting down too. The paused chamber reports ``cookStop`` and keeps
|
|
984
|
+
its remaining time.
|
|
985
|
+
|
|
986
|
+
Args:
|
|
987
|
+
chamber (AirFryerChamber | int): Chamber to pause.
|
|
988
|
+
|
|
989
|
+
Returns:
|
|
990
|
+
bool: True on success.
|
|
991
|
+
"""
|
|
992
|
+
states = await self._pause_or_resume(chamber, 'pauseWork', 'stop')
|
|
993
|
+
if states is None:
|
|
994
|
+
return False
|
|
995
|
+
for state in states:
|
|
996
|
+
if state.is_in_cook_mode:
|
|
997
|
+
state.set_cook_stop_state()
|
|
998
|
+
return True
|
|
999
|
+
|
|
1000
|
+
async def resume(
|
|
1001
|
+
self, chamber: AirFryerChamber | int = AirFryerChamber.CHAMBER_1
|
|
1002
|
+
) -> bool:
|
|
1003
|
+
"""Resume a paused chamber (``resumeWork``).
|
|
1004
|
+
|
|
1005
|
+
Needs the ``RESUMABLE`` feature. ``BOTH`` resumes both chambers in one
|
|
1006
|
+
request. The remaining time carries over.
|
|
1007
|
+
|
|
1008
|
+
Args:
|
|
1009
|
+
chamber (AirFryerChamber | int): Chamber to resume.
|
|
1010
|
+
|
|
1011
|
+
Returns:
|
|
1012
|
+
bool: True on success.
|
|
1013
|
+
"""
|
|
1014
|
+
states = await self._pause_or_resume(chamber, 'resumeWork', 'resume')
|
|
1015
|
+
if states is None:
|
|
1016
|
+
return False
|
|
1017
|
+
for state in states:
|
|
1018
|
+
if state.cook_status == AirFryerCookStatus.COOK_STOP:
|
|
1019
|
+
state.set_cook_resume_state()
|
|
1020
|
+
return True
|
|
1021
|
+
|
|
946
1022
|
def _build_cook_configs(
|
|
947
1023
|
self,
|
|
948
1024
|
recipe: AirFryerPresetRecipe,
|
|
@@ -966,6 +1042,8 @@ class VeSyncDualAirFryer(BypassV2Mixin, VeSyncFryer):
|
|
|
966
1042
|
'recipeName': recipe.recipe_name,
|
|
967
1043
|
'recipeType': recipe.recipe_type,
|
|
968
1044
|
}
|
|
1045
|
+
if AirFryerFeatures.COOK_CONFIG_SHAKE_TIME in self.features:
|
|
1046
|
+
config_dict['shakeTime'] = 0
|
|
969
1047
|
|
|
970
1048
|
if chamber == AirFryerChamber.BOTH:
|
|
971
1049
|
return [
|
|
@@ -1000,19 +1078,37 @@ class VeSyncDualAirFryer(BypassV2Mixin, VeSyncFryer):
|
|
|
1000
1078
|
prepared = self._prepare_recipe(recipe)
|
|
1001
1079
|
if prepared is None:
|
|
1002
1080
|
return False
|
|
1003
|
-
|
|
1004
|
-
|
|
1081
|
+
cook_configs = self._build_cook_configs(prepared, member)
|
|
1082
|
+
return await self._start_cook_configs(
|
|
1083
|
+
cook_configs, member, self._get_sync_type(member)
|
|
1084
|
+
)
|
|
1005
1085
|
|
|
1086
|
+
async def _start_cook_configs(
|
|
1087
|
+
self,
|
|
1088
|
+
configs: list[models.FryerDualCookConfig],
|
|
1089
|
+
chamber: AirFryerChamber,
|
|
1090
|
+
sync_type: AirFryerSyncType,
|
|
1091
|
+
) -> bool:
|
|
1092
|
+
"""Send validated configs to ``startMultiCook`` and update the state.
|
|
1093
|
+
|
|
1094
|
+
Args:
|
|
1095
|
+
configs: The chamber configs to start.
|
|
1096
|
+
chamber: Validated chamber sent as ``workChamber``.
|
|
1097
|
+
sync_type: The ``syncType`` to send.
|
|
1098
|
+
|
|
1099
|
+
Returns:
|
|
1100
|
+
True if the command was successful.
|
|
1101
|
+
"""
|
|
1006
1102
|
start_data = models.FryerDualStartCookData.from_dict(
|
|
1007
1103
|
{
|
|
1008
1104
|
'accountId': self.manager.account_id,
|
|
1009
|
-
'cookConfigs': [c.to_dict() for c in
|
|
1105
|
+
'cookConfigs': [c.to_dict() for c in configs],
|
|
1010
1106
|
# readyStart False starts the cook at once; True waits for the
|
|
1011
1107
|
# start button.
|
|
1012
1108
|
'readyStart': False,
|
|
1013
|
-
'syncType': int(
|
|
1109
|
+
'syncType': int(sync_type),
|
|
1014
1110
|
'tempUnit': self.temp_unit.code,
|
|
1015
|
-
'workChamber': int(
|
|
1111
|
+
'workChamber': int(chamber),
|
|
1016
1112
|
}
|
|
1017
1113
|
)
|
|
1018
1114
|
|
|
@@ -1025,31 +1121,68 @@ class VeSyncDualAirFryer(BypassV2Mixin, VeSyncFryer):
|
|
|
1025
1121
|
if r is None:
|
|
1026
1122
|
return False
|
|
1027
1123
|
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
chambers = (
|
|
1031
|
-
[self.state_chamber_1, self.state_chamber_2]
|
|
1032
|
-
if both
|
|
1033
|
-
else [self._chamber_state(member)]
|
|
1034
|
-
)
|
|
1035
|
-
self._set_reported_sync(both)
|
|
1036
|
-
if member == AirFryerChamber.WHOLE:
|
|
1124
|
+
self._set_reported_sync(sync_type == AirFryerSyncType.SYNC)
|
|
1125
|
+
if chamber == AirFryerChamber.WHOLE:
|
|
1037
1126
|
self._set_reported_work_chamber(AirFryerChamber.WHOLE)
|
|
1038
1127
|
elif self.work_chamber == AirFryerChamber.WHOLE:
|
|
1039
1128
|
self._set_reported_work_chamber(None)
|
|
1040
|
-
|
|
1041
|
-
|
|
1129
|
+
# In a Sync cook with different times, the shorter chamber waits for the
|
|
1130
|
+
# difference so both finish together.
|
|
1131
|
+
longest = max(config.cookSetTime for config in configs)
|
|
1132
|
+
separate_times = sync_type == AirFryerSyncType.SYNC and any(
|
|
1133
|
+
config.cookSetTime != longest for config in configs
|
|
1134
|
+
)
|
|
1135
|
+
for config in configs:
|
|
1136
|
+
wait_time = longest - config.cookSetTime if separate_times else 0
|
|
1042
1137
|
# readyStart is False, so the cook starts without the start button.
|
|
1043
|
-
|
|
1044
|
-
cook_status=
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1138
|
+
self._chamber_state(AirFryerChamber(config.chamber)).set_state(
|
|
1139
|
+
cook_status=(
|
|
1140
|
+
AirFryerCookStatus.HOLD if wait_time else AirFryerCookStatus.COOKING
|
|
1141
|
+
),
|
|
1142
|
+
cook_time=config.cookSetTime,
|
|
1143
|
+
cook_last_time=wait_time or config.cookSetTime,
|
|
1144
|
+
total_last_time=longest if separate_times else None,
|
|
1145
|
+
cook_temp=config.cookTemp,
|
|
1146
|
+
cook_mode=config.mode,
|
|
1147
|
+
recipe=config.recipeName,
|
|
1050
1148
|
)
|
|
1051
1149
|
return True
|
|
1052
1150
|
|
|
1151
|
+
async def set_chamber_modes(
|
|
1152
|
+
self,
|
|
1153
|
+
chamber_1: AirFryerPresetRecipe,
|
|
1154
|
+
chamber_2: AirFryerPresetRecipe | None = None,
|
|
1155
|
+
*,
|
|
1156
|
+
sync_type: AirFryerSyncType = AirFryerSyncType.SYNC,
|
|
1157
|
+
) -> bool:
|
|
1158
|
+
if AirFryerFeatures.CHAMBER_MODES not in self.features:
|
|
1159
|
+
return await super().set_chamber_modes(
|
|
1160
|
+
chamber_1, chamber_2, sync_type=sync_type
|
|
1161
|
+
)
|
|
1162
|
+
if sync_type not in (
|
|
1163
|
+
AirFryerSyncType.OFF,
|
|
1164
|
+
AirFryerSyncType.SYNC,
|
|
1165
|
+
AirFryerSyncType.MATCH,
|
|
1166
|
+
):
|
|
1167
|
+
logger.warning(
|
|
1168
|
+
'Invalid chamber sync type %s for %s', sync_type, self.device_name
|
|
1169
|
+
)
|
|
1170
|
+
return False
|
|
1171
|
+
if (chamber_2 is None) != (sync_type == AirFryerSyncType.MATCH):
|
|
1172
|
+
logger.warning('Invalid chamber recipe combination for %s', self.device_name)
|
|
1173
|
+
return False
|
|
1174
|
+
first = self._prepare_recipe(chamber_1)
|
|
1175
|
+
if first is None:
|
|
1176
|
+
return False
|
|
1177
|
+
second = first if chamber_2 is None else self._prepare_recipe(chamber_2)
|
|
1178
|
+
if second is None:
|
|
1179
|
+
return False
|
|
1180
|
+
configs = [
|
|
1181
|
+
*self._build_cook_configs(first, AirFryerChamber.CHAMBER_1),
|
|
1182
|
+
*self._build_cook_configs(second, AirFryerChamber.CHAMBER_2),
|
|
1183
|
+
]
|
|
1184
|
+
return await self._start_cook_configs(configs, AirFryerChamber.BOTH, sync_type)
|
|
1185
|
+
|
|
1053
1186
|
async def set_mode(
|
|
1054
1187
|
self,
|
|
1055
1188
|
cook_time: int,
|
|
@@ -298,6 +298,12 @@ class FryerDualCookConfig(RequestBaseModel):
|
|
|
298
298
|
recipeId: int
|
|
299
299
|
recipeName: str
|
|
300
300
|
recipeType: int
|
|
301
|
+
shakeTime: int | None = None
|
|
302
|
+
|
|
303
|
+
class Config(RequestBaseModel.Config):
|
|
304
|
+
"""Leave ``shakeTime`` out of the request when it is not set."""
|
|
305
|
+
|
|
306
|
+
omit_none = True
|
|
301
307
|
|
|
302
308
|
|
|
303
309
|
@dataclass
|
|
@@ -351,7 +351,7 @@ class LibraryLogger:
|
|
|
351
351
|
msg += f'\n({", ".join(dif)})'
|
|
352
352
|
|
|
353
353
|
msg += '\n\n Full Response:'
|
|
354
|
-
msg += f'\n{
|
|
354
|
+
msg += f'\n{cls.api_printer(resp_dict)}'
|
|
355
355
|
msg += '\n\n---------------------------------'
|
|
356
356
|
msg += '\n\n Exception:'
|
|
357
357
|
msg += f'\n{exc.__traceback__}'
|
|
@@ -317,47 +317,52 @@ class VeSync: # pylint: disable=function-redefined
|
|
|
317
317
|
VeSyncServerError: If server returns an error.
|
|
318
318
|
"""
|
|
319
319
|
self.in_process = True
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
if response_dict is None:
|
|
340
|
-
raise VeSyncAPIResponseError(
|
|
341
|
-
'Error receiving response to device list request'
|
|
320
|
+
try:
|
|
321
|
+
if not self.auth.is_authenticated or (
|
|
322
|
+
not self.auth.token or not self.auth.account_id
|
|
323
|
+
):
|
|
324
|
+
logger.info("Not logged in to VeSync, can't get devices")
|
|
325
|
+
return False
|
|
326
|
+
|
|
327
|
+
request_model = RequestDeviceListModel(
|
|
328
|
+
token=self.auth.token,
|
|
329
|
+
accountID=self.auth.account_id,
|
|
330
|
+
timeZone=self.time_zone,
|
|
331
|
+
)
|
|
332
|
+
logger.debug('Requesting device list from VeSync')
|
|
333
|
+
response_dict, _ = await self.async_call_api(
|
|
334
|
+
'/cloud/v1/deviceManaged/devices',
|
|
335
|
+
'post',
|
|
336
|
+
headers=Helpers.req_header_bypass(),
|
|
337
|
+
json_object=request_model.to_dict(),
|
|
342
338
|
)
|
|
343
339
|
|
|
344
|
-
|
|
340
|
+
if response_dict is None:
|
|
341
|
+
raise VeSyncAPIResponseError(
|
|
342
|
+
'Error receiving response to device list request'
|
|
343
|
+
)
|
|
345
344
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
345
|
+
# An error response can have no result, so check it before parsing.
|
|
346
|
+
code = response_dict.get('code')
|
|
347
|
+
if code != 0:
|
|
348
|
+
error_info = ErrorCodes.get_error_info(code, response_dict.get('msg'))
|
|
349
|
+
if error_info.error_type == ErrorTypes.SERVER_ERROR:
|
|
350
|
+
raise VeSyncServerError(error_info.message)
|
|
351
|
+
msg = (
|
|
352
|
+
'Error receiving response to device list request: '
|
|
353
|
+
f'{error_info.message}'
|
|
354
|
+
)
|
|
355
|
+
raise VeSyncAPIResponseError(msg)
|
|
357
356
|
|
|
358
|
-
|
|
357
|
+
response = Helpers.model_maker(
|
|
358
|
+
logger, ResponseDeviceListModel, 'get_devices', response_dict
|
|
359
|
+
)
|
|
360
|
+
if response is None:
|
|
361
|
+
raise VeSyncAPIResponseError('Invalid device list response')
|
|
359
362
|
|
|
360
|
-
|
|
363
|
+
return self.process_devices(response)
|
|
364
|
+
finally:
|
|
365
|
+
self.in_process = False
|
|
361
366
|
|
|
362
367
|
async def login(self) -> bool: # pylint: disable=W9006 # pylint mult docstring raises
|
|
363
368
|
"""Log into VeSync server.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyvesync
|
|
3
|
-
Version: 3.5.
|
|
3
|
+
Version: 3.5.1
|
|
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>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|