From 24aa3b3c97291789e12622618e625d830947428b Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 8 Sep 2016 16:11:00 +0200 Subject: [PATCH] Add voluptuous to ecobee (#3257) --- homeassistant/components/notify/ecobee.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/notify/ecobee.py b/homeassistant/components/notify/ecobee.py index 861d5439e4c..4ac4a9ca8db 100644 --- a/homeassistant/components/notify/ecobee.py +++ b/homeassistant/components/notify/ecobee.py @@ -5,16 +5,28 @@ For more details about this platform, please refer to the documentation at https://home-assistant.io/components/notify.ecobee/ """ import logging + +import voluptuous as vol + 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'] _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): """Get the Ecobee notification service.""" - index = int(config['index']) if 'index' in config else 0 + index = config.get(CONF_INDEX) return EcobeeNotificationService(index)