mirror of
https://github.com/no2chem/wideq.git
synced 2025-05-29 05:20:24 -07:00
Fix for flake8
This commit is contained in:
parent
cfd27c0100
commit
c273a26889
@ -64,24 +64,29 @@ class DoorOpenState(enum.Enum):
|
|||||||
class RefrigeratorDevice(Device):
|
class RefrigeratorDevice(Device):
|
||||||
"""A higher-level interface for a refrigerator."""
|
"""A higher-level interface for a refrigerator."""
|
||||||
|
|
||||||
def set_temp_refrigerator_c(self, temp_refrigerator):
|
def set_temp_refrigerator_c(self, temp):
|
||||||
|
|
||||||
temp_refrigerator_value = self.model.enum_value('TempRefrigerator', str(temp_refrigerator))
|
value = self.model.enum_value('TempRefrigerator', str(temp))
|
||||||
# '{"RETM":"{{TempRefrigerator}}", "REFT":"{{TempFreezer}}", "REIP":"{{IcePlus}}", "REEF":"{{EcoFriendly}}" }'
|
# {
|
||||||
self._set_control('RETM', temp_refrigerator_value)
|
# "RETM":"{{TempRefrigerator}}",
|
||||||
|
# "REFT":"{{TempFreezer}}",
|
||||||
|
# "REIP":"{{IcePlus}}",
|
||||||
|
# "REEF":"{{EcoFriendly}}"
|
||||||
|
# }
|
||||||
|
self._set_control('RETM', value)
|
||||||
|
|
||||||
def set_temp_freezer_c(self, temp_freezer):
|
def set_temp_freezer_c(self, temp):
|
||||||
|
|
||||||
temp_freezer_value = self.model.enum_value('TempFreezer', str(temp_freezer))
|
value = self.model.enum_value('TempFreezer', str(temp))
|
||||||
self._set_control('REFT', temp_freezer_value)
|
self._set_control('REFT', value)
|
||||||
|
|
||||||
def poll(self) -> Optional['RefrigeratorStatus']:
|
def poll(self) -> Optional['RefrigeratorStatus']:
|
||||||
"""Poll the device's current state.
|
"""Poll the device's current state.
|
||||||
|
|
||||||
Monitoring must be started first with `monitor_start`.
|
Monitoring must be started first with `monitor_start`.
|
||||||
|
|
||||||
:returns: Either a `RefrigeratorStatus` instance or `None` if the status is
|
:returns: Either a `RefrigeratorStatus` instance or `None` if the
|
||||||
not yet available.
|
status is not yet available.
|
||||||
"""
|
"""
|
||||||
# Abort if monitoring has not started yet.
|
# Abort if monitoring has not started yet.
|
||||||
if not hasattr(self, 'mon'):
|
if not hasattr(self, 'mon'):
|
||||||
@ -108,28 +113,33 @@ class RefrigeratorStatus(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def temp_refrigerator_c(self):
|
def temp_refrigerator_c(self):
|
||||||
return int(lookup_enum('TempRefrigerator', self.data, self.refrigerator))
|
temp = lookup_enum('TempRefrigerator', self.data, self.refrigerator)
|
||||||
|
return int(temp)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def temp_freezer_c(self):
|
def temp_freezer_c(self):
|
||||||
return int(lookup_enum('TempFreezer', self.data, self.refrigerator))
|
temp = lookup_enum('TempFreezer', self.data, self.refrigerator)
|
||||||
|
return int(temp)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ice_plus_status(self):
|
def ice_plus_status(self):
|
||||||
return IcePlus(lookup_enum('IcePlus', self.data, self.refrigerator))
|
status = lookup_enum('IcePlus', self.data, self.refrigerator)
|
||||||
|
return IcePlus(status)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def fresh_air_filter_status(self):
|
def fresh_air_filter_status(self):
|
||||||
return FreshAirFilter(lookup_enum('FreshAirFilter', self.data, self.refrigerator))
|
status = lookup_enum('FreshAirFilter', self.data, self.refrigerator)
|
||||||
|
return FreshAirFilter(status)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def energy_saving_mode(self):
|
def energy_saving_mode(self):
|
||||||
return SmartSavingMode(lookup_enum('SmartSavingMode', self.data, self.refrigerator))
|
mode = lookup_enum('SmartSavingMode', self.data, self.refrigerator)
|
||||||
|
return SmartSavingMode(mode)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def door_opened(self):
|
def door_opened(self):
|
||||||
door = DoorOpenState(lookup_enum('DoorOpenState', self.data, self.refrigerator))
|
door = lookup_enum('DoorOpenState', self.data, self.refrigerator)
|
||||||
return door == DoorOpenState.OPEN
|
return DoorOpenState(door) == DoorOpenState.OPEN
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def temp_unit(self):
|
def temp_unit(self):
|
||||||
@ -137,13 +147,15 @@ class RefrigeratorStatus(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def energy_saving_enabled(self):
|
def energy_saving_enabled(self):
|
||||||
status = SmartSavingModeStatus(lookup_enum('SmartSavingModeStatus', self.data, self.refrigerator))
|
mode = lookup_enum(
|
||||||
return status == SmartSavingModeStatus.ON
|
'SmartSavingModeStatus', self.data, self.refrigerator
|
||||||
|
)
|
||||||
|
return SmartSavingModeStatus(mode) == SmartSavingModeStatus.ON
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def locked(self):
|
def locked(self):
|
||||||
status = LockingStatus(lookup_enum('LockingStatus', self.data, self.refrigerator))
|
status = lookup_enum('LockingStatus', self.data, self.refrigerator)
|
||||||
return status == LockingStatus.LOCK
|
return LockingStatus(status) == LockingStatus.LOCK
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def active_saving_status(self):
|
def active_saving_status(self):
|
||||||
@ -151,8 +163,8 @@ class RefrigeratorStatus(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def eco_enabled(self):
|
def eco_enabled(self):
|
||||||
eco = EcoFriendly(lookup_enum('EcoFriendly', self.data, self.refrigerator))
|
eco = lookup_enum('EcoFriendly', self.data, self.refrigerator)
|
||||||
return eco == EcoFriendly.ON
|
return EcoFriendly(eco) == EcoFriendly.ON
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def water_filter_used_month(self):
|
def water_filter_used_month(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user