Add voluptuous to ecobee (#3257)

This commit is contained in:
Pascal Vizeli 2016-09-08 16:11:00 +02:00 committed by Fabian Affolter
parent 1af5d4c8b8
commit 24aa3b3c97

View File

@ -5,16 +5,28 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.ecobee/ https://home-assistant.io/components/notify.ecobee/
""" """
import logging import logging
import voluptuous as vol
from homeassistant.components import ecobee from homeassistant.components import ecobee
from homeassistant.components.notify import BaseNotificationService from homeassistant.components.notify import (
BaseNotificationService, PLATFORM_SCHEMA) # NOQA
import homeassistant.helpers.config_validation as cv
DEPENDENCIES = ['ecobee'] DEPENDENCIES = ['ecobee']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
CONF_INDEX = 'index'
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_INDEX, default=0): cv.positive_int,
})
def get_service(hass, config): def get_service(hass, config):
"""Get the Ecobee notification service.""" """Get the Ecobee notification service."""
index = int(config['index']) if 'index' in config else 0 index = config.get(CONF_INDEX)
return EcobeeNotificationService(index) return EcobeeNotificationService(index)