mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-08-29 14:18:11 +02:00
added description variable to prioritize entry comment over name
This commit is contained in:
parent
89d2dc9513
commit
18f2e56691
2 changed files with 6 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -152,6 +152,7 @@ class MikrotikSwitchEntityDescription(SwitchEntityDescription):
|
|||
data_switch_path: str = ""
|
||||
data_switch_parameter: str = "disabled"
|
||||
data_name: str = ""
|
||||
data_name_comment: bool = False
|
||||
data_uid: str = ""
|
||||
data_reference: str = ""
|
||||
data_attributes_list: List = field(default_factory=lambda: [])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue