mirror of
https://github.com/home-assistant/core.git
synced 2025-08-30 01:42:21 +02:00
Use subentry title as display name in ntfy integration (#151370)
This commit is contained in:
@@ -408,7 +408,7 @@ class TopicSubentryFlowHandler(ConfigSubentryFlow):
|
|||||||
|
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=user_input.get(CONF_NAME, user_input[CONF_TOPIC]),
|
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],
|
unique_id=user_input[CONF_TOPIC],
|
||||||
)
|
)
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
|
@@ -16,7 +16,7 @@ from homeassistant.components.notify import (
|
|||||||
NotifyEntityFeature,
|
NotifyEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigSubentry
|
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.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
||||||
@@ -66,7 +66,7 @@ class NtfyNotifyEntity(NotifyEntity):
|
|||||||
entry_type=DeviceEntryType.SERVICE,
|
entry_type=DeviceEntryType.SERVICE,
|
||||||
manufacturer="ntfy LLC",
|
manufacturer="ntfy LLC",
|
||||||
model="ntfy",
|
model="ntfy",
|
||||||
name=subentry.data.get(CONF_NAME, self.topic),
|
name=subentry.title,
|
||||||
configuration_url=URL(config_entry.data[CONF_URL]) / self.topic,
|
configuration_url=URL(config_entry.data[CONF_URL]) / self.topic,
|
||||||
identifiers={(DOMAIN, f"{config_entry.entry_id}_{subentry.subentry_id}")},
|
identifiers={(DOMAIN, f"{config_entry.entry_id}_{subentry.subentry_id}")},
|
||||||
via_device=(DOMAIN, config_entry.entry_id),
|
via_device=(DOMAIN, config_entry.entry_id),
|
||||||
|
@@ -266,7 +266,7 @@ async def test_generated_topic(hass: HomeAssistant, mock_random: AsyncMock) -> N
|
|||||||
subentry_id = list(config_entry.subentries)[0]
|
subentry_id = list(config_entry.subentries)[0]
|
||||||
assert config_entry.subentries == {
|
assert config_entry.subentries == {
|
||||||
subentry_id: ConfigSubentry(
|
subentry_id: ConfigSubentry(
|
||||||
data={CONF_TOPIC: "randomtopic", CONF_NAME: "mytopic"},
|
data={CONF_TOPIC: "randomtopic"},
|
||||||
subentry_id=subentry_id,
|
subentry_id=subentry_id,
|
||||||
subentry_type="topic",
|
subentry_type="topic",
|
||||||
title="mytopic",
|
title="mytopic",
|
||||||
|
Reference in New Issue
Block a user