Clarify legacy notification actions (#186406)

This commit is contained in:
Marcin Sędłak-Jakubowski
2026-10-15 11:23:02 -04:00
committed by GitHub
parent ab0c3317bd
commit 93cc6237db
2 changed files with 26 additions and 3 deletions
+7 -3
View File
@@ -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],
}
+19
View File
@@ -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)