mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-22 15:10:12 +01:00
check_power_raw included for mp1 devices
Export raw power state for MP1 devices
This commit is contained in:
parent
a4465a7515
commit
63e097d73f
@ -286,8 +286,8 @@ class mp1(device):
|
|||||||
sid_mask = 0x01 << (sid - 1)
|
sid_mask = 0x01 << (sid - 1)
|
||||||
return self.set_power_mask(sid_mask, state)
|
return self.set_power_mask(sid_mask, state)
|
||||||
|
|
||||||
def check_power(self):
|
def check_power_raw(self):
|
||||||
"""Returns the power state of the smart power strip."""
|
"""Returns the power state of the smart power strip in raw format."""
|
||||||
packet = bytearray(16)
|
packet = bytearray(16)
|
||||||
packet[0x00] = 0x0a
|
packet[0x00] = 0x0a
|
||||||
packet[0x02] = 0xa5
|
packet[0x02] = 0xa5
|
||||||
@ -307,12 +307,17 @@ class mp1(device):
|
|||||||
state = payload[0x0e]
|
state = payload[0x0e]
|
||||||
else:
|
else:
|
||||||
state = ord(payload[0x0e])
|
state = ord(payload[0x0e])
|
||||||
data = {}
|
return state
|
||||||
data['s1'] = bool(state & 0x01)
|
|
||||||
data['s2'] = bool(state & 0x02)
|
def check_power(self):
|
||||||
data['s3'] = bool(state & 0x04)
|
"""Returns the power state of the smart power strip."""
|
||||||
data['s4'] = bool(state & 0x08)
|
state = self.check_power_raw()
|
||||||
return data
|
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):
|
class sp1(device):
|
||||||
|
Loading…
Reference in New Issue
Block a user