mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 01:11:51 -04:00
Allow overriding recipients per message in XMPP (#149375)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
co-authored by
Joost Lekkerkerker
parent
2f5fbc1f0e
commit
da6986e58c
@@ -15,6 +15,8 @@ import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_DATA,
|
||||
ATTR_TARGET,
|
||||
ATTR_TITLE,
|
||||
ATTR_TITLE_DEFAULT,
|
||||
PLATFORM_SCHEMA as NOTIFY_PLATFORM_SCHEMA,
|
||||
@@ -44,7 +46,6 @@ if sys.version_info < (3, 14):
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
ATTR_DATA = "data"
|
||||
ATTR_PATH = "path"
|
||||
ATTR_PATH_TEMPLATE = "path_template"
|
||||
ATTR_TIMEOUT = "timeout"
|
||||
@@ -112,13 +113,14 @@ class XmppNotificationService(BaseNotificationService):
|
||||
"""Send a message to a user."""
|
||||
title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)
|
||||
text = f"{title}: {message}" if title else message
|
||||
targets = kwargs.get(ATTR_TARGET, self._recipients)
|
||||
data = kwargs.get(ATTR_DATA)
|
||||
timeout = data.get(ATTR_TIMEOUT, XEP_0363_TIMEOUT) if data else None
|
||||
|
||||
await async_send_message(
|
||||
f"{self._sender}/{self._resource}",
|
||||
self._password,
|
||||
self._recipients,
|
||||
targets,
|
||||
self._tls,
|
||||
self._verify,
|
||||
self._room,
|
||||
|
||||
Reference in New Issue
Block a user