mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-22 07:00:12 +01:00
handle none power raw (#250)
This commit is contained in:
parent
c94838f561
commit
9ec2da834b
@ -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 New Issue
Block a user