This commit is contained in:
Paulus Schoutsen 2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View file

@ -4,18 +4,19 @@ import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.notify import (ATTR_TARGET, PLATFORM_SCHEMA,
BaseNotificationService,
ATTR_MESSAGE)
from homeassistant.components.notify import (
ATTR_TARGET,
PLATFORM_SCHEMA,
BaseNotificationService,
ATTR_MESSAGE,
)
_LOGGER = logging.getLogger(__name__)
CONF_DEFAULT_ROOM = 'default_room'
CONF_DEFAULT_ROOM = "default_room"
DOMAIN = 'matrix'
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_DEFAULT_ROOM): cv.string,
})
DOMAIN = "matrix"
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_DEFAULT_ROOM): cv.string})
def get_service(hass, config, discovery_info=None):
@ -34,10 +35,8 @@ class MatrixNotificationService(BaseNotificationService):
"""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
}
service_data = {ATTR_TARGET: target_rooms, ATTR_MESSAGE: message}
return self.hass.services.call(
DOMAIN, 'send_message', service_data=service_data)
DOMAIN, "send_message", service_data=service_data
)