From 1cd82ab8eea77d09e1261401fa7ec23362f59330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Diego=20Rodr=C3=ADguez=20Royo?= Date: Sun, 23 Feb 2025 16:18:20 +0100 Subject: [PATCH] Deprecate Home Connect command actions (#139093) * Deprecate command actions * Improve issue description * Improve issue description Co-authored-by: Martin Hjelmare --------- Co-authored-by: Martin Hjelmare --- .../components/home_connect/__init__.py | 12 +++++++++++ .../components/home_connect/strings.json | 4 ++++ tests/components/home_connect/test_init.py | 21 ++++++++++++++++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/home_connect/__init__.py b/homeassistant/components/home_connect/__init__.py index 637fd7aa3a8..51b38bf7cd3 100644 --- a/homeassistant/components/home_connect/__init__.py +++ b/homeassistant/components/home_connect/__init__.py @@ -405,6 +405,17 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa: """Execute calls to services executing a command.""" client, ha_id = await _get_client_and_ha_id(hass, call.data[ATTR_DEVICE_ID]) + async_create_issue( + hass, + DOMAIN, + "deprecated_command_actions", + breaks_in_ha_version="2025.9.0", + is_fixable=True, + is_persistent=True, + severity=IssueSeverity.WARNING, + translation_key="deprecated_command_actions", + ) + try: await client.put_command(ha_id, command_key=command_key, value=True) except HomeConnectError as err: @@ -610,6 +621,7 @@ async def async_unload_entry( ) -> bool: """Unload a config entry.""" async_delete_issue(hass, DOMAIN, "deprecated_set_program_and_option_actions") + async_delete_issue(hass, DOMAIN, "deprecated_command_actions") return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/homeassistant/components/home_connect/strings.json b/homeassistant/components/home_connect/strings.json index d6330c8b78b..977ad1f36f0 100644 --- a/homeassistant/components/home_connect/strings.json +++ b/homeassistant/components/home_connect/strings.json @@ -108,6 +108,10 @@ "title": "Deprecated binary door sensor detected in some automations or scripts", "description": "The binary door sensor `{entity}`, which is deprecated, is used in the following automations or scripts:\n{items}\n\nA sensor entity with additional possible states is available and should be used going forward; Please use it on the above automations or scripts to fix this issue." }, + "deprecated_command_actions": { + "title": "The command related actions are deprecated in favor of the new buttons", + "description": "The `pause_program` and `resume_program` actions have been deprecated in favor of new button entities, if the command is available for your appliance. Please update your automations, scripts and panels that use this action to use the button entities instead, and press on submit to fix the issue." + }, "deprecated_program_switch": { "title": "Deprecated program switch detected in some automations or scripts", "description": "Program switches are deprecated and {entity_id} is used in the following automations or scripts:\n{items}\n\nYou can use the active program select entity to run the program without any additional options and get the current running program on the above automations or scripts to fix this issue." diff --git a/tests/components/home_connect/test_init.py b/tests/components/home_connect/test_init.py index 5e309a7446e..06498f891db 100644 --- a/tests/components/home_connect/test_init.py +++ b/tests/components/home_connect/test_init.py @@ -338,11 +338,27 @@ async def test_key_value_services( @pytest.mark.parametrize( - "service_call", - DEPRECATED_SERVICE_KV_CALL_PARAMS + SERVICE_PROGRAM_CALL_PARAMS, + ("service_call", "issue_id"), + [ + *zip( + DEPRECATED_SERVICE_KV_CALL_PARAMS + SERVICE_PROGRAM_CALL_PARAMS, + ["deprecated_set_program_and_option_actions"] + * ( + len(DEPRECATED_SERVICE_KV_CALL_PARAMS) + + len(SERVICE_PROGRAM_CALL_PARAMS) + ), + strict=True, + ), + *zip( + SERVICE_COMMAND_CALL_PARAMS, + ["deprecated_command_actions"] * len(SERVICE_COMMAND_CALL_PARAMS), + strict=True, + ), + ], ) async def test_programs_and_options_actions_deprecation( service_call: dict[str, Any], + issue_id: str, hass: HomeAssistant, device_registry: dr.DeviceRegistry, config_entry: MockConfigEntry, @@ -354,7 +370,6 @@ async def test_programs_and_options_actions_deprecation( hass_client: ClientSessionGenerator, ) -> None: """Test deprecated service keys.""" - issue_id = "deprecated_set_program_and_option_actions" assert config_entry.state == ConfigEntryState.NOT_LOADED assert await integration_setup(client) assert config_entry.state == ConfigEntryState.LOADED