From ac594e6bce74ee0b1532c96e8dbe60420fb877f3 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Sun, 9 Jul 2023 22:58:23 +0200 Subject: [PATCH] Add entity translations to Sonarr (#96159) --- homeassistant/components/sonarr/sensor.py | 12 +++++------ homeassistant/components/sonarr/strings.json | 22 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/sonarr/sensor.py b/homeassistant/components/sonarr/sensor.py index 1c4b9afb08d..def44d382ce 100644 --- a/homeassistant/components/sonarr/sensor.py +++ b/homeassistant/components/sonarr/sensor.py @@ -88,7 +88,7 @@ def get_wanted_attr(wanted: SonarrWantedMissing) -> dict[str, str]: SENSOR_TYPES: dict[str, SonarrSensorEntityDescription[Any]] = { "commands": SonarrSensorEntityDescription[list[Command]]( key="commands", - name="Commands", + translation_key="commands", icon="mdi:code-braces", native_unit_of_measurement="Commands", entity_registry_enabled_default=False, @@ -97,7 +97,7 @@ SENSOR_TYPES: dict[str, SonarrSensorEntityDescription[Any]] = { ), "diskspace": SonarrSensorEntityDescription[list[Diskspace]]( key="diskspace", - name="Disk space", + translation_key="diskspace", icon="mdi:harddisk", native_unit_of_measurement=UnitOfInformation.GIGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -107,7 +107,7 @@ SENSOR_TYPES: dict[str, SonarrSensorEntityDescription[Any]] = { ), "queue": SonarrSensorEntityDescription[SonarrQueue]( key="queue", - name="Queue", + translation_key="queue", icon="mdi:download", native_unit_of_measurement="Episodes", entity_registry_enabled_default=False, @@ -116,7 +116,7 @@ SENSOR_TYPES: dict[str, SonarrSensorEntityDescription[Any]] = { ), "series": SonarrSensorEntityDescription[list[SonarrSeries]]( key="series", - name="Shows", + translation_key="series", icon="mdi:television", native_unit_of_measurement="Series", entity_registry_enabled_default=False, @@ -130,7 +130,7 @@ SENSOR_TYPES: dict[str, SonarrSensorEntityDescription[Any]] = { ), "upcoming": SonarrSensorEntityDescription[list[SonarrCalendar]]( key="upcoming", - name="Upcoming", + translation_key="upcoming", icon="mdi:television", native_unit_of_measurement="Episodes", value_fn=len, @@ -140,7 +140,7 @@ SENSOR_TYPES: dict[str, SonarrSensorEntityDescription[Any]] = { ), "wanted": SonarrSensorEntityDescription[SonarrWantedMissing]( key="wanted", - name="Wanted", + translation_key="wanted", icon="mdi:television", native_unit_of_measurement="Episodes", entity_registry_enabled_default=False, diff --git a/homeassistant/components/sonarr/strings.json b/homeassistant/components/sonarr/strings.json index b8537e11442..5b17f3283e8 100644 --- a/homeassistant/components/sonarr/strings.json +++ b/homeassistant/components/sonarr/strings.json @@ -33,5 +33,27 @@ } } } + }, + "entity": { + "sensor": { + "commands": { + "name": "Commands" + }, + "diskspace": { + "name": "Disk space" + }, + "queue": { + "name": "Queue" + }, + "series": { + "name": "Shows" + }, + "upcoming": { + "name": "Upcoming" + }, + "wanted": { + "name": "Wanted" + } + } } }