1
0
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:
Paul Bottein
2026-03-30 15:23:49 +02:00
committed by GitHub
parent 5be12a213d
commit f0848edea9
3 changed files with 12 additions and 4 deletions

View File

@@ -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)}

View File

@@ -1,5 +1,10 @@
{
"entity": {
"button": {
"shutdown": {
"default": "mdi:power"
}
},
"sensor": {
"cpu_15min_load": {
"default": "mdi:chip"

View File

@@ -76,6 +76,11 @@
"name": "Security status"
}
},
"button": {
"shutdown": {
"name": "Shutdown"
}
},
"sensor": {
"cpu_15min_load": {
"name": "CPU load average (15 min)"