From d346476e6397be9f428c38ac7fe567e91ba3dab1 Mon Sep 17 00:00:00 2001 From: Dimitrij Date: Sat, 22 Apr 2017 22:36:50 +0300 Subject: fix check_power for SP2/SP3 (#72) Fixed up to avoid merge conflict with #78 --- broadlink/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'broadlink') 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): -- cgit 1.4.1