Auto-create friendly name for persistent notifications (#42427)

This commit is contained in:
Philip Allgaier 2021-01-15 12:13:56 +01:00 committed by GitHub
parent 93c2f2bbeb
commit 41b45c7f78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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:

View file

@ -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)