From 20b9eed6bc4159213af69dd90f7ebc642cd356c9 Mon Sep 17 00:00:00 2001 From: Felipe Martins Diel <41558831+felipediel@users.noreply.github.com> Date: Thu, 11 Mar 2021 01:00:10 -0300 Subject: [PATCH] Add a method to update device name and lock status (#537) --- broadlink/remote.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/broadlink/remote.py b/broadlink/remote.py index 7e4f91e..1227dae 100644 --- a/broadlink/remote.py +++ b/broadlink/remote.py @@ -18,6 +18,12 @@ class rmmini(device): payload = self.decrypt(resp[0x38:]) return payload[0x4:] + def update(self) -> None: + """Update device name and lock status.""" + resp = self._send(0x1) + self.name = resp[0x48:].split(b"\x00")[0].decode() + self.is_locked = bool(resp[0x87]) + def send_data(self, data: bytes) -> None: """Send a code to the device.""" self._send(0x2, data)