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

Move core services.yaml file to Home Assistant integration #22489

Merged
merged 2 commits into from
Mar 30, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
39 changes: 39 additions & 0 deletions homeassistant/components/homeassistant/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
check_config:
description: Check the Home Assistant configuration files for errors. Errors will be displayed in the Home Assistant log.

reload_core_config:
description: Reload the core configuration.

restart:
description: Restart the Home Assistant service.

stop:
description: Stop the Home Assistant service.

toggle:
description: Generic service to toggle devices on/off under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.
fields:
entity_id:
description: The entity_id of the device to toggle on/off.
example: light.living_room

turn_on:
description: Generic service to turn devices on under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.
fields:
entity_id:
description: The entity_id of the device to turn on.
example: light.living_room

turn_off:
description: Generic service to turn devices off under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.
fields:
entity_id:
description: The entity_id of the device to turn off.
example: light.living_room

update_entity:
description: Force one or more entities to update its data
fields:
entity_id:
description: One or multiple entity_ids to update. Can be a list.
example: light.living_room
35 changes: 0 additions & 35 deletions homeassistant/components/services.yaml

This file was deleted.

12 changes: 2 additions & 10 deletions homeassistant/helpers/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,7 @@ async def async_get_all_descriptions(hass):

def domain_yaml_file(domain):
"""Return the services.yaml location for a domain."""
if domain == ha.DOMAIN:
from homeassistant import components
component_path = path.dirname(components.__file__)
else:
component_path = path.dirname(get_component(hass, domain).__file__)
component_path = path.dirname(get_component(hass, domain).__file__)
return path.join(component_path, 'services.yaml')

def load_services_files(yaml_files):
Expand Down Expand Up @@ -195,7 +191,6 @@ def load_services_files(yaml_files):
loaded = await hass.async_add_job(load_services_files, missing)

# Build response
catch_all_yaml_file = domain_yaml_file(ha.DOMAIN)
descriptions = {}
for domain in services:
descriptions[domain] = {}
Expand All @@ -207,10 +202,7 @@ def load_services_files(yaml_files):

# Cache missing descriptions
if description is None:
if yaml_file == catch_all_yaml_file:
yaml_services = loaded[yaml_file].get(domain, {})
else:
yaml_services = loaded[yaml_file]
yaml_services = loaded[yaml_file]
yaml_description = yaml_services.get(service, {})

description = description_cache[cache_key] = {
Expand Down