mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Support overriding token in notifify.event service (#47133)
* Add opportunity to define token for each message * Update homeassistant/components/notify_events/notify.py Co-authored-by: Erik Montnemery <erik@montnemery.com> Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
parent
e42ca35c94
commit
056f7d493c
@ -28,6 +28,8 @@ ATTR_FILE_MIME_TYPE = "mime_type"
|
||||
ATTR_FILE_KIND_FILE = "file"
|
||||
ATTR_FILE_KIND_IMAGE = "image"
|
||||
|
||||
ATTR_TOKEN = "token"
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -114,7 +116,12 @@ class NotifyEventsNotificationService(BaseNotificationService):
|
||||
|
||||
def send_message(self, message, **kwargs):
|
||||
"""Send a message."""
|
||||
token = self.token
|
||||
data = kwargs.get(ATTR_DATA) or {}
|
||||
|
||||
msg = self.prepare_message(message, data)
|
||||
msg.send(self.token)
|
||||
|
||||
if data.get(ATTR_TOKEN, "").trim():
|
||||
token = data[ATTR_TOKEN]
|
||||
|
||||
msg.send(token)
|
||||
|
Loading…
x
Reference in New Issue
Block a user