1
0
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:
Daniel Høyer Iversen 2019-06-10 09:12:50 +02:00 committed by GitHub
parent c94838f561
commit 9ec2da834b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -357,6 +357,8 @@ class mp1(device):
def check_power(self):
"""Returns the power state of the smart power strip."""
state = self.check_power_raw()
if state is None:
return {'s1': None, 's2': None, 's3': None, 's4': None}
data = {}
data['s1'] = bool(state & 0x01)
data['s2'] = bool(state & 0x02)