Change name to entity_id update platform error messages (#87960)
This commit is contained in:
parent
bb4d6c0d2c
commit
8c00f435a6
2 changed files with 10 additions and 8 deletions
|
@ -130,7 +130,7 @@ async def async_install(entity: UpdateEntity, service_call: ServiceCall) -> None
|
|||
entity.installed_version == entity.latest_version
|
||||
or entity.latest_version is None
|
||||
):
|
||||
raise HomeAssistantError(f"No update available for {entity.name}")
|
||||
raise HomeAssistantError(f"No update available for {entity.entity_id}")
|
||||
|
||||
# If version is specified, but not supported by the entity.
|
||||
if (
|
||||
|
@ -138,19 +138,19 @@ async def async_install(entity: UpdateEntity, service_call: ServiceCall) -> None
|
|||
and not entity.supported_features & UpdateEntityFeature.SPECIFIC_VERSION
|
||||
):
|
||||
raise HomeAssistantError(
|
||||
f"Installing a specific version is not supported for {entity.name}"
|
||||
f"Installing a specific version is not supported for {entity.entity_id}"
|
||||
)
|
||||
|
||||
# If backup is requested, but not supported by the entity.
|
||||
if (
|
||||
backup := service_call.data[ATTR_BACKUP]
|
||||
) and not entity.supported_features & UpdateEntityFeature.BACKUP:
|
||||
raise HomeAssistantError(f"Backup is not supported for {entity.name}")
|
||||
raise HomeAssistantError(f"Backup is not supported for {entity.entity_id}")
|
||||
|
||||
# Update is already in progress.
|
||||
if entity.in_progress is not False:
|
||||
raise HomeAssistantError(
|
||||
f"Update installation already in progress for {entity.name}"
|
||||
f"Update installation already in progress for {entity.entity_id}"
|
||||
)
|
||||
|
||||
await entity.async_install_with_progress(version, backup)
|
||||
|
@ -159,7 +159,9 @@ async def async_install(entity: UpdateEntity, service_call: ServiceCall) -> None
|
|||
async def async_skip(entity: UpdateEntity, service_call: ServiceCall) -> None:
|
||||
"""Service call wrapper to validate the call."""
|
||||
if entity.auto_update:
|
||||
raise HomeAssistantError(f"Skipping update is not supported for {entity.name}")
|
||||
raise HomeAssistantError(
|
||||
f"Skipping update is not supported for {entity.entity_id}"
|
||||
)
|
||||
await entity.async_skip()
|
||||
|
||||
|
||||
|
@ -167,7 +169,7 @@ async def async_clear_skipped(entity: UpdateEntity, service_call: ServiceCall) -
|
|||
"""Service call wrapper to validate the call."""
|
||||
if entity.auto_update:
|
||||
raise HomeAssistantError(
|
||||
f"Clearing skipped update is not supported for {entity.name}"
|
||||
f"Clearing skipped update is not supported for {entity.entity_id}"
|
||||
)
|
||||
await entity.async_clear_skipped()
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ async def test_entity_with_auto_update(
|
|||
# Should not be able to skip the update
|
||||
with pytest.raises(
|
||||
HomeAssistantError,
|
||||
match="Skipping update is not supported for Update with auto update",
|
||||
match="Skipping update is not supported for update.update_with_auto_update",
|
||||
):
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
|
@ -309,7 +309,7 @@ async def test_entity_with_auto_update(
|
|||
# Should not be able to clear a skipped the update
|
||||
with pytest.raises(
|
||||
HomeAssistantError,
|
||||
match="Clearing skipped update is not supported for Update with auto update",
|
||||
match="Clearing skipped update is not supported for update.update_with_auto_update",
|
||||
):
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue