mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +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:
|
) -> None:
|
||||||
"""Set up the binary_sensor platform."""
|
"""Set up the binary_sensor platform."""
|
||||||
coordinator = hass.data[DOMAIN][entry.entry_id][COORDINATOR]
|
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])
|
async_add_entries([entity])
|
||||||
|
|
||||||
|
@ -19,14 +19,14 @@ class AuroraEntity(CoordinatorEntity[AuroraDataUpdateCoordinator]):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: AuroraDataUpdateCoordinator,
|
coordinator: AuroraDataUpdateCoordinator,
|
||||||
name: str,
|
translation_key: str,
|
||||||
icon: str,
|
icon: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the Aurora Entity."""
|
"""Initialize the Aurora Entity."""
|
||||||
|
|
||||||
super().__init__(coordinator=coordinator)
|
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_unique_id = f"{coordinator.latitude}_{coordinator.longitude}"
|
||||||
self._attr_icon = icon
|
self._attr_icon = icon
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
entity = AuroraSensor(
|
entity = AuroraSensor(
|
||||||
coordinator=coordinator,
|
coordinator=coordinator,
|
||||||
name=f"{coordinator.name} Aurora Visibility %",
|
translation_key="visibility",
|
||||||
icon="mdi:gauge",
|
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