handle none power raw (#250)
This commit is contained in:
parent
c94838f561
commit
9ec2da834b
1 changed files with 2 additions and 0 deletions
|
@ -357,6 +357,8 @@ class mp1(device):
|
||||||
def check_power(self):
|
def check_power(self):
|
||||||
"""Returns the power state of the smart power strip."""
|
"""Returns the power state of the smart power strip."""
|
||||||
state = self.check_power_raw()
|
state = self.check_power_raw()
|
||||||
|
if state is None:
|
||||||
|
return {'s1': None, 's2': None, 's3': None, 's4': None}
|
||||||
data = {}
|
data = {}
|
||||||
data['s1'] = bool(state & 0x01)
|
data['s1'] = bool(state & 0x01)
|
||||||
data['s2'] = bool(state & 0x02)
|
data['s2'] = bool(state & 0x02)
|
||||||
|
|
Loading…
Reference in a new issue