-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
""" | ||
import asyncio | ||
import logging | ||
import os | ||
|
||
import voluptuous as vol | ||
|
||
|
@@ -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 | ||
|
@@ -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, | ||
descriptions[DOMAIN][SERVICE_TURN_OFF], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. trailing whitespace |
||
descriptions[DOMAIN][SERVICE_TURN_ON], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. trailing whitespace |
||
descriptions[DOMAIN][SERVICE_TOGGLE], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace