Service validation for scene component.

pull/1821/head
Jan Harkes 2016-04-12 02:01:22 -04:00
parent 567d1065b2
commit ad6f5d3b1d
1 changed files with 9 additions and 1 deletions

View File

@ -7,9 +7,12 @@ https://home-assistant.io/components/scene/
import logging
from collections import namedtuple
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID, SERVICE_TURN_ON, CONF_PLATFORM)
from homeassistant.helpers import extract_domain_configs
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import EntityComponent
@ -19,6 +22,10 @@ STATE = 'scening'
CONF_ENTITIES = "entities"
SCENE_SERVICE_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
})
SceneConfig = namedtuple('SceneConfig', ['name', 'states'])
@ -61,7 +68,8 @@ def setup(hass, config):
for scene in target_scenes:
scene.activate()
hass.services.register(DOMAIN, SERVICE_TURN_ON, handle_scene_service)
hass.services.register(DOMAIN, SERVICE_TURN_ON, handle_scene_service,
schema=SCENE_SERVICE_SCHEMA)
return True