diff --git a/homeassistant/components/automation/__init__.py b/homeassistant/components/automation/__init__.py index 0e8bf30ae13..f0011f07561 100644 --- a/homeassistant/components/automation/__init__.py +++ b/homeassistant/components/automation/__init__.py @@ -14,6 +14,7 @@ from homeassistant.core import Context, CoreState from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import condition, extract_domain_configs, script import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.config_validation import ENTITY_SERVICE_SCHEMA from homeassistant.helpers.entity import ToggleEntity from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.restore_state import RestoreEntity @@ -85,12 +86,7 @@ PLATFORM_SCHEMA = vol.Schema({ vol.Required(CONF_ACTION): cv.SCRIPT_SCHEMA, }) -SERVICE_SCHEMA = vol.Schema({ - vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids, -}) - -TRIGGER_SERVICE_SCHEMA = vol.Schema({ - vol.Required(ATTR_ENTITY_ID): cv.comp_entity_ids, +TRIGGER_SERVICE_SCHEMA = ENTITY_SERVICE_SCHEMA.extend({ vol.Optional(ATTR_VARIABLES, default={}): dict, }) @@ -165,12 +161,12 @@ async def async_setup(hass, config): hass.services.async_register( DOMAIN, SERVICE_TOGGLE, toggle_service_handler, - schema=SERVICE_SCHEMA) + schema=ENTITY_SERVICE_SCHEMA) for service in (SERVICE_TURN_ON, SERVICE_TURN_OFF): hass.services.async_register( DOMAIN, service, turn_onoff_service_handler, - schema=SERVICE_SCHEMA) + schema=ENTITY_SERVICE_SCHEMA) return True