From 93cc6237db8f879238ebf6cd98ca136ae4b313ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20S=C4=99d=C5=82ak-Jakubowski?= Date: Thu, 15 Oct 2026 16:23:02 +0100 Subject: [PATCH] Clarify legacy notification actions (#186406) --- homeassistant/components/notify/legacy.py | 10 +++++++--- tests/components/notify/test_legacy.py | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/notify/legacy.py b/homeassistant/components/notify/legacy.py index 0802ce9d5768..7cd6e3cc21c5 100644 --- a/homeassistant/components/notify/legacy.py +++ b/homeassistant/components/notify/legacy.py @@ -297,8 +297,10 @@ class BaseNotificationService: service_desc = { CONF_NAME: f"Send a notification via {target_name}", CONF_DESCRIPTION: ( - "Sends a notification message using the" - f" {target_name} integration." + "This notification action is provided by a notification " + "integration or notification group. To change where " + "notifications are sent or which options are available, " + "update that integration or group." ), CONF_FIELDS: self.services_dict[SERVICE_NOTIFY][CONF_FIELDS], } @@ -326,7 +328,9 @@ class BaseNotificationService: service_desc = { CONF_NAME: f"Send a notification with {self._service_name}", CONF_DESCRIPTION: ( - f"Sends a notification message using the {self._service_name} service." + "This notification action is provided by a notification integration " + "or notification group. To change where notifications are sent or " + "which options are available, update that integration or group." ), CONF_FIELDS: self.services_dict[SERVICE_NOTIFY][CONF_FIELDS], } diff --git a/tests/components/notify/test_legacy.py b/tests/components/notify/test_legacy.py index 846ad59aed5e..3e18b4ae8586 100644 --- a/tests/components/notify/test_legacy.py +++ b/tests/components/notify/test_legacy.py @@ -17,6 +17,7 @@ from homeassistant.const import SERVICE_RELOAD, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers.discovery import async_load_platform from homeassistant.helpers.reload import async_setup_reload_service +from homeassistant.helpers.service import async_get_all_descriptions from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.setup import async_setup_component @@ -149,6 +150,24 @@ async def test_same_targets(hass: HomeAssistant) -> None: assert test.registered_targets == {"test_a": 1, "test_b": 2} +async def test_legacy_action_descriptions(hass: HomeAssistant) -> None: + """Test legacy notification action descriptions.""" + test = NotificationService(hass) + await test.async_setup(hass, "test_service", "test") + await test.async_register_services() + + descriptions = await async_get_all_descriptions(hass) + expected_description = ( + "This notification action is provided by a notification integration or " + "notification group. To change where notifications are sent or which " + "options are available, update that integration or group." + ) + + assert descriptions[DOMAIN]["test_service"]["description"] == expected_description + assert descriptions[DOMAIN]["test_a"]["description"] == expected_description + assert descriptions[DOMAIN]["test_b"]["description"] == expected_description + + async def test_change_targets(hass: HomeAssistant) -> None: """Test changing the targets in a legacy notify service.""" test = NotificationService(hass)