Add entity name translations to Synology DSM (#90706)
* add entity name translation * sort strings * sort and capitalize stringspull/90725/head
parent
2d1bb6135c
commit
7e543882fc
|
@ -38,7 +38,7 @@ SECURITY_BINARY_SENSORS: tuple[SynologyDSMBinarySensorEntityDescription, ...] =
|
|||
SynologyDSMBinarySensorEntityDescription(
|
||||
api_key=SynoCoreSecurity.API_KEY,
|
||||
key="status",
|
||||
name="Security Status",
|
||||
translation_key="status",
|
||||
device_class=BinarySensorDeviceClass.SAFETY,
|
||||
),
|
||||
)
|
||||
|
@ -47,14 +47,14 @@ STORAGE_DISK_BINARY_SENSORS: tuple[SynologyDSMBinarySensorEntityDescription, ...
|
|||
SynologyDSMBinarySensorEntityDescription(
|
||||
api_key=SynoStorage.API_KEY,
|
||||
key="disk_exceed_bad_sector_thr",
|
||||
name="Exceeded Max Bad Sectors",
|
||||
translation_key="disk_exceed_bad_sector_thr",
|
||||
device_class=BinarySensorDeviceClass.SAFETY,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
SynologyDSMBinarySensorEntityDescription(
|
||||
api_key=SynoStorage.API_KEY,
|
||||
key="disk_below_remain_life_thr",
|
||||
name="Below Min Remaining Life",
|
||||
translation_key="disk_below_remain_life_thr",
|
||||
device_class=BinarySensorDeviceClass.SAFETY,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
|
|
|
@ -35,6 +35,7 @@ class SynologyDSMBaseEntity(CoordinatorEntity[_CoordinatorT]):
|
|||
entity_description: SynologyDSMEntityDescription
|
||||
unique_id: str
|
||||
_attr_attribution = ATTRIBUTION
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -47,7 +48,6 @@ class SynologyDSMBaseEntity(CoordinatorEntity[_CoordinatorT]):
|
|||
self.entity_description = description
|
||||
|
||||
self._api = api
|
||||
self._attr_name = f"{api.network.hostname} {description.name}"
|
||||
self._attr_unique_id: str = (
|
||||
f"{api.information.serial}_{description.api_key}:{description.key}"
|
||||
)
|
||||
|
@ -110,9 +110,6 @@ class SynologyDSMDeviceEntity(
|
|||
self._device_firmware = disk["firm"]
|
||||
self._device_type = disk["diskType"]
|
||||
|
||||
self._attr_name = (
|
||||
f"{self._api.network.hostname} ({self._device_name}) {description.name}"
|
||||
)
|
||||
self._attr_unique_id += f"_{self._device_id}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, f"{self._api.information.serial}_{self._device_id}")},
|
||||
|
|
|
@ -50,7 +50,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="cpu_other_load",
|
||||
name="CPU Utilization (Other)",
|
||||
translation_key="cpu_other_load",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:chip",
|
||||
entity_registry_enabled_default=False,
|
||||
|
@ -59,7 +59,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="cpu_user_load",
|
||||
name="CPU Utilization (User)",
|
||||
translation_key="cpu_user_load",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:chip",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -67,7 +67,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="cpu_system_load",
|
||||
name="CPU Utilization (System)",
|
||||
translation_key="cpu_system_load",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:chip",
|
||||
entity_registry_enabled_default=False,
|
||||
|
@ -76,7 +76,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="cpu_total_load",
|
||||
name="CPU Utilization (Total)",
|
||||
translation_key="cpu_total_load",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:chip",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -84,7 +84,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="cpu_1min_load",
|
||||
name="CPU Load Average (1 min)",
|
||||
translation_key="cpu_1min_load",
|
||||
native_unit_of_measurement=ENTITY_UNIT_LOAD,
|
||||
icon="mdi:chip",
|
||||
entity_registry_enabled_default=False,
|
||||
|
@ -92,21 +92,21 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="cpu_5min_load",
|
||||
name="CPU Load Average (5 min)",
|
||||
translation_key="cpu_5min_load",
|
||||
native_unit_of_measurement=ENTITY_UNIT_LOAD,
|
||||
icon="mdi:chip",
|
||||
),
|
||||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="cpu_15min_load",
|
||||
name="CPU Load Average (15 min)",
|
||||
translation_key="cpu_15min_load",
|
||||
native_unit_of_measurement=ENTITY_UNIT_LOAD,
|
||||
icon="mdi:chip",
|
||||
),
|
||||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="memory_real_usage",
|
||||
name="Memory Usage (Real)",
|
||||
translation_key="memory_real_usage",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:memory",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -114,7 +114,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="memory_size",
|
||||
name="Memory Size",
|
||||
translation_key="memory_size",
|
||||
native_unit_of_measurement=UnitOfInformation.MEGABYTES,
|
||||
device_class=SensorDeviceClass.DATA_SIZE,
|
||||
icon="mdi:memory",
|
||||
|
@ -124,7 +124,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="memory_cached",
|
||||
name="Memory Cached",
|
||||
translation_key="memory_cached",
|
||||
native_unit_of_measurement=UnitOfInformation.MEGABYTES,
|
||||
device_class=SensorDeviceClass.DATA_SIZE,
|
||||
icon="mdi:memory",
|
||||
|
@ -134,7 +134,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="memory_available_swap",
|
||||
name="Memory Available (Swap)",
|
||||
translation_key="memory_available_swap",
|
||||
native_unit_of_measurement=UnitOfInformation.MEGABYTES,
|
||||
device_class=SensorDeviceClass.DATA_SIZE,
|
||||
icon="mdi:memory",
|
||||
|
@ -143,7 +143,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="memory_available_real",
|
||||
name="Memory Available (Real)",
|
||||
translation_key="memory_available_real",
|
||||
native_unit_of_measurement=UnitOfInformation.MEGABYTES,
|
||||
device_class=SensorDeviceClass.DATA_SIZE,
|
||||
icon="mdi:memory",
|
||||
|
@ -152,7 +152,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="memory_total_swap",
|
||||
name="Memory Total (Swap)",
|
||||
translation_key="memory_total_swap",
|
||||
native_unit_of_measurement=UnitOfInformation.MEGABYTES,
|
||||
device_class=SensorDeviceClass.DATA_SIZE,
|
||||
icon="mdi:memory",
|
||||
|
@ -161,7 +161,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="memory_total_real",
|
||||
name="Memory Total (Real)",
|
||||
translation_key="memory_total_real",
|
||||
native_unit_of_measurement=UnitOfInformation.MEGABYTES,
|
||||
device_class=SensorDeviceClass.DATA_SIZE,
|
||||
icon="mdi:memory",
|
||||
|
@ -170,7 +170,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="network_up",
|
||||
name="Upload Throughput",
|
||||
translation_key="network_up",
|
||||
native_unit_of_measurement=UnitOfDataRate.KILOBYTES_PER_SECOND,
|
||||
device_class=SensorDeviceClass.DATA_RATE,
|
||||
icon="mdi:upload",
|
||||
|
@ -179,7 +179,7 @@ UTILISATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoCoreUtilization.API_KEY,
|
||||
key="network_down",
|
||||
name="Download Throughput",
|
||||
translation_key="network_down",
|
||||
native_unit_of_measurement=UnitOfDataRate.KILOBYTES_PER_SECOND,
|
||||
device_class=SensorDeviceClass.DATA_RATE,
|
||||
icon="mdi:download",
|
||||
|
@ -190,13 +190,13 @@ STORAGE_VOL_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoStorage.API_KEY,
|
||||
key="volume_status",
|
||||
name="Status",
|
||||
translation_key="volume_status",
|
||||
icon="mdi:checkbox-marked-circle-outline",
|
||||
),
|
||||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoStorage.API_KEY,
|
||||
key="volume_size_total",
|
||||
name="Total Size",
|
||||
translation_key="volume_size_total",
|
||||
native_unit_of_measurement=UnitOfInformation.TERABYTES,
|
||||
device_class=SensorDeviceClass.DATA_SIZE,
|
||||
icon="mdi:chart-pie",
|
||||
|
@ -206,7 +206,7 @@ STORAGE_VOL_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoStorage.API_KEY,
|
||||
key="volume_size_used",
|
||||
name="Used Space",
|
||||
translation_key="volume_size_used",
|
||||
native_unit_of_measurement=UnitOfInformation.TERABYTES,
|
||||
device_class=SensorDeviceClass.DATA_SIZE,
|
||||
icon="mdi:chart-pie",
|
||||
|
@ -215,14 +215,14 @@ STORAGE_VOL_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoStorage.API_KEY,
|
||||
key="volume_percentage_used",
|
||||
name="Volume Used",
|
||||
translation_key="volume_percentage_used",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:chart-pie",
|
||||
),
|
||||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoStorage.API_KEY,
|
||||
key="volume_disk_temp_avg",
|
||||
name="Average Disk Temp",
|
||||
translation_key="volume_disk_temp_avg",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
|
@ -230,7 +230,7 @@ STORAGE_VOL_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoStorage.API_KEY,
|
||||
key="volume_disk_temp_max",
|
||||
name="Maximum Disk Temp",
|
||||
translation_key="volume_disk_temp_max",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
entity_registry_enabled_default=False,
|
||||
|
@ -241,7 +241,7 @@ STORAGE_DISK_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoStorage.API_KEY,
|
||||
key="disk_smart_status",
|
||||
name="Status (Smart)",
|
||||
translation_key="disk_smart_status",
|
||||
icon="mdi:checkbox-marked-circle-outline",
|
||||
entity_registry_enabled_default=False,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
|
@ -249,14 +249,14 @@ STORAGE_DISK_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoStorage.API_KEY,
|
||||
key="disk_status",
|
||||
name="Status",
|
||||
translation_key="disk_status",
|
||||
icon="mdi:checkbox-marked-circle-outline",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoStorage.API_KEY,
|
||||
key="disk_temp",
|
||||
name="Temperature",
|
||||
translation_key="disk_temp",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -268,7 +268,7 @@ INFORMATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoDSMInformation.API_KEY,
|
||||
key="temperature",
|
||||
name="Temperature",
|
||||
translation_key="temperature",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -277,7 +277,7 @@ INFORMATION_SENSORS: tuple[SynologyDSMSensorEntityDescription, ...] = (
|
|||
SynologyDSMSensorEntityDescription(
|
||||
api_key=SynoDSMInformation.API_KEY,
|
||||
key="uptime",
|
||||
name="Last Boot",
|
||||
translation_key="uptime",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
entity_registry_enabled_default=False,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
|
|
|
@ -60,5 +60,51 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"disk_below_remain_life_thr": { "name": "Below min remaining life" },
|
||||
"disk_exceed_bad_sector_thr": { "name": "Exceeded max bad sectors" },
|
||||
"status": { "name": "Security status" }
|
||||
},
|
||||
"sensor": {
|
||||
"cpu_15min_load": { "name": "CPU load average (15 min)" },
|
||||
"cpu_1min_load": { "name": "CPU load average (1 min)" },
|
||||
"cpu_5min_load": { "name": "CPU load average (5 min)" },
|
||||
"cpu_other_load": { "name": "CPU utilization (other)" },
|
||||
"cpu_system_load": { "name": "CPU utilization (system)" },
|
||||
"cpu_total_load": { "name": "CPU utilization (total)" },
|
||||
"cpu_user_load": { "name": "CPU utilization (user)" },
|
||||
"disk_smart_status": { "name": "Status (smart)" },
|
||||
"disk_status": { "name": "Status" },
|
||||
"disk_temp": {
|
||||
"name": "[%key:component::sensor::entity_component::temperature::name%]"
|
||||
},
|
||||
"memory_available_real": { "name": "Memory available (real)" },
|
||||
"memory_available_swap": { "name": "Memory available (swap)" },
|
||||
"memory_cached": { "name": "Memory cached" },
|
||||
"memory_real_usage": { "name": "Memory usage (real)" },
|
||||
"memory_size": { "name": "Memory size" },
|
||||
"memory_total_real": { "name": "Memory total (real)" },
|
||||
"memory_total_swap": { "name": "Memory total (swap)" },
|
||||
"network_down": { "name": "Download throughput" },
|
||||
"network_up": { "name": "Upload throughput" },
|
||||
"temperature": {
|
||||
"name": "[%key:component::sensor::entity_component::temperature::name%]"
|
||||
},
|
||||
"uptime": { "name": "Last boot" },
|
||||
"volume_disk_temp_avg": { "name": "Average disk temp" },
|
||||
"volume_disk_temp_max": { "name": "Maximum disk temp" },
|
||||
"volume_percentage_used": { "name": "Volume used" },
|
||||
"volume_size_total": { "name": "Total size" },
|
||||
"volume_size_used": { "name": "Used space" },
|
||||
"volume_status": { "name": "Status" }
|
||||
},
|
||||
"switch": {
|
||||
"home_mode": { "name": "Home mode" }
|
||||
},
|
||||
"update": {
|
||||
"update": { "name": "DSM update" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ SURVEILLANCE_SWITCH: tuple[SynologyDSMSwitchEntityDescription, ...] = (
|
|||
SynologyDSMSwitchEntityDescription(
|
||||
api_key=SynoSurveillanceStation.HOME_MODE_API_KEY,
|
||||
key="home_mode",
|
||||
name="Home Mode",
|
||||
translation_key="home_mode",
|
||||
icon="mdi:home-account",
|
||||
),
|
||||
)
|
||||
|
@ -72,10 +72,6 @@ class SynoDSMSurveillanceHomeModeToggle(
|
|||
super().__init__(api, coordinator, description)
|
||||
self._version = version
|
||||
|
||||
self._attr_name = (
|
||||
f"{self._api.network.hostname} Surveillance Station {description.name}"
|
||||
)
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return the state."""
|
||||
|
|
|
@ -30,7 +30,7 @@ UPDATE_ENTITIES: Final = [
|
|||
SynologyDSMUpdateEntityEntityDescription(
|
||||
api_key=SynoCoreUpgrade.API_KEY,
|
||||
key="update",
|
||||
name="DSM Update",
|
||||
translation_key="update",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
)
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue