about summary refs log tree commit diff
diff options
context:
space:
mode:
-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):