1
0
mirror of https://github.com/mjg59/python-broadlink.git synced 2024-11-21 22:51:41 +01:00

Add method for obtaining the firmware version (#379)

* Add method for obtaining firmware version

* Use hex notation for bytes

Co-authored-by: Daniel Høyer Iversen <mail@dahoiv.net>
This commit is contained in:
Felipe Martins Diel 2020-06-08 07:20:22 -03:00 committed by GitHub
parent 76bcfd0bfb
commit 4b90e437a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,6 +235,13 @@ class device:
return True
def get_fwversion(self):
packet = bytearray([0x68])
response = self.send_packet(0x6a, packet)
check_error(response[0x22:0x24])
payload = self.decrypt(response[0x38:])
return payload[0x4] | payload[0x5] << 8
def change_name(self, name):
packet = bytearray(4)
packet.extend(map(ord, name))