Input Select - Added service description (#11456)

This commit is contained in:
cdce8p
2018-01-05 09:02:10 +01:00
committed by Paulus Schoutsen
parent b7c7041873
commit 1e9e6927eb
2 changed files with 43 additions and 0 deletions

View File

@@ -6,12 +6,14 @@ at https://home-assistant.io/components/input_select/
"""
import asyncio
import logging
import os
import voluptuous as vol
from homeassistant.const import ATTR_ENTITY_ID, CONF_ICON, CONF_NAME
from homeassistant.loader import bind_hass
import homeassistant.helpers.config_validation as cv
from homeassistant.config import load_yaml_config_file
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.restore_state import async_get_last_state
@@ -129,6 +131,11 @@ def async_setup(hass, config):
if not entities:
return False
descriptions = yield from hass.async_add_job(
load_yaml_config_file, os.path.join(
os.path.dirname(__file__), 'services.yaml')
)
@asyncio.coroutine
def async_select_option_service(call):
"""Handle a calls to the input select option service."""
@@ -141,6 +148,7 @@ def async_setup(hass, config):
hass.services.async_register(
DOMAIN, SERVICE_SELECT_OPTION, async_select_option_service,
descriptions[DOMAIN][SERVICE_SELECT_OPTION],
schema=SERVICE_SELECT_OPTION_SCHEMA)
@asyncio.coroutine
@@ -155,6 +163,7 @@ def async_setup(hass, config):
hass.services.async_register(
DOMAIN, SERVICE_SELECT_NEXT, async_select_next_service,
descriptions[DOMAIN][SERVICE_SELECT_NEXT],
schema=SERVICE_SELECT_NEXT_SCHEMA)
@asyncio.coroutine
@@ -169,6 +178,7 @@ def async_setup(hass, config):
hass.services.async_register(
DOMAIN, SERVICE_SELECT_PREVIOUS, async_select_previous_service,
descriptions[DOMAIN][SERVICE_SELECT_PREVIOUS],
schema=SERVICE_SELECT_PREVIOUS_SCHEMA)
@asyncio.coroutine
@@ -183,6 +193,7 @@ def async_setup(hass, config):
hass.services.async_register(
DOMAIN, SERVICE_SET_OPTIONS, async_set_options_service,
descriptions[DOMAIN][SERVICE_SET_OPTIONS],
schema=SERVICE_SET_OPTIONS_SCHEMA)
yield from component.async_add_entities(entities)