mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +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:
@@ -732,8 +732,10 @@ class SmartDevice(Device):
|
||||
if self._device_type is not DeviceType.Unknown:
|
||||
return self._device_type
|
||||
|
||||
# Fallback to device_type (from disco info)
|
||||
type_str = self._info.get("type", self._info.get("device_type"))
|
||||
self._device_type = self._get_device_type_from_components(
|
||||
list(self._components.keys()), self._info["type"]
|
||||
list(self._components.keys()), type_str
|
||||
)
|
||||
|
||||
return self._device_type
|
||||
|
Reference in New Issue
Block a user