Update voluptuous for existing notify platforms (#3133)

* Update voluptuous for exists notify platforms

* fix constants
This commit is contained in:
Pascal Vizeli 2016-09-05 13:27:10 +02:00 committed by GitHub
parent 1170b2897a
commit 48c1631178
6 changed files with 53 additions and 52 deletions

View file

@ -7,29 +7,30 @@ https://home-assistant.io/components/notify.aws_lambda/
import logging
import json
import base64
import voluptuous as vol
from homeassistant.const import (
CONF_PLATFORM, CONF_NAME)
from homeassistant.components.notify import (
ATTR_TARGET, BaseNotificationService)
ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService)
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
REQUIREMENTS = ["boto3==1.3.1"]
CONF_REGION = "region_name"
CONF_ACCESS_KEY_ID = "aws_access_key_id"
CONF_SECRET_ACCESS_KEY = "aws_secret_access_key"
CONF_PROFILE_NAME = "profile_name"
CONF_CONTEXT = "context"
CONF_REGION = 'region_name'
CONF_ACCESS_KEY_ID = 'aws_access_key_id'
CONF_SECRET_ACCESS_KEY = 'aws_secret_access_key'
CONF_PROFILE_NAME = 'profile_name'
CONF_CONTEXT = 'context'
ATTR_CREDENTIALS = 'credentials'
PLATFORM_SCHEMA = vol.Schema({
vol.Required(CONF_PLATFORM): "aws_lambda",
vol.Optional(CONF_NAME): vol.Coerce(str),
vol.Optional(CONF_REGION, default="us-east-1"): vol.Coerce(str),
vol.Inclusive(CONF_ACCESS_KEY_ID, "credentials"): vol.Coerce(str),
vol.Inclusive(CONF_SECRET_ACCESS_KEY, "credentials"): vol.Coerce(str),
vol.Exclusive(CONF_PROFILE_NAME, "credentials"): vol.Coerce(str),
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_REGION, default="us-east-1"): cv.string,
vol.Inclusive(CONF_ACCESS_KEY_ID, ATTR_CREDENTIALS): cv.string,
vol.Inclusive(CONF_SECRET_ACCESS_KEY, ATTR_CREDENTIALS): cv.string,
vol.Exclusive(CONF_PROFILE_NAME, ATTR_CREDENTIALS): cv.string,
vol.Optional(CONF_CONTEXT, default=dict()): vol.Coerce(dict)
})