From 73dab5c3d5d7c679b221c9d1e05b1dc699bc84b5 Mon Sep 17 00:00:00 2001 From: Felipe Martins Diel <41558831+felipediel@users.noreply.github.com> Date: Thu, 5 Nov 2020 16:19:03 -0300 Subject: [PATCH] Overload __str__ in the device class (#468) --- broadlink/device.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/broadlink/device.py b/broadlink/device.py index 07af618b..9392024f 100644 --- a/broadlink/device.py +++ b/broadlink/device.py @@ -143,6 +143,13 @@ def __repr__(self): "Locked" if self.is_locked else "Unlocked", ) + def __str__(self): + return "%s (%s at %s)" % ( + self.name, + self.model or hex(self.devtype), + self.host[0], + ) + def update_aes(self, key: bytes) -> None: """Update AES.""" self.aes = Cipher(