about summary refs log tree commit diff
path: root/broadlink
diff options
context:
space:
mode:
authorDimitrij <Dima-73@inbox.lv>2017-04-22T19·36+0300
committerMatthew Garrett <mjg59-github@srcf.ucam.org>2017-04-22T19·36-0700
commitd346476e6397be9f428c38ac7fe567e91ba3dab1 (patch)
treeb0e565ca17557bc6f3fead403d36b3a7559b4546 /broadlink
parent4f03ffb963d65b65e2d80b5fdcf24b2f02d13e14 (diff)
fix check_power for SP2/SP3 (#72)
Fixed up to avoid merge conflict with #78 
Diffstat (limited to 'broadlink')
-rw-r--r--broadlink/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/broadlink/__init__.py b/broadlink/__init__.py
index a6f2c36d6b69..495e07c99f0b 100644
--- a/broadlink/__init__.py
+++ b/broadlink/__init__.py
@@ -374,7 +374,11 @@ class sp2(device):
     err = response[0x22] | (response[0x23] << 8)
     if err == 0:
       payload = self.decrypt(bytes(response[0x38:]))
-      return bool(payload[0x4])
+      if type(payload[0x4]) == int:
+        state = bool(payload[0x4])
+      else:
+        state = bool(ord(payload[0x4]))
+      return state
 
 class a1(device):
   def __init__ (self, host, mac):