Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added services.yaml integration for input_boolean #9519

Merged
merged 3 commits into from
Sep 21, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions homeassistant/components/input_boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
import asyncio
import logging
import os

import voluptuous as vol

Expand All @@ -14,6 +15,7 @@
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
Expand Down Expand Up @@ -102,12 +104,23 @@ def async_handler_service(service):
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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

descriptions[DOMAIN][SERVICE_TURN_OFF],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

schema=SERVICE_SCHEMA)
hass.services.async_register(
DOMAIN, SERVICE_TURN_ON, async_handler_service, schema=SERVICE_SCHEMA)
DOMAIN, SERVICE_TURN_ON, async_handler_service,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

descriptions[DOMAIN][SERVICE_TURN_ON],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

schema=SERVICE_SCHEMA)
hass.services.async_register(
DOMAIN, SERVICE_TOGGLE, async_handler_service, schema=SERVICE_SCHEMA)
DOMAIN, SERVICE_TOGGLE, async_handler_service,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

descriptions[DOMAIN][SERVICE_TOGGLE],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

schema=SERVICE_SCHEMA)

yield from component.async_add_entities(entities)
return True
Expand Down
25 changes: 25 additions & 0 deletions homeassistant/components/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'