Skip to content

Commit c8d2e22

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 233a93e commit c8d2e22

3 files changed

Lines changed: 50 additions & 64 deletions

File tree

src/pyvesync/base_devices/fryer_base.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,19 +244,15 @@ def set_preheat_stop_state(self, preheat_set_time: int | None = None) -> None:
244244
"""Set the fryer state to preheat stopped."""
245245
self.cook_status = AirFryerCookStatus.PREHEAT_STOP
246246
if preheat_set_time is not None:
247-
self.preheat_set_time = self.device.convert_time_for_state(
248-
preheat_set_time
249-
)
247+
self.preheat_set_time = self.device.convert_time_for_state(preheat_set_time)
250248
self.preheat_last_time = self.preheat_time_remaining
251249
self.last_timestamp = None
252250

253251
def set_preheat_resume_state(self, preheat_set_time: int | None = None) -> None:
254252
"""Set the fryer state to preheat resumed."""
255253
self.cook_status = AirFryerCookStatus.HEATING
256254
if preheat_set_time is not None:
257-
self.preheat_set_time = self.device.convert_time_for_state(
258-
preheat_set_time
259-
)
255+
self.preheat_set_time = self.device.convert_time_for_state(preheat_set_time)
260256
self.preheat_last_time = self.preheat_time_remaining
261257
self.last_timestamp = datetime.now(timezone.utc)
262258

