Simplify device __repr__ (#805)

Previously:
```
>>> dev
<DeviceType.Hub model H100 at 192.168.xx.xx (Smart Hub), is_on: False - dev specific: {'overheated': False, 'signal_level': 2, 'SSID': 'xx'}>
>>> dev.children[0]
<ChildDevice Temperature Humidity Sensor of <DeviceType.Hub model H100 at 192.168.xx.xx (Smart Hub), is_on: False - dev specific: {'overheated': False, 'signal_level': 2, 'SSID': 'xx'}>>
```

Now:
```
>>> dev
Device: <DeviceType.Hub at 192.168.xx.xx - Smart Hub (H100)>
>>> dev.children[0]
<DeviceType.Sensor Temperature Humidity Sensor (T315) of <DeviceType.Hub at 192.168.xx.xx - Smart Hub (H100)>>
```
This commit is contained in:
Teemu R
2024-03-05 13:35:19 +01:00
committed by GitHub
parent fcad0d2344
commit eb4c048b57
3 changed files with 3 additions and 7 deletions

View File

@@ -56,4 +56,4 @@ class SmartChildDevice(SmartDevice):
return dev_type
def __repr__(self):
return f"<ChildDevice {self.alias} of {self._parent}>"
return f"<{self.device_type} {self.alias} ({self.model}) of {self._parent}>"