mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-25 10:18:43 +02:00
Migrated to new entity naming style
This commit is contained in:
parent
1a0861fd9c
commit
0b4a7a3c72
8 changed files with 37 additions and 37 deletions
|
@ -168,6 +168,8 @@ def model_update_items(
|
|||
class MikrotikEntity:
|
||||
"""Define entity"""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
inst,
|
||||
|
@ -194,17 +196,23 @@ class MikrotikEntity:
|
|||
"""Return the name for this entity"""
|
||||
if not self._uid:
|
||||
if self.entity_description.data_name_comment and self._data["comment"]:
|
||||
return f"{self._inst} {self._data['comment']}"
|
||||
return f"{self._data['comment']}"
|
||||
|
||||
return f"{self._inst} {self.entity_description.name}"
|
||||
return f"{self.entity_description.name}"
|
||||
|
||||
if self.entity_description.data_name_comment and self._data["comment"]:
|
||||
return f"{self._data['comment']}"
|
||||
|
||||
if self.entity_description.name:
|
||||
if self.entity_description.data_name_comment and self._data["comment"]:
|
||||
return f"{self._inst} {self.entity_description.name} {self._data['comment']}"
|
||||
if (
|
||||
self._data[self.entity_description.data_reference]
|
||||
== self._data[self.entity_description.data_name]
|
||||
):
|
||||
return f"{self.entity_description.name}"
|
||||
|
||||
return f"{self._inst} {self._data[self.entity_description.data_name]} {self.entity_description.name}"
|
||||
return f"{self._data[self.entity_description.data_name]} {self.entity_description.name}"
|
||||
|
||||
return f"{self._inst} {self._data[self.entity_description.data_name]}"
|
||||
return f"{self._data[self.entity_description.data_name]}"
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue