Use voluptuous for free mobile (#3236)
parent
c1139a9fda
commit
d06a3c9145
|
@ -6,22 +6,25 @@ https://home-assistant.io/components/notify.free_mobile/
|
|||
"""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.notify import DOMAIN, BaseNotificationService
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
PLATFORM_SCHEMA, BaseNotificationService)
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_USERNAME
|
||||
from homeassistant.helpers import validate_config
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
REQUIREMENTS = ['freesms==0.1.0']
|
||||
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_USERNAME): cv.string,
|
||||
vol.Required(CONF_ACCESS_TOKEN): cv.string,
|
||||
})
|
||||
|
||||
|
||||
def get_service(hass, config):
|
||||
"""Get the Free Mobile SMS notification service."""
|
||||
if not validate_config({DOMAIN: config},
|
||||
{DOMAIN: [CONF_USERNAME,
|
||||
CONF_ACCESS_TOKEN]},
|
||||
_LOGGER):
|
||||
return None
|
||||
|
||||
return FreeSMSNotificationService(config[CONF_USERNAME],
|
||||
config[CONF_ACCESS_TOKEN])
|
||||
|
||||
|
|
Loading…
Reference in New Issue