@@ -363,9 +359,7 @@ def set_state( # noqa: PLR0912, PLR0913, C901
363359

364360
# Handle preheat attributes
365361
if preheat_set_time is not None:
366-
self.preheat_set_time = self.device.convert_time_for_state(
367-
preheat_set_time
368-
)
362+
self.preheat_set_time = self.device.convert_time_for_state(preheat_set_time)
369363
self.preheat_last_time = (
370364
self.device.convert_time_for_state(preheat_last_time)
371365
if preheat_last_time is not None

src/pyvesync/device_map.py

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,14 +1107,16 @@ class ThermostatMap(DeviceMapTemplate):
11071107
default_preset=AirFryerPresets.custom,
11081108
default_cook_mode=AirFryerCookModes.CUSTOM,
11091109
time_units=TimeUnits.MINUTES,
1110-
status_map=MappingProxyType({
1111-
'heating': AirFryerCookStatus.HEATING,
1112-
'cooking': AirFryerCookStatus.COOKING,
1113-
'cookStop': AirFryerCookStatus.COOK_STOP,
1114-
'heatStop': AirFryerCookStatus.PREHEAT_STOP,
1115-
'heatEnd': AirFryerCookStatus.PREHEAT_END,
1116-
'standby': AirFryerCookStatus.STANDBY,
1117-
})
1110+
status_map=MappingProxyType(
1111+
{
1112+
'heating': AirFryerCookStatus.HEATING,
1113+
'cooking': AirFryerCookStatus.COOKING,
1114+
'cookStop': AirFryerCookStatus.COOK_STOP,
1115+
'heatStop': AirFryerCookStatus.PREHEAT_STOP,
1116+
'heatEnd': AirFryerCookStatus.PREHEAT_END,
1117+
'standby': AirFryerCookStatus.STANDBY,
1118+
}
1119+
),
11181120
),
11191121
AirFryerMap(
11201122
class_name='VeSyncTurboBlazeFryer',
@@ -1134,14 +1136,16 @@ class ThermostatMap(DeviceMapTemplate):
11341136
time_units=TimeUnits.SECONDS,
11351137
temperature_range_f=(90, 450),
11361138
temperature_range_c=(30, 230),
1137-
status_map=MappingProxyType({
1138-
'ready': AirFryerCookStatus.COOK_STOP,
1139-
'cooking': AirFryerCookStatus.COOKING,
1140-
'heating': AirFryerCookStatus.HEATING,
1141-
'cookStop': AirFryerCookStatus.COOK_STOP,
1142-
'pullOut': AirFryerCookStatus.PULL_OUT,
1143-
'cookEnd': AirFryerCookStatus.COOK_END,
1144-
}),
1139+
status_map=MappingProxyType(
1140+
{
1141+
'ready': AirFryerCookStatus.COOK_STOP,
1142+
'cooking': AirFryerCookStatus.COOKING,
1143+
'heating': AirFryerCookStatus.HEATING,
1144+
'cookStop': AirFryerCookStatus.COOK_STOP,
1145+
'pullOut': AirFryerCookStatus.PULL_OUT,
1146+
'cookEnd': AirFryerCookStatus.COOK_END,
1147+
}
1148+
),
11451149
),
11461150
AirFryerMap(
11471151
class_name='VeSyncDualAirFryer',
@@ -1166,13 +1170,15 @@ class ThermostatMap(DeviceMapTemplate):
11661170
time_units=TimeUnits.SECONDS,
11671171
temperature_range_f=(130, 450),
11681172
temperature_range_c=(55, 240),
1169-
status_map=MappingProxyType({
1170-
'standby': AirFryerCookStatus.STANDBY,
1171-
'ready': AirFryerCookStatus.COOK_STOP,
1172-
'cooking': AirFryerCookStatus.COOKING,
1173-
'cookStop': AirFryerCookStatus.COOK_STOP,
1174-
'pullOut': AirFryerCookStatus.PULL_OUT,
1175-
}),
1173+
status_map=MappingProxyType(
1174+
{
1175+
'standby': AirFryerCookStatus.STANDBY,
1176+
'ready': AirFryerCookStatus.COOK_STOP,
1177+
'cooking': AirFryerCookStatus.COOKING,
1178+
'cookStop': AirFryerCookStatus.COOK_STOP,
1179+
'pullOut': AirFryerCookStatus.PULL_OUT,
1180+
}
1181+
),
11761182
),
11771183
]
11781184
"""List of ['AirFryerMap'][pyvesync.device_map.AirFryerMap] configuration

src/pyvesync/devices/vesynckitchen.py

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,7 @@ async def end(self, chamber: int = 1) -> bool:
301301
)
302302
return False
303303
json_cmd = {'jsonCmd': cmd}
304-
resp = await self.call_158_api(
305-
models.Fryer158RequestModel, update_dict=json_cmd
306-
)
304+
resp = await self.call_158_api(models.Fryer158RequestModel, update_dict=json_cmd)
307305
r = Helpers.process_dev_response(logger, 'end', self, resp)
308306
if r is None:
309307
return False
@@ -322,9 +320,7 @@ async def stop(self, chamber: int = 1) -> bool:
322320
)
323321
return False
324322
json_cmd = {'jsonCmd': cmd}
325-
resp = await self.call_158_api(
326-
models.Fryer158RequestModel, update_dict=json_cmd
327-
)
323+
resp = await self.call_158_api(models.Fryer158RequestModel, update_dict=json_cmd)
328324
r = Helpers.process_dev_response(logger, 'stop', self, resp)
329325
if r is None:
330326
return False
@@ -346,9 +342,7 @@ async def resume(self, chamber: int = 1) -> bool:
346342
)
347343
return False
348344
json_cmd = {'jsonCmd': cmd}
349-
resp = await self.call_158_api(
350-
models.Fryer158RequestModel, update_dict=json_cmd
351-
)
345+
resp = await self.call_158_api(models.Fryer158RequestModel, update_dict=json_cmd)
352346
r = Helpers.process_dev_response(logger, 'resume', self, resp)
353347
if r is None:
354348
return False
@@ -379,9 +373,7 @@ async def set_mode_from_recipe(
379373
)
380374
cmd = {'cookMode': cook_req}
381375
json_cmd = {'jsonCmd': cmd}
382-
resp = await self.call_158_api(
383-
models.Fryer158RequestModel, update_dict=json_cmd
384-
)
376+
resp = await self.call_158_api(models.Fryer158RequestModel, update_dict=json_cmd)
385377
r = Helpers.process_dev_response(logger, 'set_mode_from_recipe', self, resp)
386378
if r is None:
387379
return False
@@ -433,9 +425,7 @@ async def cook_from_preheat(self, chamber: int = 1) -> bool:
433425
}
434426
}
435427
json_cmd = {'jsonCmd': cmd}
436-
resp = await self.call_158_api(
437-
models.Fryer158RequestModel, update_dict=json_cmd
438-
)
428+
resp = await self.call_158_api(models.Fryer158RequestModel, update_dict=json_cmd)
439429
r = Helpers.process_dev_response(logger, 'cook_from_preheat', self, resp)
440430
if r is None:
441431
return False
@@ -737,17 +727,11 @@ def _build_cook_configs(
737727

738728
if self.sync_chambers:
739729
return [
740-
models.FryerDualCookConfig.from_dict(
741-
{**config_dict, 'chamber': 1}
742-
),
743-
models.FryerDualCookConfig.from_dict(
744-
{**config_dict, 'chamber': 2}
745-
),
730+
models.FryerDualCookConfig.from_dict({**config_dict, 'chamber': 1}),
731+
models.FryerDualCookConfig.from_dict({**config_dict, 'chamber': 2}),
746732
]
747733
return [
748-
models.FryerDualCookConfig.from_dict(
749-
{**config_dict, 'chamber': chamber}
750-
),
734+
models.FryerDualCookConfig.from_dict({**config_dict, 'chamber': chamber}),
751735
]
752736

753737
async def set_mode_from_recipe(
@@ -770,14 +754,16 @@ async def set_mode_from_recipe(
770754
work_chamber = self._get_work_chamber(chamber)
771755
sync_type = self._get_sync_type()
772756

773-
start_data = models.FryerDualStartCookData.from_dict({
774-
'accountId': self.manager.account_id,
775-
'cookConfigs': [c.to_dict() for c in cook_configs],
776-
'readyStart': True,
777-
'syncType': sync_type,
778-
'tempUnit': self.temp_unit.code,
779-
'workChamber': work_chamber,
780-
})
757+
start_data = models.FryerDualStartCookData.from_dict(
758+
{
759+
'accountId': self.manager.account_id,
760+
'cookConfigs': [c.to_dict() for c in cook_configs],
761+
'readyStart': True,
762+
'syncType': sync_type,
763+
'tempUnit': self.temp_unit.code,
764+
'workChamber': work_chamber,
765+
}
766+
)
781767

782768
resp = await self.call_bypassv2_api(
783769
payload_method='startMultiCook',

0 commit comments

Comments
 (0)