From be9afd7eae85f567e3bee6e99ff4f8ca625a4261 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Sat, 12 Aug 2023 11:03:37 +0200 Subject: [PATCH] Add entity translations to DWD (#98254) * Add device to DWD * Add entity translations to DWD --- .../components/dwd_weather_warnings/sensor.py | 6 +++--- .../components/dwd_weather_warnings/strings.json | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/dwd_weather_warnings/sensor.py b/homeassistant/components/dwd_weather_warnings/sensor.py index 7bc683d245d..78154e9e4f4 100644 --- a/homeassistant/components/dwd_weather_warnings/sensor.py +++ b/homeassistant/components/dwd_weather_warnings/sensor.py @@ -56,12 +56,12 @@ from .coordinator import DwdWeatherWarningsCoordinator SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( SensorEntityDescription( key=CURRENT_WARNING_SENSOR, - name="Current Warning Level", + translation_key=CURRENT_WARNING_SENSOR, icon="mdi:close-octagon-outline", ), SensorEntityDescription( key=ADVANCE_WARNING_SENSOR, - name="Advance Warning Level", + translation_key=ADVANCE_WARNING_SENSOR, icon="mdi:close-octagon-outline", ), ) @@ -131,6 +131,7 @@ class DwdWeatherWarningsSensor( """Representation of a DWD-Weather-Warnings sensor.""" _attr_attribution = "Data provided by DWD" + _attr_has_entity_name = True def __init__( self, @@ -142,7 +143,6 @@ class DwdWeatherWarningsSensor( super().__init__(coordinator) self.entity_description = description - self._attr_name = f"{DEFAULT_NAME} {entry.title} {description.name}" self._attr_unique_id = f"{entry.unique_id}-{description.key}" self._attr_device_info = DeviceInfo( diff --git a/homeassistant/components/dwd_weather_warnings/strings.json b/homeassistant/components/dwd_weather_warnings/strings.json index 60e53f90dbd..dc73055174b 100644 --- a/homeassistant/components/dwd_weather_warnings/strings.json +++ b/homeassistant/components/dwd_weather_warnings/strings.json @@ -15,5 +15,15 @@ "already_configured": "Warncell ID / name is already configured.", "invalid_identifier": "[%key:component::dwd_weather_warnings::config::error::invalid_identifier%]" } + }, + "entity": { + "sensor": { + "current_warning_level": { + "name": "Current warning level" + }, + "advance_warning_level": { + "name": "Advance warning level" + } + } } }