1
0
mirror of https://github.com/mjg59/python-broadlink.git synced 2024-11-22 23:17:47 +01:00

Update cover.py

This commit is contained in:
burjakremen 2020-11-09 18:52:17 +02:00 committed by GitHub
parent 3cd4dcdd6f
commit c08c2748b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,21 +69,21 @@ class dooya_new(device):
def _send(self, command: int, attribute: int = 0) -> int:
"""Send a packet to the device."""
checksum = 0xc0c4 + command + attribute & 0xffff
checksum = 0xC0C4 + command + attribute & 0xFFFF
packet = bytearray(32)
packet[0] = 0x16
packet[2] = 0xa5
packet[3] = 0xa5
packet[4] = 0x5a
packet[5] = 0x5a
packet[6] = checksum & 0xff
packet[2] = 0xA5
packet[3] = 0xA5
packet[4] = 0x5A
packet[5] = 0x5A
packet[6] = checksum & 0xFF
packet[7] = checksum >> 8
packet[8] = 0x02
packet[9] = 0x0b
packet[10] = 0x0a
packet[9] = 0x0B
packet[10] = 0x0A
packet[15] = command
packet[16] = attribute
response = self.send_packet(0x6a, packet)
response = self.send_packet(0x6A, packet)
check_error(response[0x22:0x24])
payload = self.decrypt(response[0x38:])
return payload[17]