diff options
author | Víctor Ferrer García <victorfergar@gmail.com> | 2017-01-03T05·31+0100 |
---|---|---|
committer | Matthew Garrett <mjg59@coreos.com> | 2017-01-03T05·31-0600 |
commit | 63e097d73fa43d4f2e1abcaea103af9007ee1532 (patch) | |
tree | 21218466b1ac45f050668eeb4bc48b158fc9e1f9 /broadlink/__init__.py | |
parent | a4465a751583c299f327a279d078a874e3e672ba (diff) |
check_power_raw included for mp1 devices
Export raw power state for MP1 devices
Diffstat (limited to 'broadlink/__init__.py')
-rw-r--r-- | broadlink/__init__.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/broadlink/__init__.py b/broadlink/__init__.py index bfa30527a459..d5cc8d28caea 100644 --- a/broadlink/__init__.py +++ b/broadlink/__init__.py @@ -286,8 +286,8 @@ class mp1(device): sid_mask = 0x01 << (sid - 1) return self.set_power_mask(sid_mask, state) - def check_power(self): - """Returns the power state of the smart power strip.""" + def check_power_raw(self): + """Returns the power state of the smart power strip in raw format.""" packet = bytearray(16) packet[0x00] = 0x0a packet[0x02] = 0xa5 @@ -307,12 +307,17 @@ class mp1(device): state = payload[0x0e] else: state = ord(payload[0x0e]) - data = {} - data['s1'] = bool(state & 0x01) - data['s2'] = bool(state & 0x02) - data['s3'] = bool(state & 0x04) - data['s4'] = bool(state & 0x08) - return data + return state + + def check_power(self): + """Returns the power state of the smart power strip.""" + state = self.check_power_raw() + data = {} + data['s1'] = bool(state & 0x01) + data['s2'] = bool(state & 0x02) + data['s3'] = bool(state & 0x04) + data['s4'] = bool(state & 0x08) + return data class sp1(device): |