mirror of
https://github.com/no2chem/wideq.git
synced 2025-05-29 05:20:24 -07:00
Don't crash when instant power isn't supported by unit
This commit is contained in:
parent
4d624159df
commit
b42985fc48
16
wideq/ac.py
16
wideq/ac.py
@ -4,7 +4,7 @@ import enum
|
|||||||
|
|
||||||
from .client import Device
|
from .client import Device
|
||||||
from .util import lookup_enum
|
from .util import lookup_enum
|
||||||
from .core import FailedRequestError
|
from .core import FailedRequestError, InvalidRequestError
|
||||||
|
|
||||||
|
|
||||||
class ACJetMode(enum.Enum):
|
class ACJetMode(enum.Enum):
|
||||||
@ -315,14 +315,20 @@ class ACDevice(Device):
|
|||||||
def get_outdoor_power(self):
|
def get_outdoor_power(self):
|
||||||
"""Get instant power usage in watts of the outdoor unit"""
|
"""Get instant power usage in watts of the outdoor unit"""
|
||||||
|
|
||||||
value = self._get_config('OutTotalInstantPower')
|
try:
|
||||||
return value['OutTotalInstantPower']
|
value = self._get_config('OutTotalInstantPower')
|
||||||
|
return value['OutTotalInstantPower']
|
||||||
|
except InvalidRequestError:
|
||||||
|
return 0 # Device does not support instant power usage of the outdoor unit
|
||||||
|
|
||||||
def get_power(self):
|
def get_power(self):
|
||||||
"""Get the instant power usage in watts of the whole unit"""
|
"""Get the instant power usage in watts of the whole unit"""
|
||||||
|
|
||||||
value = self._get_config('InOutInstantPower')
|
try:
|
||||||
return value['InOutInstantPower']
|
value = self._get_config('InOutInstantPower')
|
||||||
|
return value['InOutInstantPower']
|
||||||
|
except InvalidRequestError:
|
||||||
|
return 0 # Device does not support instant power usage of the whole unit
|
||||||
|
|
||||||
def get_light(self):
|
def get_light(self):
|
||||||
"""Get a Boolean indicating whether the display light is on."""
|
"""Get a Boolean indicating whether the display light is on."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user