Use subentry title as display name in ntfy integration (#151370)

This commit is contained in:
Manu
2025-08-29 16:56:37 +02:00
committed by GitHub
parent c37b2f86b1
commit a4f71f37f6
3 changed files with 4 additions and 4 deletions

View File

@@ -408,7 +408,7 @@ class TopicSubentryFlowHandler(ConfigSubentryFlow):
return self.async_create_entry(
title=user_input.get(CONF_NAME, user_input[CONF_TOPIC]),
data=user_input,
data={CONF_TOPIC: user_input[CONF_TOPIC]},
unique_id=user_input[CONF_TOPIC],
)
return self.async_show_form(

View File

@@ -16,7 +16,7 @@ from homeassistant.components.notify import (
NotifyEntityFeature,
)
from homeassistant.config_entries import ConfigSubentry
from homeassistant.const import CONF_NAME, CONF_URL
from homeassistant.const import CONF_URL
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
@@ -66,7 +66,7 @@ class NtfyNotifyEntity(NotifyEntity):
entry_type=DeviceEntryType.SERVICE,
manufacturer="ntfy LLC",
model="ntfy",
name=subentry.data.get(CONF_NAME, self.topic),
name=subentry.title,
configuration_url=URL(config_entry.data[CONF_URL]) / self.topic,
identifiers={(DOMAIN, f"{config_entry.entry_id}_{subentry.subentry_id}")},
via_device=(DOMAIN, config_entry.entry_id),

View File

@@ -266,7 +266,7 @@ async def test_generated_topic(hass: HomeAssistant, mock_random: AsyncMock) -> N
subentry_id = list(config_entry.subentries)[0]
assert config_entry.subentries == {
subentry_id: ConfigSubentry(
data={CONF_TOPIC: "randomtopic", CONF_NAME: "mytopic"},
data={CONF_TOPIC: "randomtopic"},
subentry_id=subentry_id,
subentry_type="topic",
title="mytopic",