added description variable to prioritize entry comment over name

This commit is contained in:
Tomaae 2022-02-04 20:33:54 +01:00
parent 89d2dc9513
commit 18f2e56691
2 changed files with 6 additions and 0 deletions

View file

@ -279,6 +279,11 @@ class MikrotikControllerSwitch(SwitchEntity, RestoreEntity):
@property
def name(self) -> str:
"""Return the name."""
if self.entity_description.data_name_comment and self._data["comment"]:
return (
f"{self._inst} {self.entity_description.name} {self._data['comment']}"
)
return f"{self._inst} {self.entity_description.name} {self._data[self.entity_description.data_name]}"
@property