mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-05-03 05:01:12 +00:00
Use repr() for enum values in Feature.__repr__ (#1414)
Instead of simply displaying the enum value, use repr to get a nicer output for the cli. Was: `Error (vacuum_error): 14` Now: `Error (vacuum_error): <ErrorCode.DustBinRemoved: 14>`
This commit is contained in:
parent
6aa019280b
commit
48a07a2970
@ -295,6 +295,8 @@ class Feature:
|
||||
if self.precision_hint is not None and isinstance(value, float):
|
||||
value = round(value, self.precision_hint)
|
||||
|
||||
if isinstance(value, Enum):
|
||||
value = repr(value)
|
||||
s = f"{self.name} ({self.id}): {value}"
|
||||
if self.unit is not None:
|
||||
s += f" {self.unit}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user