mirror of
https://github.com/home-assistant/core.git
synced 2026-04-02 00:20:30 +01:00
Use translation key and icons.json for Synology DSM button entities (#166862)
This commit is contained in:
@@ -34,15 +34,13 @@ class SynologyDSMbuttonDescription(ButtonEntityDescription):
|
||||
BUTTONS: Final = [
|
||||
SynologyDSMbuttonDescription(
|
||||
key="reboot",
|
||||
name="Reboot",
|
||||
device_class=ButtonDeviceClass.RESTART,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
press_action=lambda syno_api: syno_api.async_reboot,
|
||||
),
|
||||
SynologyDSMbuttonDescription(
|
||||
key="shutdown",
|
||||
name="Shutdown",
|
||||
icon="mdi:power",
|
||||
translation_key="shutdown",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
press_action=lambda syno_api: syno_api.async_shutdown,
|
||||
),
|
||||
@@ -63,6 +61,7 @@ class SynologyDSMButton(ButtonEntity):
|
||||
"""Defines a Synology DSM button."""
|
||||
|
||||
entity_description: SynologyDSMbuttonDescription
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -75,7 +74,6 @@ class SynologyDSMButton(ButtonEntity):
|
||||
if TYPE_CHECKING:
|
||||
assert api.network is not None
|
||||
assert api.information is not None
|
||||
self._attr_name = f"{api.network.hostname} {description.name}"
|
||||
self._attr_unique_id = f"{api.information.serial}_{description.key}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, api.information.serial)}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"entity": {
|
||||
"button": {
|
||||
"shutdown": {
|
||||
"default": "mdi:power"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"cpu_15min_load": {
|
||||
"default": "mdi:chip"
|
||||
|
||||
@@ -76,6 +76,11 @@
|
||||
"name": "Security status"
|
||||
}
|
||||
},
|
||||
"button": {
|
||||
"shutdown": {
|
||||
"name": "Shutdown"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"cpu_15min_load": {
|
||||
"name": "CPU load average (15 min)"
|
||||
|
||||
Reference in New Issue
Block a user