Add images support to matrix notify (#37625)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
5174f63fd8
commit
98d7e6b898
3 changed files with 49 additions and 7 deletions
|
@ -2,6 +2,7 @@
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_DATA,
|
||||
ATTR_MESSAGE,
|
||||
ATTR_TARGET,
|
||||
PLATFORM_SCHEMA,
|
||||
|
@ -31,9 +32,10 @@ class MatrixNotificationService(BaseNotificationService):
|
|||
def send_message(self, message="", **kwargs):
|
||||
"""Send the message to the Matrix server."""
|
||||
target_rooms = kwargs.get(ATTR_TARGET) or [self._default_room]
|
||||
|
||||
service_data = {ATTR_TARGET: target_rooms, ATTR_MESSAGE: message}
|
||||
|
||||
data = kwargs.get(ATTR_DATA)
|
||||
if data is not None:
|
||||
service_data[ATTR_DATA] = data
|
||||
return self.hass.services.call(
|
||||
DOMAIN, SERVICE_SEND_MESSAGE, service_data=service_data
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue