mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-22 15:10:12 +01:00
Merge pull request #178 from lordneon/master
Fixed a bug within the SP2 class.
This commit is contained in:
commit
9c238e1717
@ -417,10 +417,16 @@ class sp2(device):
|
|||||||
err = response[0x22] | (response[0x23] << 8)
|
err = response[0x22] | (response[0x23] << 8)
|
||||||
if err == 0:
|
if err == 0:
|
||||||
payload = self.decrypt(bytes(response[0x38:]))
|
payload = self.decrypt(bytes(response[0x38:]))
|
||||||
if ord(payload[0x4]) == 1 or ord(payload[0x4]) == 3:
|
if type(payload[0x4]) == int:
|
||||||
state = True
|
if payload[0x4] == 1 or payload[0x4] == 3:
|
||||||
|
state = True
|
||||||
|
else:
|
||||||
|
state = False
|
||||||
else:
|
else:
|
||||||
state = False
|
if ord(payload[0x4]) == 1 or ord(payload[0x4]) == 3:
|
||||||
|
state = True
|
||||||
|
else:
|
||||||
|
state = False
|
||||||
return state
|
return state
|
||||||
|
|
||||||
def check_nightlight(self):
|
def check_nightlight(self):
|
||||||
@ -431,10 +437,16 @@ class sp2(device):
|
|||||||
err = response[0x22] | (response[0x23] << 8)
|
err = response[0x22] | (response[0x23] << 8)
|
||||||
if err == 0:
|
if err == 0:
|
||||||
payload = self.decrypt(bytes(response[0x38:]))
|
payload = self.decrypt(bytes(response[0x38:]))
|
||||||
if ord(payload[0x4]) == 2 or ord(payload[0x4]) == 3:
|
if type(payload[0x4]) == int:
|
||||||
state = True
|
if payload[0x4] == 2 or payload[0x4] == 3:
|
||||||
|
state = True
|
||||||
|
else:
|
||||||
|
state = False
|
||||||
else:
|
else:
|
||||||
state = False
|
if ord(payload[0x4]) == 2 or ord(payload[0x4]) == 3:
|
||||||
|
state = True
|
||||||
|
else:
|
||||||
|
state = False
|
||||||
return state
|
return state
|
||||||
|
|
||||||
def get_energy(self):
|
def get_energy(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user