mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-11 09:58:01 +00:00
Make __repr__ work on discovery info (#1233)
This PR will make `__repr__` also work on smartdevices where only discovery data is available by modifying the `model` property to fallback to the data found in the discovery payloads.
This commit is contained in:
@@ -469,9 +469,11 @@ class Device(ABC):
|
||||
"""
|
||||
|
||||
def __repr__(self):
|
||||
if self._last_update is None:
|
||||
return f"<{self.device_type} at {self.host} - update() needed>"
|
||||
return f"<{self.device_type} at {self.host} - {self.alias} ({self.model})>"
|
||||
update_needed = " - update() needed" if not self._last_update else ""
|
||||
return (
|
||||
f"<{self.device_type} at {self.host} -"
|
||||
f" {self.alias} ({self.model}){update_needed}>"
|
||||
)
|
||||
|
||||
_deprecated_device_type_attributes = {
|
||||
# is_type
|
||||
|
Reference in New Issue
Block a user