diff --git a/custom_components/mikrotik_router/switch.py b/custom_components/mikrotik_router/switch.py index 8cf53fa..a6ce7c0 100644 --- a/custom_components/mikrotik_router/switch.py +++ b/custom_components/mikrotik_router/switch.py @@ -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 diff --git a/custom_components/mikrotik_router/switch_types.py b/custom_components/mikrotik_router/switch_types.py index 4fea1a0..3e64deb 100644 --- a/custom_components/mikrotik_router/switch_types.py +++ b/custom_components/mikrotik_router/switch_types.py @@ -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: [])