Files
core/homeassistant/components/notify/const.py
T

48 lines
1.0 KiB
Python

"""Provide common notify constants."""
from enum import IntFlag
import logging
from typing import Final
import probatio
from homeassistant.helpers import config_validation as cv
DOMAIN: Final = "notify"
ATTR_DATA = "data"
# Text to notify user of
ATTR_MESSAGE = "message"
# Target of the (legacy) notification (user, device, etc)
ATTR_TARGET = "target"
# Recipients for a notification
ATTR_RECIPIENTS = "recipients"
# Title of notification
ATTR_TITLE = "title"
LOGGER = logging.getLogger(__package__)
SERVICE_NOTIFY = "notify"
SERVICE_SEND_MESSAGE = "send_message"
SERVICE_PERSISTENT_NOTIFICATION = "persistent_notification"
NOTIFY_SERVICE_SCHEMA = probatio.Schema(
{
probatio.Required(ATTR_MESSAGE): cv.string,
probatio.Optional(ATTR_TITLE): cv.string,
probatio.Optional(ATTR_TARGET): probatio.All(cv.ensure_list, [cv.string]),
probatio.Optional(ATTR_DATA): dict,
}
)
class NotifyEntityFeature(IntFlag):
"""Supported features of a notify entity."""
TITLE = 1