mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add entity translations to DWD (#98254)
* Add device to DWD * Add entity translations to DWD
This commit is contained in:
parent
d6498aa39e
commit
be9afd7eae
@ -56,12 +56,12 @@ from .coordinator import DwdWeatherWarningsCoordinator
|
|||||||
SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=CURRENT_WARNING_SENSOR,
|
key=CURRENT_WARNING_SENSOR,
|
||||||
name="Current Warning Level",
|
translation_key=CURRENT_WARNING_SENSOR,
|
||||||
icon="mdi:close-octagon-outline",
|
icon="mdi:close-octagon-outline",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ADVANCE_WARNING_SENSOR,
|
key=ADVANCE_WARNING_SENSOR,
|
||||||
name="Advance Warning Level",
|
translation_key=ADVANCE_WARNING_SENSOR,
|
||||||
icon="mdi:close-octagon-outline",
|
icon="mdi:close-octagon-outline",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -131,6 +131,7 @@ class DwdWeatherWarningsSensor(
|
|||||||
"""Representation of a DWD-Weather-Warnings sensor."""
|
"""Representation of a DWD-Weather-Warnings sensor."""
|
||||||
|
|
||||||
_attr_attribution = "Data provided by DWD"
|
_attr_attribution = "Data provided by DWD"
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -142,7 +143,6 @@ class DwdWeatherWarningsSensor(
|
|||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
|
|
||||||
self.entity_description = description
|
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_unique_id = f"{entry.unique_id}-{description.key}"
|
||||||
|
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
|
@ -15,5 +15,15 @@
|
|||||||
"already_configured": "Warncell ID / name is already configured.",
|
"already_configured": "Warncell ID / name is already configured.",
|
||||||
"invalid_identifier": "[%key:component::dwd_weather_warnings::config::error::invalid_identifier%]"
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user