Auto-create friendly name for persistent notifications (#42427)
This commit is contained in:
parent
93c2f2bbeb
commit
41b45c7f78
3 changed files with 4 additions and 2 deletions
|
@ -6,6 +6,7 @@ from typing import Any, Mapping, MutableMapping, Optional
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import websocket_api
|
||||
from homeassistant.const import ATTR_FRIENDLY_NAME
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import TemplateError
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
@ -125,6 +126,7 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool:
|
|||
title = title.template
|
||||
|
||||
attr[ATTR_TITLE] = title
|
||||
attr[ATTR_FRIENDLY_NAME] = title
|
||||
|
||||
try:
|
||||
message.hass = hass
|
||||
|
|
|
@ -8,7 +8,7 @@ create:
|
|||
description: Optional title for your notification. [Optional, Templates accepted]
|
||||
example: Test notification
|
||||
notification_id:
|
||||
description: Target ID of the notification, will replace a notification with the same Id. [Optional]
|
||||
description: Target ID of the notification, will replace a notification with the same ID. [Optional]
|
||||
example: 1234
|
||||
|
||||
dismiss:
|
||||
|
|
|
@ -116,7 +116,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
|
||||
def split_entity_id(entity_id: str) -> List[str]:
|
||||
"""Split a state entity_id into domain, object_id."""
|
||||
"""Split a state entity ID into domain and object ID."""
|
||||
return entity_id.split(".", 1)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue