Deprecate hassio service to update addon (#127927)

* Deprecate hassio service to update addon

* Update homeassistant/components/hassio/strings.json

Co-authored-by: Stefan Agner <stefan@agner.ch>

* service -> action

* service -> action; in the title as well

---------

Co-authored-by: Stefan Agner <stefan@agner.ch>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Joost Lekkerkerker 2024-10-08 14:23:29 +02:00 committed by GitHub
parent dd5e5323f1
commit 9d9b5af97f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 1 deletions

View File

@ -38,6 +38,7 @@ from homeassistant.helpers import (
)
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
from homeassistant.helpers.storage import Store
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import bind_hass
@ -395,6 +396,16 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
async def async_service_handler(service: ServiceCall) -> None:
"""Handle service calls for Hass.io."""
if service.service == SERVICE_ADDON_UPDATE:
async_create_issue(
hass,
DOMAIN,
"update_service_deprecated",
breaks_in_ha_version="2025.5",
is_fixable=False,
severity=IssueSeverity.WARNING,
translation_key="update_service_deprecated",
)
api_endpoint = MAP_SERVICE_API[service.service]
data = service.data.copy()

View File

@ -208,6 +208,10 @@
"unsupported_virtualization_image": {
"title": "Unsupported system - Incorrect OS image for virtualization",
"description": "System is unsupported because the Home Assistant OS image in use is not intended for use in a virtualized environment. Use the link to learn more and how to fix this."
},
"update_service_deprecated": {
"title": "Deprecated update add-on action",
"description": "The update add-on action has been deprecated and will be removed in 2025.5. Please use the update entity and the respective action to update the add-on instead."
}
},
"entity": {

View File

@ -24,7 +24,7 @@ from homeassistant.components.hassio.const import REQUEST_REFRESH_DELAY
from homeassistant.components.hassio.handler import HassioAPIError
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers import device_registry as dr, issue_registry as ir
from homeassistant.setup import async_setup_component
from homeassistant.util import dt as dt_util
@ -510,6 +510,7 @@ async def test_service_calls(
aioclient_mock: AiohttpClientMocker,
caplog: pytest.LogCaptureFixture,
addon_installed,
issue_registry: ir.IssueRegistry,
) -> None:
"""Call service and check the API calls behind that."""
with (
@ -542,6 +543,7 @@ async def test_service_calls(
await hass.services.async_call("hassio", "addon_stop", {"addon": "test"})
await hass.services.async_call("hassio", "addon_restart", {"addon": "test"})
await hass.services.async_call("hassio", "addon_update", {"addon": "test"})
assert (DOMAIN, "update_service_deprecated") in issue_registry.issues
await hass.services.async_call(
"hassio", "addon_stdin", {"addon": "test", "input": "test"}
)