1
0
mirror of https://github.com/mjg59/python-broadlink.git synced 2024-11-10 18:00:12 +01:00

Add a method to update device name and lock status (#537)

This commit is contained in:
Felipe Martins Diel 2021-03-11 01:00:10 -03:00 committed by GitHub
parent 5dee06c815
commit 20b9eed6bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)