parent
f595c8715c
commit
c06fe51122
|
@ -8,27 +8,28 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.components.notify import (
|
from homeassistant.components.notify import (
|
||||||
ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, BaseNotificationService)
|
ATTR_TITLE, ATTR_TITLE_DEFAULT, PLATFORM_SCHEMA, BaseNotificationService)
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_SENDER, CONF_RECIPIENT
|
from homeassistant.const import (CONF_API_KEY, CONF_SENDER, CONF_RECIPIENT)
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['sendgrid==3.2.10']
|
REQUIREMENTS = ['sendgrid==3.2.10']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# pylint: disable=no-value-for-parameter
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
vol.Required(CONF_API_KEY): cv.string,
|
vol.Required(CONF_API_KEY): cv.string,
|
||||||
vol.Required(CONF_SENDER): vol.Email,
|
vol.Required(CONF_SENDER): vol.Email(),
|
||||||
vol.Required(CONF_RECIPIENT): cv.string,
|
vol.Required(CONF_RECIPIENT): vol.Email(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def get_service(hass, config):
|
def get_service(hass, config):
|
||||||
"""Get the SendGrid notification service."""
|
"""Get the SendGrid notification service."""
|
||||||
api_key = config[CONF_API_KEY]
|
api_key = config.get(CONF_API_KEY)
|
||||||
sender = config[CONF_SENDER]
|
sender = config.get(CONF_SENDER)
|
||||||
recipient = config[CONF_RECIPIENT]
|
recipient = config.get(CONF_RECIPIENT)
|
||||||
|
|
||||||
return SendgridNotificationService(api_key, sender, recipient)
|
return SendgridNotificationService(api_key, sender, recipient)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue