input_text - Added service doc (#10238)

* * Added service doc

* * Deleted print statement
This commit is contained in:
cdce8p 2017-10-31 14:51:12 +01:00 committed by Pascal Vizeli
parent 25a25dde7a
commit 12e1602a81
2 changed files with 18 additions and 0 deletions

View File

@ -4,12 +4,14 @@ Component to offer a way to enter a value into a text box.
For more details about this component, please refer to the documentation
at https://home-assistant.io/components/input_text/
"""
import os
import asyncio
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.config import load_yaml_config_file
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_UNIT_OF_MEASUREMENT, CONF_ICON, CONF_NAME)
from homeassistant.loader import bind_hass
@ -110,8 +112,13 @@ def async_setup(hass, config):
if tasks:
yield from asyncio.wait(tasks, loop=hass.loop)
descriptions = yield from hass.async_add_job(
load_yaml_config_file, os.path.join(
os.path.dirname(__file__), 'services.yaml'))
hass.services.async_register(
DOMAIN, SERVICE_SET_VALUE, async_set_value_service,
description=descriptions[DOMAIN][SERVICE_SET_VALUE],
schema=SERVICE_SET_VALUE_SCHEMA)
yield from component.async_add_entities(entities)

View File

@ -453,6 +453,17 @@ input_boolean:
description: Entity id of the input boolean to turn on.
example: 'input_boolean.notify_alerts'
input_text:
set_value:
description: Set the value of an input text entity.
fields:
entity_id:
description: Entity id of the input text to set the new value.
example: 'input_text.text1'
value:
description: The target value the entity should be set to.
example: This is an example text
input_number:
set_value:
description: Set the value of an input number entity.