Add images support to matrix notify (#37625)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
bestlibre 2021-03-18 19:30:38 +01:00 committed by GitHub
parent 5174f63fd8
commit 98d7e6b898
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 7 deletions

View file

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