mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-08-31 15:09:32 +02:00
title implemented via entity descriptor
This commit is contained in:
parent
bd9009be47
commit
b2d36ebafc
2 changed files with 5 additions and 10 deletions
|
@ -56,6 +56,7 @@ class MikrotikRouterOSUpdate(MikrotikEntity, UpdateEntity):
|
|||
self._attr_supported_features = UpdateEntityFeature.INSTALL
|
||||
self._attr_supported_features |= UpdateEntityFeature.BACKUP
|
||||
self._attr_supported_features |= UpdateEntityFeature.RELEASE_NOTES
|
||||
self._attr_title = self.entity_description.title
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
|
@ -103,11 +104,6 @@ class MikrotikRouterOSUpdate(MikrotikEntity, UpdateEntity):
|
|||
"""URL to the full release notes of the latest version available."""
|
||||
return "https://mikrotik.com/download/changelogs"
|
||||
|
||||
@property
|
||||
def title(self) -> str:
|
||||
"""Title of the update entity."""
|
||||
return "Mikrotik RouterOS"
|
||||
|
||||
|
||||
# ---------------------------
|
||||
# MikrotikRouterBoardFWUpdate
|
||||
|
@ -129,6 +125,7 @@ class MikrotikRouterBoardFWUpdate(MikrotikEntity, UpdateEntity):
|
|||
super().__init__(inst, uid, mikrotik_controller, entity_description)
|
||||
|
||||
self._attr_supported_features = UpdateEntityFeature.INSTALL
|
||||
self._attr_title = self.entity_description.title
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
|
@ -155,8 +152,3 @@ class MikrotikRouterBoardFWUpdate(MikrotikEntity, UpdateEntity):
|
|||
"""Install an update."""
|
||||
self._ctrl.execute("/system/routerboard", "upgrade", None, None)
|
||||
self._ctrl.execute("/system", "reboot", None, None)
|
||||
|
||||
@property
|
||||
def title(self) -> str:
|
||||
"""Title of the update entity."""
|
||||
return "Mikrotik RouterBoard"
|
||||
|
|
|
@ -11,6 +11,7 @@ class MikrotikUpdateEntityDescription(UpdateEntityDescription):
|
|||
ha_group: str = ""
|
||||
ha_connection: str = ""
|
||||
ha_connection_value: str = ""
|
||||
title: str = ""
|
||||
data_path: str = ""
|
||||
data_attribute: str = "available"
|
||||
data_name: str = ""
|
||||
|
@ -26,6 +27,7 @@ SENSOR_TYPES = {
|
|||
key="system_rosupdate",
|
||||
name="RouterOS update",
|
||||
ha_group="System",
|
||||
title="Mikrotik RouterOS",
|
||||
data_path="fw-update",
|
||||
data_name="",
|
||||
data_uid="",
|
||||
|
@ -36,6 +38,7 @@ SENSOR_TYPES = {
|
|||
key="system_rbfwupdate",
|
||||
name="RouterBoard firmware update",
|
||||
ha_group="System",
|
||||
title="Mikrotik RouterBoard",
|
||||
data_path="routerboard",
|
||||
data_attribute="current-firmware",
|
||||
data_name="",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue