mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Add entity translations to Aurora (#98079)
This commit is contained in:
parent
398a789ba2
commit
57cacbc2a7
@ -13,9 +13,12 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up the binary_sensor platform."""
|
||||
coordinator = hass.data[DOMAIN][entry.entry_id][COORDINATOR]
|
||||
name = f"{coordinator.name} Aurora Visibility Alert"
|
||||
|
||||
entity = AuroraSensor(coordinator=coordinator, name=name, icon="mdi:hazard-lights")
|
||||
entity = AuroraSensor(
|
||||
coordinator=coordinator,
|
||||
translation_key="visibility_alert",
|
||||
icon="mdi:hazard-lights",
|
||||
)
|
||||
|
||||
async_add_entries([entity])
|
||||
|
||||
|
@ -19,14 +19,14 @@ class AuroraEntity(CoordinatorEntity[AuroraDataUpdateCoordinator]):
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: AuroraDataUpdateCoordinator,
|
||||
name: str,
|
||||
translation_key: str,
|
||||
icon: str,
|
||||
) -> None:
|
||||
"""Initialize the Aurora Entity."""
|
||||
|
||||
super().__init__(coordinator=coordinator)
|
||||
|
||||
self._attr_name = name
|
||||
self._attr_translation_key = translation_key
|
||||
self._attr_unique_id = f"{coordinator.latitude}_{coordinator.longitude}"
|
||||
self._attr_icon = icon
|
||||
|
||||
|
@ -17,7 +17,7 @@ async def async_setup_entry(
|
||||
|
||||
entity = AuroraSensor(
|
||||
coordinator=coordinator,
|
||||
name=f"{coordinator.name} Aurora Visibility %",
|
||||
translation_key="visibility",
|
||||
icon="mdi:gauge",
|
||||
)
|
||||
|
||||
|
@ -25,5 +25,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"visibility_alert": {
|
||||
"name": "Visibility alert"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"visibility": {
|
||||
"name": "Visibility"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user