From 4b90e437a0cacdcdfbb217ceaf1a3e5f3672e610 Mon Sep 17 00:00:00 2001 From: Felipe Martins Diel <41558831+felipediel@users.noreply.github.com> Date: Mon, 8 Jun 2020 07:20:22 -0300 Subject: [PATCH] Add method for obtaining the firmware version (#379) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add method for obtaining firmware version * Use hex notation for bytes Co-authored-by: Daniel Høyer Iversen --- broadlink/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/broadlink/__init__.py b/broadlink/__init__.py index 896459f..73f64da 100644 --- a/broadlink/__init__.py +++ b/broadlink/__init__.py @@ -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))