mirror of
https://github.com/no2chem/wideq.git
synced 2025-05-16 23:30:10 -07:00
Remove unnecessary "Boolean" enums (#65)
These enums were only used internally and never exposed to the outside world, so they aren't really necessary---we can just do the necessary processing internally.
This commit is contained in:
parent
fc169e90e3
commit
b0b59c18dd
@ -1,7 +1,7 @@
|
|||||||
import enum
|
import enum
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from .client import Device, _UNKNOWN
|
from .client import Device
|
||||||
from .util import lookup_enum
|
from .util import lookup_enum
|
||||||
|
|
||||||
|
|
||||||
@ -31,29 +31,6 @@ class SmartSavingMode(enum.Enum):
|
|||||||
EMPTY = ""
|
EMPTY = ""
|
||||||
|
|
||||||
|
|
||||||
class SmartSavingModeStatus(enum.Enum):
|
|
||||||
OFF = "OFF"
|
|
||||||
ON = "ON"
|
|
||||||
EMPTY = ""
|
|
||||||
|
|
||||||
|
|
||||||
class EcoFriendly(enum.Enum):
|
|
||||||
OFF = "@CP_OFF_EN_W"
|
|
||||||
ON = "@CP_ON_EN_W"
|
|
||||||
|
|
||||||
|
|
||||||
class LockingStatus(enum.Enum):
|
|
||||||
UNLOCK = "UNLOCK"
|
|
||||||
LOCK = "LOCK"
|
|
||||||
|
|
||||||
|
|
||||||
class DoorOpenState(enum.Enum):
|
|
||||||
OPEN = "OPEN"
|
|
||||||
CLOSE = "CLOSE"
|
|
||||||
EMPTY = ""
|
|
||||||
UNKNOWN = _UNKNOWN
|
|
||||||
|
|
||||||
|
|
||||||
class RefrigeratorDevice(Device):
|
class RefrigeratorDevice(Device):
|
||||||
"""A higher-level interface for a refrigerator."""
|
"""A higher-level interface for a refrigerator."""
|
||||||
|
|
||||||
@ -127,8 +104,8 @@ class RefrigeratorStatus(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def door_opened(self):
|
def door_opened(self):
|
||||||
door = lookup_enum('DoorOpenState', self.data, self.refrigerator)
|
state = lookup_enum('DoorOpenState', self.data, self.refrigerator)
|
||||||
return DoorOpenState(door) == DoorOpenState.OPEN
|
return state == "OPEN"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def temp_unit(self):
|
def temp_unit(self):
|
||||||
@ -139,12 +116,12 @@ class RefrigeratorStatus(object):
|
|||||||
mode = lookup_enum(
|
mode = lookup_enum(
|
||||||
'SmartSavingModeStatus', self.data, self.refrigerator
|
'SmartSavingModeStatus', self.data, self.refrigerator
|
||||||
)
|
)
|
||||||
return SmartSavingModeStatus(mode) == SmartSavingModeStatus.ON
|
return mode == 'ON'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def locked(self):
|
def locked(self):
|
||||||
status = lookup_enum('LockingStatus', self.data, self.refrigerator)
|
status = lookup_enum('LockingStatus', self.data, self.refrigerator)
|
||||||
return LockingStatus(status) == LockingStatus.LOCK
|
return status == "LOCK"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def active_saving_status(self):
|
def active_saving_status(self):
|
||||||
@ -153,7 +130,7 @@ class RefrigeratorStatus(object):
|
|||||||
@property
|
@property
|
||||||
def eco_enabled(self):
|
def eco_enabled(self):
|
||||||
eco = lookup_enum('EcoFriendly', self.data, self.refrigerator)
|
eco = lookup_enum('EcoFriendly', self.data, self.refrigerator)
|
||||||
return EcoFriendly(eco) == EcoFriendly.ON
|
return eco == "@CP_ON_EN_W"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def water_filter_used_month(self):
|
def water_filter_used_month(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user