Migrate Azure DevOps to has entity name (#112420)
This commit is contained in:
parent
ff21a2fcca
commit
32bb33c55e
3 changed files with 12 additions and 3 deletions
|
@ -98,6 +98,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
class AzureDevOpsEntity(CoordinatorEntity[DataUpdateCoordinator[list[DevOpsBuild]]]):
|
||||
"""Defines a base Azure DevOps entity."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
entity_description: AzureDevOpsEntityDescription
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -19,8 +19,7 @@ from .const import CONF_ORG, DOMAIN
|
|||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class AzureDevOpsSensorEntityDescription(
|
||||
AzureDevOpsEntityDescription,
|
||||
SensorEntityDescription,
|
||||
AzureDevOpsEntityDescription, SensorEntityDescription
|
||||
):
|
||||
"""Class describing Azure DevOps sensor entities."""
|
||||
|
||||
|
@ -40,7 +39,8 @@ async def async_setup_entry(
|
|||
coordinator,
|
||||
AzureDevOpsSensorEntityDescription(
|
||||
key=f"{build.project.id}_{build.definition.id}_latest_build",
|
||||
name=f"{build.project.name} {build.definition.name} Latest Build",
|
||||
translation_key="latest_build",
|
||||
translation_placeholders={"definition_name": build.definition.name},
|
||||
icon="mdi:pipe",
|
||||
attrs=lambda build: {
|
||||
"definition_id": build.definition.id,
|
||||
|
|
|
@ -28,5 +28,12 @@
|
|||
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
|
||||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"latest_build": {
|
||||
"name": "{definition_name} latest build"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue