diff --git a/homeassistant/components/input_boolean.py b/homeassistant/components/input_boolean.py index 3c4efdce175476338653b73f4482e656ab8e6a95..e60f44e8ea065b54bdde604e91b5a1d7522c981c 100644 --- a/homeassistant/components/input_boolean.py +++ b/homeassistant/components/input_boolean.py @@ -6,6 +6,7 @@ at https://home-assistant.io/components/input_boolean/ """ import asyncio import logging +import os import voluptuous as vol @@ -14,6 +15,7 @@ from homeassistant.const import ( SERVICE_TOGGLE, STATE_ON) 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 ToggleEntity from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.restore_state import async_get_last_state @@ -102,12 +104,23 @@ 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_TURN_OFF, async_handler_service, schema=SERVICE_SCHEMA) + DOMAIN, SERVICE_TURN_OFF, async_handler_service, + descriptions[DOMAIN][SERVICE_TURN_OFF], + schema=SERVICE_SCHEMA) hass.services.async_register( - DOMAIN, SERVICE_TURN_ON, async_handler_service, schema=SERVICE_SCHEMA) + DOMAIN, SERVICE_TURN_ON, async_handler_service, + descriptions[DOMAIN][SERVICE_TURN_ON], + schema=SERVICE_SCHEMA) hass.services.async_register( - DOMAIN, SERVICE_TOGGLE, async_handler_service, schema=SERVICE_SCHEMA) + DOMAIN, SERVICE_TOGGLE, async_handler_service, + descriptions[DOMAIN][SERVICE_TOGGLE], + schema=SERVICE_SCHEMA) yield from component.async_add_entities(entities) return True diff --git a/homeassistant/components/services.yaml b/homeassistant/components/services.yaml index 545a883be8fc4d2cb0115c15a4c0329f8dcf9a98..865a6c7df5883e3ca0282d8da03fef355b6a0311 100644 --- a/homeassistant/components/services.yaml +++ b/homeassistant/components/services.yaml @@ -600,3 +600,28 @@ abode: entity_id: description: Entity id of the quick action to trigger. example: 'binary_sensor.home_quick_action' + +input_boolean: + toggle: + description: Toggles an input boolean + + fields: + entity_id: + description: Entity id of the input boolean to toggle + example: 'input_boolean.notify_alerts' + + turn_off: + description: Turns OFF an input boolean + + fields: + entity_id: + description: Entity id of the input boolean to turn off + example: 'input_boolean.notify_alerts' + + turn_on: + description: Turns ON an input boolean + + fields: + entity_id: + description: Entity id of the input boolean to turn on + example: 'input_boolean.notify_alerts'